简体   繁体   中英

Making Grails Spring Security To Authenticate Users With Email

We have a grails app which is working fine with the spring security plugin. As per our requirements, we see that there is no need for username field.

Without username field in the DB we wish to authenticate the users with email and their password. Is that possible to do so?

Thanks in advance.

Simply put in config.groovy

grails{
    plugins{
             springsecurity{
                    userLookup.usernamePropertyName = 'myemailfield'
                 }
        }
}

where myemailfield is the name of your email field in user domain

or we can do also:

grails.plugins.springsecurity.userLookup.usernamePropertyName = 'email' 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM