Package org.apache.geronimo.security

Examples of org.apache.geronimo.security.GeronimoSecurityException


     * @param role The role that is to be mapped to a set of principals.
     * @param principals The set of principals that are to be mapped to to role.
     * @throws org.apache.geronimo.security.GeronimoSecurityException if the mapping principals to the same role twice occurs.
     */
    public void addRoleMapping(String role, Collection principals) throws GeronimoSecurityException {
        if (!configured) throw new GeronimoSecurityException("Must call configure() first");

        try {
            RoleMappingConfiguration roleMapper = (RoleMappingConfiguration) policyConfiguration;

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

            roleMapper.addRoleMapping(role, principals);
        } catch (ClassCastException cce) {
            throw new GeronimoSecurityException("Policy configuration object does not implement RoleMappingConfiguration", cce.getCause());
        } catch (PolicyContextException pe) {
            throw new GeronimoSecurityException("Method addRoleMapping threw an exception", pe.getCause());
        }
    }
View Full Code Here


        PolicyConfiguration other;

        try {
            other = factory.getPolicyConfiguration(link.getContextID(), false);
        } catch (PolicyContextException e) {
            throw new GeronimoSecurityException("Unable to find policy configuration with that id", e);
        }

        if (other != null) {
            try {
                policyConfiguration.linkConfiguration(other);
            } catch (PolicyContextException e) {
                throw new GeronimoSecurityException("Unable to link configuration", e.getCause());
            }

        }
    }
View Full Code Here

     */
    public void delete() throws GeronimoSecurityException {
        try {
            policyConfiguration.delete();
        } catch (PolicyContextException e) {
            throw new GeronimoSecurityException("Unable to delete configuration", e.getCause());
        }
    }
View Full Code Here

     */
    public void commit() throws GeronimoSecurityException {
        try {
            policyConfiguration.commit();
        } catch (PolicyContextException e) {
            throw new GeronimoSecurityException("Unable to commit configuration", e.getCause());
        }
    }
View Full Code Here

     */
    public boolean inService() throws GeronimoSecurityException {
        try {
            return policyConfiguration.inService();
        } catch (PolicyContextException e) {
            throw new GeronimoSecurityException("Unable to obtain inService state", e.getCause());
        }
    }
View Full Code Here

            //calling refresh is not thread safe wrt authorization calls.
            this.users.putAll(users);
            this.groups.putAll(groups);

        } catch (SQLException sqle) {
            throw new GeronimoSecurityException(sqle);
        }
    }
View Full Code Here

                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

        try {
            factory = PolicyConfigurationFactory.getPolicyConfigurationFactory();
            policyConfiguration = factory.getPolicyConfiguration(contextId, false);
        } catch (ClassNotFoundException e) {
            throw new GeronimoSecurityException("Unable to find PolicyConfigurationFactory", e);
        } catch (PolicyContextException e) {
            throw new GeronimoSecurityException("Unable to find policy configuration with that id", e);
        }
    }
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.