In JSP I can get username by ${pageContext.request.remoteUser}
. But there is also additional info (rating of user) I need to display on every page of my site. How can I access it, considering there is a @Service
to get it by username?
For what it's worth I use custom authentication provider:
@Service
public class MyUserDetailsService implements UserDetailsService {
public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
return new User(s, "password", Arrays.asList(new SimpleGrantedAuthority("ROLE_USER")));
}
}
<security:authentication-manager>
<security:authentication-provider user-service-ref='myUserDetailsService'/>
</security:authentication-manager>