}
List<String> roles = getUserRoleListService().getRolesForUser( JcrTenantUtils.getCurrentTenant(), username );
authorities = new GrantedAuthority[ roles.size() ];
for ( int i = 0; i < roles.size(); i++ ) {
authorities[ i ] = new GrantedAuthorityImpl( roles.get( i ) );
}
} else {
authorities = auth.getAuthorities();
}
auths = new GrantedAuthority[ authorities.length ];
// cache the roles while we're here
for ( int i = 0; i < authorities.length; i++ ) {
String role = authorities[ i ].getAuthority();
final String tenatedRoleString = JcrTenantUtils.getTenantedRole( role );
synchronized ( roleCache ) {
if ( !roleCache.containsKey( role ) ) {
final SpringSecurityRolePrincipal ssRolePrincipal = new SpringSecurityRolePrincipal( tenatedRoleString );
roleCache.put( role, ssRolePrincipal );
}
}
auths[ i ] = new GrantedAuthorityImpl( tenatedRoleString );
}
if ( logger.isTraceEnabled() ) {
logger.trace( "found user in back-end " + user.getUsername() ); //$NON-NLS-1$
}
} catch ( UsernameNotFoundException e ) {