Skip to content
Advertisement

Spring Boot Oauth2 Extending DefaultTokenServices

I have an OAuth2 implementation that is working fine for the grant type = password. Now I need to add a logic of restricting the same user/password combination to be allowed to login again if the user is logged in earlier. For that, I researched and figured that I to create a new class (MyDefaultTokenService) that extends the DefaultTokenServices class and then add my logic in the overriden createAccessToken method. But for some reason when I debug and test, I dont hit the breakpoints placed in MyDefaultTokenService class. It always hits the Springboot’s DefaultTokenServices class. I dont know where I am going wrong, could somebody please.

AuthorizationConfiguration.java

JavaScript

Resource Server Configuration

JavaScript

Advertisement

Answer

The answer to this: needed a call to AuthorizationServerEndpointsConfigurer.tokenServices in the configure method.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement