Spring security uses two fields combination for authenticating a user while login.
First is :
grails.plugin.springsecurity.userLookup.usernamePropertyName
and the second is password field.
By default field usernamePropertyName is set to username in DefaultSecurityConfig.groovy file of spring security core plugin.
You can override this feature and use any other field of User domain like email or mobileNumber for user authentication.
If you want to authenticate a user via email and password combination while login, you can add this line to your conf.groovy file
grails.plugin.springsecurity.userLookup.usernamePropertyName='email'
Now after adding this line , spring security will store user’s email in session.
So , the output of tag <sec:username/> will give you current user’s email.
Thanks
More From Oodles
Ready to innovate? Let's get in touch
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Akash Sharma
Akash is a bright Groovy and Grails developer and have worked on development of various SaaS applications using Grails technologies. Akash loves playing Cricket and Tennis