My question is similar to this one
How to pass an additional parameter with spring security login page
though it applies to Grails Spring Security plugin. If I have to support an additional field in login (company name) , how do I do it in Grails?
I will get the company name field from the URL.
For example. /login?companyname=c1 /login?companyname=c2
The same user name can be used by different users in different companies. So user name is not unique but user name + company name is unique.
Thanks in Advance.
This is not nice solution but you can join username and company name into single username field. For example oneUser_company1
, oneUser_company2
. In that case, you would have to create multiple accounts for single user.
I think that this custom filter is a start point.
Probably you will need a custom AuthenticationToken
to store your company name, instead of using UsernamePasswordAuthenticationToken
.
You will need an AuthenticationProvider too, since you will need to get your user by username and company.
The flow will be:
AuthenticationToken
, storing the company field. AuthenticationProvider
will get this token and try to load the user by username and company
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.