I simply need the name of the currently logged in user. The same that gets displayed in gsp with <sec:username/>
. I'm at a loss as to what to do.
Here's previous answers and questions - they all seem to require some import and none of the solutions works for me:
- Grails Spring Security (get current user)
- How to get id of the current user logged in grails?
- How to get current_user by using Spring Security Grails plugin in GSP
- Grails and Spring Security: How do I get the authenticated user from within a controller?
Specifically, I want to access the username insides a controller and put it into a variable of a domain instance in order to persist it (alongsides other information) into the database for logging purposes. Insides that controller, there's nothing to be seen that even remotely refers to Person/User classes, spring security or any other thing that sounds like it might do what I intend.