public Collection < GrantedAuthority > getGrantedAuthorities ( DirContextOperations user , String username ) { String userDn = user . getNameInNamespace ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Getting authorities for user " + userDn ) ; } Set < GrantedAuthority > roles = getGroupMembershipRoles ( userDn , username ) ; Set < GrantedAuthority > extraRoles = getAdditionalRoles ( user , username ) ; if ( extraRoles != null ) { roles . addAll ( extraRoles ) ; } if ( defaultRole != null ) { roles . add ( defaultRole ) ; } List < GrantedAuthority > result = new ArrayList < GrantedAuthority > ( roles . size ( ) ) ; result . addAll ( roles ) ; return result ; }
Obtains the authorities for the user who s directory entry is represented by the supplied LdapUserDetails object .