In the license server configure (AuthorizationServerEndpointsConfigurer endpoints) method for the following configuration
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
provider.setUserDetailsService(this.myUserDetailsService);
provider.setPasswordEncoder(this.passwordEncoder);
AuthenticationManager authenticationManager = new AuthenticationManager(){
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
if(authentication.getDetails() ! =null && authentication.getDetails() instanceof Map) {
// Here you can get the parameters in the /oauth/token request
Map<String, String> parameters = (Map<String, String>) authentication.getDetails();
String code = parameters.get("code");
String uuid = parameters.get("uuid");
if (code.equals(redisUtil.get(uuid))){
authentication = provider.authenticate(authentication);
}else{
throw new InvalidGrantException("Verification code error"); }}returnauthentication; }}; endpoints.authenticationManager(authenticationManager)Copy the code