D
D
Dmitry Belousov2017-03-18 12:54:00
Java
Dmitry Belousov, 2017-03-18 12:54:00

How to pass the name to the page, not the login?

<li><a href="/profile">${pageContext.request.userPrincipal.name}</a></li>

With this code i get the login, but how do i get the username?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene Khrustalev, 2017-03-18
@dreven

If we are talking about Spring Security, then
for this you need to override the UserDetailsService class, which will return, again, an overridden UserDetails with additional attributes. Then these attributes will be available.
An example of authorization through Active Directory - a bunch of different attributes are pulled out there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question