Package org.apache.geronimo.security

Examples of org.apache.geronimo.security.GeronimoSecurityException


                configuration.addToUncheckedPolicy(new WebResourcePermission(name, actions));
                configuration.addToUncheckedPolicy(new WebUserDataPermission(name, actions));
            }
        } catch (PolicyContextException e) {
            throw new GeronimoSecurityException(e);
        }
    }
View Full Code Here


                        for (int k = 0; k < roleNames.length; k++) {
                            configuration.addToRole(roleNames[k].getStringValue(), permission);
                        }
                    }
                } catch (PolicyContextException e) {
                    throw new GeronimoSecurityException(e);
                }
            }
        }

        /**
         * Section 3.1.5.2
         */
        if (excludeList != null) {
            MethodType[] methods = excludeList.getMethodArray();
            try {
                for (int i = 0; i < methods.length; i++) {
                    EJBMethodPermission permission = new EJBMethodPermission(methods[i].getEjbName().getStringValue(),
                                                                             methods[i].getMethodName().getStringValue(),
                                                                             methods[i].getMethodIntf().getStringValue(),
                                                                             toStringArray(methods[i].getMethodParams().getMethodParamArray()));
                    configuration.addToExcludedPolicy(permission);
                }
            } catch (PolicyContextException e) {
                throw new GeronimoSecurityException(e);
            }
        }

        /**
         * Section 3.1.5.3
View Full Code Here

                String roleLink = roleRefs[i].getRoleLink().getStringValue();

                configuration.addToRole(roleLink, new EJBRoleRefPermission(ejbName, roleName));
            }
        } catch (PolicyContextException e) {
            throw new GeronimoSecurityException(e);
        }
    }
View Full Code Here

            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);
            }

            Iterator keys = roleRefs.keySet().iterator();
            while (keys.hasNext()) {
                String roleLink = (String) keys.next();
                iter = ((Set) roleRefs.get(roleLink)).iterator();

                while (iter.hasNext()) {
                    configuration.addToRole(roleLink, (WebRoleRefPermission) iter.next());
                }
            }
        } catch (ClassCastException cce) {
            throw new GeronimoSecurityException("Policy configuration object does not implement RoleMappingConfiguration", cce.getCause());
        } catch (PolicyContextException e) {
            throw new GeronimoSecurityException(e);
        }
    }
View Full Code Here

            }

            log.info("Properties File Realm - " + getRealmName() + " - refresh");
        } catch (IOException e) {
            log.info("Properties File Realm - " + getRealmName() + " - refresh failed");
            throw new GeronimoSecurityException(e);
        }
    }
View Full Code Here

                                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

Related Classes of org.apache.geronimo.security.GeronimoSecurityException

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.