Set<String> authorizedRoles(Session session) throws SecurityException
This function returns the authorized roles associated with a session based on hierarchical relationships.
The function is valid if and only if the session is a valid Fortress session.
Parameters:
Returns:
Throws:
import org.apache.directory.fortress.core.AccessMgr; import org.apache.directory.fortress.core.AccessMgrFactory; import org.apache.directory.fortress.core.SecurityException; import org.apache.directory.fortress.core.model.Session; @test public static void testAuthorizedRoles( Session session ) { String szLocation = ".testAuthorizedRoles"; try { // Instantiate the AccessMgr implementation. AccessMgr accessMgr = AccessMgrFactory.createInstance(); // Using Session object returned from createSession Set<String> roles = accessMgr.authorizedRoles( session ); assertNotNull( roles ); for ( String roleName : roles ) { LOG.info( szLocation + "user [" + session.getUserId() + "] role [" + roleName + "]" ); } } catch ( SecurityException ex ) { LOG.error( szLocation + " caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex ); fail( ex.getMessage() ); } }