As default in spring authorization server
it generate unique token each request.
But the requirement is to generate same token
if the previous token is still not expired, and if expired must generate new token.
Is this even possible?
RegisteredClient
.withId(UUID.randomUUID().toString())
.clientId("client")
.clientSecret("{noop}secret")
.clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC)
.authorizationGrantType(AuthorizationGrantType.CLIENT_CREDENTIALS)
.clientSettings(ClientSettings.builder()
.tokenEndpointAuthenticationSigningAlgorithm(SignatureAlgorithm.RS256)
.build())
.tokenSettings(TokenSettings.builder()
.accessTokenFormat(OAuth2TokenFormat.SELF_CONTAINED)
.idTokenSignatureAlgorithm(SignatureAlgorithm.RS256)
.accessTokenTimeToLive(Duration.ofMinutes(30))
.build())
.scope("read")
.build();
public OAuth2AuthorizationService authorizationService() {
return new InMemoryOAuth2AuthorizationService();
}