@ SuppressWarnings ( "unchecked" ) public static Map < String , Set < String > > getAttributes ( Subject subject ) { Map < String , Set < String > > attributes = null ; if ( subject . getPublicCredentials ( ) == null ) { return new HashMap < String , Set < String > > ( ) ; } @ SuppressWarnings ( "rawtypes" ) Iterator < HashMap > credentialObjects = subject . getPublicCredentials ( HashMap . class ) . iterator ( ) ; while ( attributes == null && credentialObjects . hasNext ( ) ) { HashMap < ? , ? > credentialObject = credentialObjects . next ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "checking for attributes (class name): " + credentialObject . getClass ( ) . getName ( ) ) ; } Object key = null ; Iterator < ? > keys = null ; keys = credentialObject . keySet ( ) . iterator ( ) ; if ( ! keys . hasNext ( ) ) { continue ; } key = keys . next ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "checking for attributes (key object name): " + key . getClass ( ) . getName ( ) ) ; } if ( ! ( key instanceof String ) ) { continue ; } keys = credentialObject . values ( ) . iterator ( ) ; if ( ! keys . hasNext ( ) ) { continue ; } key = keys . next ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "checking for attributes (value object name): " + key . getClass ( ) . getName ( ) ) ; } if ( ! ( key instanceof HashSet ) ) { continue ; } attributes = ( Map < String , Set < String > > ) credentialObject ; } if ( attributes == null ) { attributes = new HashMap < String , Set < String > > ( ) ; subject . getPublicCredentials ( ) . add ( attributes ) ; } return attributes ; }
Get the attribute map of String keys to Set&lt ; String&gt ; values This method will not return a null