@ SuppressWarnings ( "unchecked" ) private static List < String > getWebSphereGroups ( final String securityName ) { Context ic = null ; try { // TODO: Cache UserRegistry object ic = new InitialContext ( ) ; Object objRef = ic . lookup ( USER_REGISTRY ) ; Object userReg = invokeMethod ( getNarrowMethod ( ) , null , objRef , Class . forName ( "com.ibm.websphere.security.UserRegistry" ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Determining WebSphere groups for user " + securityName + " using WebSphere UserRegistry " + userReg ) ; } final Collection groups = ( Collection ) invokeMethod ( getGroupsForUserMethod ( ) , userReg , new Object [ ] { securityName } ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Groups for user " + securityName + ": " + groups . toString ( ) ) ; } return new ArrayList ( groups ) ; } catch ( Exception e ) { logger . error ( "Exception occured while looking up groups for user" , e ) ; throw new RuntimeException ( "Exception occured while looking up groups for user" , e ) ; } finally { try { if ( ic != null ) { ic . close ( ) ; } } catch ( NamingException e ) { logger . debug ( "Exception occured while closing context" , e ) ; } } }
Get the WebSphere group names for the given security name .