java - Custom AuthenticationProvider with extra login fields -


i have customauthenticationprovider , want authenticate user 3 parameters: username, password , tokenpin. @ moment have little problem provider:

@component  public class customauthenticationprovider implements authenticationprovider {   @autowired private userservice userservice;   @override public authentication authenticate(authentication authentication) throws authenticationexception {      string username = authentication.getname();     string password = authentication.getcredentials().tostring();     string pin = ????      authentication auth = null;      user user = userservice.findbyusernameandpassword(username, password);      if (user != null) {         list<grantedauthority> grantedauths = new arraylist<>();         grantedauths.add(new simplegrantedauthority("role_admin"));         auth = new usernamepasswordauthenticationtoken(username, password, grantedauths);     }       return auth; }  @override public boolean supports(class<?> authentication) {     return authentication.equals(usernamepasswordauthenticationtoken.class); } 

}


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -