public static Access authorizeAllResourceActions ( final AuthenticationResult authenticationResult , final Iterable < ResourceAction > resourceActions , final AuthorizerMapper authorizerMapper ) { final Authorizer authorizer = authorizerMapper . getAuthorizer ( authenticationResult . getAuthorizerName ( ) ) ; if ( authorizer == null ) { throw new ISE ( "No authorizer found with name: [%s]." , authenticationResult . getAuthorizerName ( ) ) ; } // this method returns on first failure, so only successful Access results are kept in the cache final Set < ResourceAction > resultCache = new HashSet <> ( ) ; for ( ResourceAction resourceAction : resourceActions ) { if ( resultCache . contains ( resourceAction ) ) { continue ; } final Access access = authorizer . authorize ( authenticationResult , resourceAction . getResource ( ) , resourceAction . getAction ( ) ) ; if ( ! access . isAllowed ( ) ) { return access ; } else { resultCache . add ( resourceAction ) ; } } return Access . OK ; }
Check a list of resource - actions to be performed by the identity represented by authenticationResult .