Package org.apache.geronimo.security.jacc

Examples of org.apache.geronimo.security.jacc.RoleMappingConfiguration


                configuration.addToUncheckedPolicy(new WebResourcePermission(name, actions));
                configuration.addToUncheckedPolicy(new WebUserDataPermission(name, actions));
            }

            JettyWebAppJACCContext context = (JettyWebAppJACCContext) getWebApplicationContext();
            RoleMappingConfiguration roleMapper = (RoleMappingConfiguration) configuration;
            Iterator rollMappings = security.getRoleMappings().iterator();
            while (rollMappings.hasNext()) {
                Role role = (Role) rollMappings.next();
                String roleName = role.getRoleName();

                if (!securityRoles.contains(roleName)) throw new GeronimoSecurityException("Role does not exist in this configuration");

                Subject roleDesignate = new Subject();

                Iterator realms = role.getRealms().iterator();
                while (realms.hasNext()) {
                    Set principalSet = new HashSet();
                    Realm realm = (Realm) realms.next();

                    Iterator principals = realm.getPrincipals().iterator();
                    while (principals.hasNext()) {
                        Principal principal = (Principal) principals.next();

                        RealmPrincipal realmPrincipal = ConfigurationUtil.generateRealmPrincipal(principal, realm.getRealmName());

                        if (realmPrincipal == null) throw new GeronimoSecurityException("Unable to create realm principal");

                        principalSet.add(realmPrincipal);
                        if (principal.isDesignatedRunAs()) roleDesignate.getPrincipals().add(realmPrincipal);
                    }
                    roleMapper.addRoleMapping(roleName, principalSet);
                }

                if (roleDesignate.getPrincipals().size() > 0) context.setRoleDesignate(roleName, roleDesignate);
            }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.security.jacc.RoleMappingConfiguration

Copyright © 2018 www.massapicom. 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.