Examples of SecurityRoleMapper


Examples of com.sun.enterprise.deployment.interfaces.SecurityRoleMapper

        Set allRoles = app.getRoles();
        if (allRoles == null) {
            logger.finest("- No roles present.");
            return;
        }
        SecurityRoleMapper rmap = app.getRoleMapper();
        if (rmap == null) {
            logger.finest("- No role mappings present.");
            return;
        }
       
        i = allRoles.iterator();
        logger.finest("--[ Configured roles and mappings ]--");
        HashMap allRoleMap = new HashMap();
       
        while (i.hasNext()) {
            Role r = (Role)i.next();
            logger.finest(" [" + r.getName() + "]");
            allRoleMap.put(r.getName(), new HashSet());
           
            sb = new StringBuffer();
            sb.append("  is mapped to groups: ");
            Enumeration grps = rmap.getGroupsAssignedTo(r);
            while (grps.hasMoreElements()) {
                sb.append(grps.nextElement());
                sb.append(" ");
            }
            logger.finest(sb.toString());

            sb = new StringBuffer();
            sb.append("  is mapped to principals: ");
            Enumeration users = rmap.getUsersAssignedTo(r);
            while (users.hasMoreElements()) {
                sb.append(users.nextElement());
                sb.append(" ");
            }
            logger.finest(sb.toString());
View Full Code Here

Examples of com.sun.enterprise.deployment.interfaces.SecurityRoleMapper

            descriptor.getSunDescriptor().addSecurityRoleMapping(srm);
            // store it in the application using pure DOL descriptors...
            Application app = descriptor.getApplication();
            if (app!=null) {
                Role role = new Role(srm.getRoleName());
                SecurityRoleMapper rm = app.getRoleMapper();
                if (rm != null) {
                    List<PrincipalNameDescriptor> principals = srm.getPrincipalNames();
                    for (int i = 0; i < principals.size(); i++) {
                        rm.assignRole(principals.get(i).getPrincipal(),
                            role, descriptor);
                    }
                    List<String> groups = srm.getGroupNames();
                    for (int i = 0; i < groups.size(); i++) {
                        rm.assignRole(new Group(groups.get(i)),
                            role, descriptor);
                    }
                }
            }               
        }
View Full Code Here

Examples of com.sun.enterprise.deployment.interfaces.SecurityRoleMapper

     * @param    appId    the registration name used for this application
     */
    public void setRegistrationName(String appId) {
       
        // at his point we need to swap our RoleMapper, if we have one...
        SecurityRoleMapper roleMapper=null;
        try {
            roleMapper = getRoleMapper();
        } catch(IllegalArgumentException ignore) {};
       
        if (roleMapper!=null) {
            SecurityRoleMapperFactory factory = SecurityRoleMapperFactoryMgr.getFactory();
            if (factory==null) {
                throw new IllegalArgumentException(localStrings.getLocalString(
                    "enterprise.deployment.norolemapperfactorydefine",
                    "This application has no role mapper factory defined"));
            }
      factory.removeRoleMapper(getName());
            roleMapper.setName(appId);
            factory.setRoleMapper(appId, roleMapper);
        }
       
        this.registrationName = appId;       
    }
View Full Code Here

Examples of com.sun.enterprise.deployment.interfaces.SecurityRoleMapper

            SecurityRoleMapping roleMap = (SecurityRoleMapping)newDescriptor;
            descriptor.addSecurityRoleMapping(roleMap);
            Application app = descriptor.getApplication();
            if (app!=null) {
                Role role = new Role(roleMap.getRoleName());
                SecurityRoleMapper rm = app.getRoleMapper();
                if (rm != null) {
                    List<PrincipalNameDescriptor> principals = roleMap.getPrincipalNames();
                    for (int i = 0; i < principals.size(); i++) {
                        rm.assignRole(principals.get(i).getPrincipal(),
                            role, descriptor);
                    }
                    List<String> groups = roleMap.getGroupNames();
                    for (int i = 0; i < groups.size(); i++) {
                        rm.assignRole(new Group(groups.get(i)),
                            role, descriptor);
                    }
                }
            }
        }
View Full Code Here

Examples of com.sun.enterprise.deployment.interfaces.SecurityRoleMapper

  if (rolePermissionsTable != null) {
      // Make sure a role to subject map has been defined for the Policy Context
      if (factory != null) {
                // the rolemapper is stored against the
                // appname, for a web app get the appname for this contextid
                SecurityRoleMapper srm = factory.getRoleMapper(CONTEXT_ID);
    if (srm != null) {
        roleToSubjectMap = srm.getRoleToSubjectMapping();
    }
    if (roleToSubjectMap != null) {
        // make sure all liked PC's have the same roleToSubjectMap
        Set linkSet = (Set) linkTable.get(CONTEXT_ID);
        if (linkSet != null) {
      Iterator it = linkSet.iterator();
      while (it.hasNext()) {
          String contextId = (String)it.next();
          if (!CONTEXT_ID.equals(contextId)) {
        SecurityRoleMapper otherSrm = factory.getRoleMapper(contextId);
        Map otherRoleToSubjectMap = null;

        if (otherSrm != null) {
            otherRoleToSubjectMap = otherSrm.getRoleToSubjectMapping();
        }
       
        if (otherRoleToSubjectMap != roleToSubjectMap) {
                                    String defMsg="Linked policy contexts have different roleToSubjectMaps ("+CONTEXT_ID+")<->("+contextId+")";
                                    String msg=localStrings.getLocalString("pc.linked_with_different_role_maps",defMsg,new Object []{CONTEXT_ID,contextId});
View Full Code Here

Examples of com.sun.enterprise.deployment.interfaces.SecurityRoleMapper

        if (newDescriptor instanceof SecurityRoleMapping) {
            SecurityRoleMapping roleMap = (SecurityRoleMapping) newDescriptor;
            descriptor.addSecurityRoleMapping(roleMap);
            if (descriptor!=null && !descriptor.isVirtual()) {
                Role role = new Role(roleMap.getRoleName());
                SecurityRoleMapper rm = descriptor.getRoleMapper();
                if (rm != null) {
                    List<PrincipalNameDescriptor> principals = roleMap.getPrincipalNames();
                    for (int i = 0; i < principals.size(); i++) {
                        rm.assignRole(principals.get(i).getPrincipal(),
                            role, descriptor);
                    }
                    List<String> groups = roleMap.getGroupNames();
                    for (int i = 0; i < groups.size(); i++) {
                        rm.assignRole(new Group(groups.get(i)),
                            role, descriptor);
                    }
                }
            }
        }
View Full Code Here

Examples of com.sun.enterprise.deployment.interfaces.SecurityRoleMapper

            }

            for (int si = 0; si < srmList.length; si++) {
                SecurityRoleMapping srm = srmList[si];
                Role role = new Role(srm.getRoleName());
                SecurityRoleMapper rm = factory.getRoleMapper(name);

                if (rm != null) {
                    List<PrincipalNameDescriptor> principals = srm.getPrincipalNames();

                    for (int i = 0; i < principals.size(); i++) {
                        rm.assignRole(principals.get(i).getPrincipal(), role,
                                descriptor);
                    }

                    List<String> groups = srm.getGroupNames();

                    for (int i = 0; i < groups.size(); i++) {
                        rm.assignRole(new Group(groups.get(i)), role, descriptor);
                    }
                }
            }
        }
View Full Code Here

Examples of com.sun.enterprise.deployment.interfaces.SecurityRoleMapper

        }

        for (int si = 0; si < srmList.length; si++) {
            SecurityRoleMapping srm = srmList[si];
            Role role = new Role(srm.getRoleName());
            SecurityRoleMapper rm = factory.getRoleMapper(name);

            if (rm != null) {
                List<PrincipalNameDescriptor> principals = srm.getPrincipalNames();

                for (int i = 0; i < principals.size(); i++) {
                    rm.assignRole(principals.get(i).getPrincipal(), role,
                            sbd);
                }

                List<String> groups = srm.getGroupNames();

                for (int i = 0; i < groups.size(); i++) {
                    rm.assignRole(new Group(groups.get(i)), role, sbd);
                }
            }
        }

View Full Code Here

Examples of com.sun.enterprise.deployment.interfaces.SecurityRoleMapper

            // store it in the application using pure DOL descriptors...
            Application app = descriptor.getApplication();

            if (app != null) {
                Role role = new Role(srm.getRoleName());
                SecurityRoleMapper rm = app.getRoleMapper();

                if (rm != null) {
                    List<PrincipalNameDescriptor> principals = srm.getPrincipalNames();

                    for (int i = 0; i < principals.size(); i++) {
                        rm.assignRole(principals.get(i).getPrincipal(), role,
                            descriptor);
                    }

                    List<String> groups = srm.getGroupNames();

                    for (int i = 0; i < groups.size(); i++) {
                        rm.assignRole(new Group(groups.get(i)), role, descriptor);
                    }
                }
            }
        } else {
            super.addDescriptor(descriptor);
View Full Code Here

Examples of com.sun.enterprise.deployment.interfaces.SecurityRoleMapper

    public SecurityRoleMapper getRoleMapper(String appName) {
        // if the appName is not appname but contextid for
        // web apps then get the appname
        String contextId = appName;
        String appname = getAppNameForContext(appName);
        SecurityRoleMapper srm = null;
        if(appname != null)
            srm = RoleMapper.getRoleMapper(appname);
        if(srm == null){
            srm = RoleMapper.getRoleMapper(contextId);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.