I have 4 group: admin, service, user, guest, admin is created in database, the first time admin login required change password, I want to redirect to form change password and only admin need that, I set redirect in onAuthFailure, but service, user, guest that not authentication in some action and redirect change password form, have a good idea, please tell me, what should I do for every role redirect an other link? , I just read document about deadbolt in 2 day, can I don't understand more, sorry for my English.
Thanks.
Within a
DeadboltHandler
implementation, theonAuthFailure
method can use thegetSubject
to get the current user, and through that, the roles held by the user.Anywhere there's a comment in that example, e.g.
/*go to admin section*/
you need to replace it with aResult
.There are other methods available in
DeadboltAnalyzer
, so you can have more complex checks than justanalyzer.hasRole(maybeSubject, "admin")
if necessary.