/** * @see ISecurityManagement#getAuthorizationManager(String) */ public AuthorizationManager getAuthorizationManager(String securityDomain) { return new JBossAuthorizationManager(securityDomain); }
/** Does the current Subject have a role(a Principal) that equates to one of the role names. @see #doesUserHaveRole(Principal, Set) @param principal - ignored. The current authenticated Subject determines the active user and assigned user roles. @param role - the application domain role that the principal is to be validated against. @return true if the active principal has the role, false otherwise. */ public boolean doesUserHaveRole(Principal principal, Principal role) { boolean hasRole = false; RoleGroup roles = this.getCurrentRoles(principal); hasRole = doesRoleGroupHaveRole(role, roles); return hasRole; }
/** * @see AuthorizationManager#authorize(Resource, Subject, Group) */ public int authorize(Resource resource, Subject subject, Group roleGroup) throws AuthorizationException { this.validateResource(resource); return internalAuthorization(resource, subject, getRoleGroup(roleGroup)); }
/** * @see AuthorizationManager#authorize(Resource, Subject, RoleGroup) */ public int authorize(Resource resource, Subject subject, RoleGroup role) throws AuthorizationException { this.validateResource(resource); return internalAuthorization(resource, subject, role); }
/** Return the set of domain roles the current active Subject 'Roles' group found in the subject Principals set. @param principal - ignored. The current authenticated Subject determines the active user and assigned user roles. @return The Set<Principal> for the application domain roles that the principal has been assigned. */ public Set<Principal> getUserRoles(Principal principal) { RoleGroup userRoles = getCurrentRoles(principal); return this.getRolesAsSet(userRoles); }
throw new IllegalArgumentException("Sec Ctx sc passed is null"); Group subjectRoles = getGroupFromSubject(subject); userRoles = copyGroups(userRoles, subjectRoles); userRoles = this.getEmptyRoleGroup();
private RoleGroup getCurrentRoles(Principal principal) { //Check that the caller is authenticated to the current thread Subject subject = SubjectActions.getActiveSubject(); //Deal with the security context SecurityContext sc = SubjectActions.getSecurityContext(); if(sc == null) { sc = new JBossSecurityContext(securityDomain); SubjectActions.setSecurityContext(sc); } return getCurrentRoles(principal,subject,sc); }
/** * @see AuthorizationManager#authorize(Resource, Subject) */ public int authorize(Resource resource, Subject subject) throws AuthorizationException { return internalAuthorization(resource, subject, null); }
/** * Copy the principals from the second group into the first. * If the first group is null and the second group is not, the * first group will be made equal to the second group * @param source * @param toCopy */ private RoleGroup copyGroups(RoleGroup source, Group toCopy) { if(toCopy == null) return source; if(source == null && toCopy != null) source = this.getEmptyRoleGroup(); Enumeration<? extends Principal> en = toCopy.members(); while(en.hasMoreElements()) { source.addRole(new SimpleRole(en.nextElement().getName())); } return source; }
throw PicketBoxMessages.MESSAGES.invalidNullArgument("securityContext"); Group subjectRoles = getGroupFromSubject(subject); userRoles = copyGroups(userRoles, subjectRoles); userRoles = this.getEmptyRoleGroup();
/** * @see AuthorizationManager#authorize(Resource, Subject, RoleGroup) */ public int authorize(Resource resource, Subject subject, RoleGroup role) throws AuthorizationException { this.validateResource(resource); return internalAuthorization(resource, subject, role); }
/** Return the set of domain roles the current active Subject 'Roles' group found in the subject Principals set. @param principal - ignored. The current authenticated Subject determines the active user and assigned user roles. @return The Set<Principal> for the application domain roles that the principal has been assigned. */ public Set<Principal> getUserRoles(Principal principal) { RoleGroup userRoles = getCurrentRoles(principal); return this.getRolesAsSet(userRoles); }
private RoleGroup getCurrentRoles(Principal principal) { //Check that the caller is authenticated to the current thread Subject subject = SubjectActions.getActiveSubject(); //Deal with the security context SecurityContext sc = SubjectActions.getSecurityContext(); if(sc == null) { sc = new JBossSecurityContext(securityDomain); SubjectActions.setSecurityContext(sc); } return getCurrentRoles(principal,subject,sc); }
/** * @see AuthorizationManager#authorize(Resource, Subject) */ public int authorize(Resource resource, Subject subject) throws AuthorizationException { return internalAuthorization(resource, subject, null); }
/** * Copy the principals from the second group into the first. * If the first group is null and the second group is not, the * first group will be made equal to the second group * @param source * @param toCopy */ private RoleGroup copyGroups(RoleGroup source, Group toCopy) { if(toCopy == null) return source; if(source == null && toCopy != null) source = this.getEmptyRoleGroup(); Enumeration<? extends Principal> en = toCopy.members(); while(en.hasMoreElements()) { source.addRole(new SimpleRole(en.nextElement().getName())); } return source; }
/** * @see AuthorizationManager#authorize(Resource, Subject, Group) */ public int authorize(Resource resource, Subject subject, Group roleGroup) throws AuthorizationException { this.validateResource(resource); return internalAuthorization(resource, subject, getRoleGroup(roleGroup)); }
/** * @see AuthorizationManager#authorize(Resource) */ public int authorize(Resource resource) throws AuthorizationException { validateResource(resource); Subject subject = SubjectActions.getActiveSubject(); return internalAuthorization(resource,subject, null); }
/** Does the current Subject have a role(a Principal) that equates to one of the role names. @see #doesUserHaveRole(Principal, Set) @param principal - ignored. The current authenticated Subject determines the active user and assigned user roles. @param role - the application domain role that the principal is to be validated against. @return true if the active principal has the role, false otherwise. */ public boolean doesUserHaveRole(Principal principal, Principal role) { boolean hasRole = false; RoleGroup roles = this.getCurrentRoles(principal); hasRole = doesRoleGroupHaveRole(role, roles); return hasRole; }
/** * @see ISecurityManagement#getAuthorizationManager(String) */ public AuthorizationManager getAuthorizationManager(String securityDomain) { return new JBossAuthorizationManager(securityDomain); }
RoleGroup roles = this.getCurrentRoles(callerPrincipal, authenticatedSubject, sc); if(roles == null) roles = new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);