Good Day All,
Is it possible to have different token validity seconds depending on the grant type ? I want to to have the access tokens that are issued with "client_credentials" grant type last longer than access tokens issued with "password" grant type.
This is how its currently configured.
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.inMemory()
.withClient(clientId)
.secret( passwordEncoder.encode(clientSecret))
.scopes("read")
.accessTokenValiditySeconds(300)
.refreshTokenValiditySeconds(86400)
.authorizedGrantTypes("client_credentials", "password","refresh_token");
}
Client credentials token is used to make sure that any requests are coming from the correct client application. These end-ponits do not require a user to be logged in.
Password credentials token is issued when a user logs in. They are only valid for 5 minutes and get refreshed using refresh token.
This all works fine until I realized that client credentials token also expires after 5 minutes.
Which leads to my original question ?
Can I specify different "Access Token Validity Seconds" depending the grant type ?
Thanks All your help is always highly appreciated