Examples of GerRoleType


Examples of org.apache.geronimo.xbeans.geronimo.security.GerRoleType

        }

        if (securityType.isSetRoleMappings()) {
            GerRoleMappingsType roleMappingsType = securityType.getRoleMappings();
            for (int i = 0; i < roleMappingsType.sizeOfRoleArray(); i++) {
                GerRoleType roleType = roleMappingsType.getRoleArray(i);
                Role role = new Role();

                String roleName = roleType.getRoleName().trim();
                role.setRoleName(roleName);

                for (int j = 0; j < roleType.sizeOfRealmPrincipalArray(); j++) {
                    role.getRealmPrincipals().add(GeronimoSecurityBuilderImpl.buildRealmPrincipal(roleType.getRealmPrincipalArray(j)));
                }

                for (int j = 0; j < roleType.sizeOfLoginDomainPrincipalArray(); j++) {
                    role.getLoginDomainPrincipals().add(GeronimoSecurityBuilderImpl.buildDomainPrincipal(roleType.getLoginDomainPrincipalArray(j)));
                }

                for (int j = 0; j < roleType.sizeOfPrincipalArray(); j++) {
                    role.getPrincipals().add(buildPrincipal(roleType.getPrincipalArray(j)));
                }

                for (int j = 0; j < roleType.sizeOfDistinguishedNameArray(); j++) {
                    GerDistinguishedNameType dnType = roleType.getDistinguishedNameArray(j);

                    role.getDistinguishedNames().add(new DistinguishedName(dnType.getName().trim(), dnType.getDesignatedRunAs()));
                }

                security.getRoleMappings().put(roleName, role);
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.security.GerRoleType

        }

        if (securityType.isSetRoleMappings()) {
            GerRoleMappingsType roleMappingsType = securityType.getRoleMappings();
            for (int i = 0; i < roleMappingsType.sizeOfRoleArray(); i++) {
                GerRoleType roleType = roleMappingsType.getRoleArray(i);
                Role role = new Role();

                String roleName = roleType.getRoleName().trim();
                role.setRoleName(roleName);

                for (int j = 0; j < roleType.sizeOfRealmPrincipalArray(); j++) {
                    role.getRealmPrincipals().add(buildRealmPrincipal(roleType.getRealmPrincipalArray(j)));
                }

                for (int j = 0; j < roleType.sizeOfLoginDomainPrincipalArray(); j++) {
                    role.getLoginDomainPrincipals().add(buildDomainPrincipal(roleType.getLoginDomainPrincipalArray(j)));
                }

                for (int j = 0; j < roleType.sizeOfPrincipalArray(); j++) {
                    role.getPrincipals().add(buildPrincipal(roleType.getPrincipalArray(j)));
                }

                for (int j = 0; j < roleType.sizeOfDistinguishedNameArray(); j++) {
                    GerDistinguishedNameType dnType = roleType.getDistinguishedNameArray(j);

                    role.getDistinguishedNames().add(new DistinguishedName(dnType.getName().trim(), dnType.getDesignatedRunAs()));
                }

                security.getRoleMappings().put(roleName, role);
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.security.GerRoleType

        Map<String, SubjectInfo> roleDesignates = new HashMap<String, SubjectInfo>();
        Map<Principal, Set<String>> principalRoleMap = new HashMap<Principal, Set<String>>();
        if (securityType.isSetRoleMappings()) {
            GerRoleMappingsType roleMappingsType = securityType.getRoleMappings();
            for (int i = 0; i < roleMappingsType.sizeOfRoleArray(); i++) {
                GerRoleType roleType = roleMappingsType.getRoleArray(i);

                String roleName = roleType.getRoleName().trim();
                if (roleType.isSetRunAsSubject()) {
                    SubjectInfo subjectInfo = buildSubjectInfo(roleType.getRunAsSubject());
                    roleDesignates.put(roleName, subjectInfo);
                }

                for (int j = 0; j < roleType.sizeOfRealmPrincipalArray(); j++) {
                    Principal principal = buildRealmPrincipal(roleType.getRealmPrincipalArray(j), bundle);
                    add(roleName, principal, principalRoleMap);
                }

                for (int j = 0; j < roleType.sizeOfLoginDomainPrincipalArray(); j++) {
                    Principal principal = buildDomainPrincipal(roleType.getLoginDomainPrincipalArray(j), bundle);
                    add(roleName, principal, principalRoleMap);
                }

                for (int j = 0; j < roleType.sizeOfPrincipalArray(); j++) {
                    Principal principal = buildPrincipal(roleType.getPrincipalArray(j), bundle);
                    add(roleName, principal, principalRoleMap);
                }

            }
        }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.security.GerRoleType

        }

        if (securityType.isSetRoleMappings()) {
            GerRoleMappingsType roleMappingsType = securityType.getRoleMappings();
            for (int i = 0; i < roleMappingsType.sizeOfRoleArray(); i++) {
                GerRoleType roleType = roleMappingsType.getRoleArray(i);
                Role role = new Role();

                String roleName = roleType.getRoleName().trim();
                role.setRoleName(roleName);

                for (int j = 0; j < roleType.sizeOfRealmPrincipalArray(); j++) {
                    role.getRealmPrincipals().add(GeronimoSecurityBuilderImpl.buildRealmPrincipal(roleType.getRealmPrincipalArray(j)));
                }

                for (int j = 0; j < roleType.sizeOfLoginDomainPrincipalArray(); j++) {
                    role.getLoginDomainPrincipals().add(GeronimoSecurityBuilderImpl.buildDomainPrincipal(roleType.getLoginDomainPrincipalArray(j)));
                }

                for (int j = 0; j < roleType.sizeOfPrincipalArray(); j++) {
                    role.getPrincipals().add(buildPrincipal(roleType.getPrincipalArray(j)));
                }

                for (int j = 0; j < roleType.sizeOfDistinguishedNameArray(); j++) {
                    GerDistinguishedNameType dnType = roleType.getDistinguishedNameArray(j);

                    role.getDistinguishedNames().add(new DistinguishedName(dnType.getName().trim(), dnType.getDesignatedRunAs()));
                }

                security.getRoleMappings().put(roleName, role);
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.security.GerRoleType

            security.setDefaultPrincipal(defaultPrincipal);

            GerRoleMappingsType roleMappingsType = securityType.getRoleMappings();
            if (roleMappingsType != null) {
                for (int i = 0; i < roleMappingsType.sizeOfRoleArray(); i++) {
                    GerRoleType roleType = roleMappingsType.getRoleArray(i);
                    Role role = new Role();

                    role.setRoleName(roleType.getRoleName());

                    for (int j = 0; j < roleType.sizeOfRealmArray(); j++) {
                        GerRealmType realmType = roleType.getRealmArray(j);
                        Realm realm = new Realm();

                        realm.setRealmName(realmType.getRealmName());

                        for (int k = 0; k < realmType.sizeOfPrincipalArray(); k++) {
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.security.GerRoleType

            GerRoleType[] roles = warConfig.getSecurity().getRoleMappings().getRoleArray();
            items = new SecurityRoleJson[roles.length];

            for (int i = 0; i < roles.length; i++) {
                SecurityRoleJson jRole = new SecurityRoleJson();
                GerRoleType role = roles[i];
                String roleName = role.getRoleName();
                jRole.setRoleName(roleName);

                GerPrincipalType[] principals = role.getPrincipalArray();
                GerLoginDomainPrincipalType[] loginDomainPrincipals = role.getLoginDomainPrincipalArray();
                GerRealmPrincipalType[] realmPrincipals = role.getRealmPrincipalArray();
                GerDistinguishedNameType[] distinguishedNames = role.getDistinguishedNameArray();

                int jLength = principals.length + loginDomainPrincipals.length + realmPrincipals.length + distinguishedNames.length;

                if (jLength > 0) {
                    SecurityPrincipalJson[] jPrincipals = new SecurityPrincipalJson[jLength];
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.security.GerRoleType

            for (int i = 0; i < items.length; i++) {
                SecurityPrincipalJson[] jPrincipals = items[i].getChildren();
                SecurityRoleJson item = items[i];

                GerRoleType role = roleMappings.addNewRole();
                role.setRoleName(item.getRoleName());

                for (int j = 0; j < jPrincipals.length; j++) {
                    SecurityPrincipalJson jPrincipal = jPrincipals[j];
                    String type = jPrincipal.getType();

                    if (type.equals("Principal")) {
                        GerPrincipalType principal = role.addNewPrincipal();
                        principal.setName(jPrincipal.getPrincipalName());
                        principal.setClass1(jPrincipal.getClassName());
                    } else if (type.equals("LoginDomainPrincipal")) {
                        GerLoginDomainPrincipalType principal = role.addNewLoginDomainPrincipal();
                        principal.setName(jPrincipal.getPrincipalName());
                        principal.setClass1(jPrincipal.getClassName());
                        principal.setDomainName(jPrincipal.getDomainName());
                    } else if (type.equals("RealmPrincipal")) {
                        GerRealmPrincipalType principal = role.addNewRealmPrincipal();
                        principal.setName(jPrincipal.getPrincipalName());
                        principal.setClass1(jPrincipal.getClassName());
                        principal.setDomainName(jPrincipal.getDomainName());
                        principal.setRealmName(jPrincipal.getRealmName());
                    } else if (type.equals("DistinguishedName")) {
                        GerDistinguishedNameType principal = role.addNewDistinguishedName();
                        principal.setName(jPrincipal.getPrincipalName());
                    }
                }

                if (runAsSubjects != null
                        && runAsSubjects.containsKey(item.getRoleName())) {
                    GerSubjectInfoType gerRunAsSubject = role.addNewRunAsSubject();
                    Subject runAsSubject = runAsSubjects.get(item.getRoleName());
                    gerRunAsSubject.setId(runAsSubject.getId());
                    gerRunAsSubject.setRealm(runAsSubject.getRealm());
                }
            }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.security.GerRoleType

                data.setSecurity(GerSecurityType.Factory.newInstance());
                data.getSecurity().addNewRoleMappings();
            }
            for (int i = 0; i < securityRoles.length; i++) {
                String roleName = securityRoles[i].getRoleName().getStringValue();
                GerRoleType role = data.getSecurity().getRoleMappings().addNewRole();
                role.setRoleName(roleName);
            }
        }
        /*ddBeans = ddBean.getChildBean("message-destination");
        for (int i = 0; ddBeans != null && i < ddBeans.length; i++) {
            String refName = ddBeans[i].getChildBean("message-destination-name")[0].getText();
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.security.GerRoleType

        if (security != null) {
            GerRoleMappingsType roleMappings = security.getRoleMappings();
            if (roleMappings != null) {
                GerRoleType[] roles = roleMappings.getRoleArray();
                for (int i = 0; i < roles.length; i++) {
                    GerRoleType role = roles[i];
                    GerRealmType[] realms = role.getRealmArray();
                    for (int j = 0; j < realms.length; j++) {
                        GerRealmType realm = realms[j];
                        GerPrincipalType[] principals = realm.getPrincipalArray();
                        HashSet set = new HashSet();
                        for (int k = 0; k < principals.length; k++) {
                            GerPrincipalType principal = principals[k];
                            java.security.Principal p = null;
                            try {
                                Class clazz = Class.forName(principal.getClass1());
                                Constructor constructor = clazz.getDeclaredConstructor(new Class[]{String.class});
                                p = (java.security.Principal) constructor.newInstance(new Object[]{principal.getName()});
                                set.add(new RealmPrincipal(realm.getRealmName(), p));
                            } catch (InstantiationException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (IllegalAccessException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (ClassNotFoundException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (NoSuchMethodException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (InvocationTargetException e) {
                                throw new GeronimoSecurityException(e);
                            }
                        }
                        super.addRoleMapping(role.getRoleName(), set);
                    }
                }
            }
        }
    }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.security.GerRoleType

        if (security != null) {
            GerRoleMappingsType roleMappings = security.getRoleMappings();
            if (roleMappings != null) {
                GerRoleType[] roles = roleMappings.getRoleArray();
                for (int i = 0; i < roles.length; i++) {
                    GerRoleType role = roles[i];
                    GerRealmType[] realms = role.getRealmArray();
                    for (int j = 0; j < realms.length; j++) {
                        GerRealmType realm = realms[j];
                        GerPrincipalType[] principals = realm.getPrincipalArray();
                        HashSet set = new HashSet();
                        for (int k = 0; k < principals.length; k++) {
                            GerPrincipalType principal = principals[k];
                            java.security.Principal p = null;
                            try {
                                Class clazz = Class.forName(principal.getClass1());
                                Constructor constructor = clazz.getDeclaredConstructor(new Class[]{String.class});
                                p = (java.security.Principal) constructor.newInstance(new Object[]{principal.getName()});
                                set.add(new RealmPrincipal(realm.getRealmName(), p));
                            } catch (InstantiationException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (IllegalAccessException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (ClassNotFoundException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (NoSuchMethodException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (InvocationTargetException e) {
                                throw new GeronimoSecurityException(e);
                            }
                        }
                        super.addRoleMapping(role.getRoleName(), set);
                    }
                }
            }
        }
    }
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.