private void addRolesToSubject ( Subject subject , Set < String > userRoles ) { if ( userRoles == null ) { userRoles = Collections . emptySet ( ) ; } Map < String , Set < String > > attributes = SubjectUtils . getAttributes ( subject ) ; Set < String > roles = attributes . get ( ROLE_KEY ) ; if ( roles == null ) { roles = new HashSet < String > ( userRoles ) ; attributes . put ( ROLE_KEY , roles ) ; } else { roles . addAll ( userRoles ) ; } if ( logger . isDebugEnabled ( ) ) { for ( String role : userRoles ) { logger . debug ( "added role: {}" , role ) ; } } }
Adds roles to the Subject object .