/** * Return the set of roles used in this application. Currently, for release 1.0, it is an * * aggregation of all the roles in the sub-modules of the application. * * @return the Set of roles in the application. */ public Set<Role> getRoles() { Set<Role> roles = new HashSet<Role>(); for (WebBundleDescriptor wbd : getWebBundleDescriptors()) { if (wbd != null) { roles.addAll(wbd.getRoles()); } } for (EjbBundleDescriptor ejbd : getEjbBundleDescriptors()) { if (ejbd != null) { roles.addAll(ejbd.getRoles()); } } return roles; }
Set roleset = wbd.getRoles(); Set<WebComponentDescriptor> descs = wbd.getWebComponentDescriptors();
Set roleset = wbd.getRoles(); Role anyAuthUserRole = new Role("**"); boolean rolesetContainsAnyAuthUserRole = roleset.contains(anyAuthUserRole);
Set<Role> roleSet = wbd.getRoles();
Set<Role> roleSet = wbd.getRoles();
/** * Remove All Policy Statements from Configuration * config must be in open state when this method is called * @param pc * @param wbd * @throws javax.security.jacc.PolicyContextException */ public static void removePolicyStatements(PolicyConfiguration pc, WebBundleDescriptor wbd) throws javax.security.jacc.PolicyContextException { pc.removeUncheckedPolicy(); pc.removeExcludedPolicy(); // iteration done for old providers Set<Role> roleSet = wbd.getRoles(); for (Role r : roleSet) { pc.removeRole(r.getName()); } // 1st call will remove "*" role if present. 2nd will remove all roles (if supported). pc.removeRole("*"); pc.removeRole("*"); }
/** * Remove All Policy Statements from Configuration * config must be in open state when this method is called * @param pc * @param wbd * @throws javax.security.jacc.PolicyContextException */ public static void removePolicyStatements(PolicyConfiguration pc, WebBundleDescriptor wbd) throws javax.security.jacc.PolicyContextException { pc.removeUncheckedPolicy(); pc.removeExcludedPolicy(); // iteration done for old providers Set<Role> roleSet = wbd.getRoles(); for (Role r : roleSet) { pc.removeRole(r.getName()); } // 1st call will remove "*" role if present. 2nd will remove all roles (if supported). pc.removeRole("*"); pc.removeRole("*"); }