private boolean isSubjectAuthorized ( String resourceName , Collection < String > requiredRoles , Subject subject ) { AccessDecisionService accessDecisionService = accessDecisionServiceRef . getService ( ) ; // check user access first boolean isGranted = false ; WSCredential wsCred = getWSCredentialFromSubject ( subject ) ; String accessId = getAccessId ( wsCred ) ; // if (useRoleAsGroupName && !isAuthzInfoAvailableForApp(resourceName) && !resourceName.equalsIgnoreCase(ADMIN_RESOURCE_NAME)) { if ( useRoleAsGroupName && ! isAuthzInfoAvailableForApp ( resourceName ) ) { isGranted = useRoleAsGroupNameForAccessDecision ( resourceName , requiredRoles , subject , accessDecisionService , wsCred ) ; } else { isGranted = useAppBndForAccessDecision ( resourceName , requiredRoles , subject , accessDecisionService , wsCred , accessId ) ; } return isGranted ; }
Check if the Subject is authorized to the required roles for a given resource . The user is checked first and if it s not authorized then each group is checked .