Closed datenwort closed 6 years ago
That's simple, we don't set the remote user explicitly :wink:
To get the currently authenticated user please use the SecurityHelper. Especially the getCurrentUserId()
method is a good starting point. It gives you the ID of the currently logged in user, which in your case is the one who did the request to your controller, or null if no one is logged in.
The ID can be used to get further information about the user from the UserManagement by invoking UserManagement.getUserById(Long userId, Converter<User, T> converter)
. The UserManagement is accessible via the ServiceLocator's findService method.
Thanks.
I am facing a very weird issue.
The call
request.getRemoteUser()
sometimes returns the id of the user and sometimes the alias. I cannot reproduce the environment, but it changes from time to time.Any clue on this?