Do not expire registration tokens
parent
eadeded09c
commit
ad2ace6d74
|
@ -142,11 +142,13 @@ public class DefaultOAuth2ProviderTokenService implements OAuth2TokenEntityServi
|
||||||
Set<String> scopes = Sets.newHashSet(clientAuth.getScope());
|
Set<String> scopes = Sets.newHashSet(clientAuth.getScope());
|
||||||
token.setScope(scopes);
|
token.setScope(scopes);
|
||||||
|
|
||||||
// make it expire if necessary
|
// make it expire if necessary - exclude Registration Tokens as these should always be long-lived
|
||||||
|
if (!scopes.contains(OAuth2AccessTokenEntity.REGISTRATION_TOKEN_SCOPE)) {
|
||||||
if (client.getAccessTokenValiditySeconds() != null && client.getAccessTokenValiditySeconds() > 0) {
|
if (client.getAccessTokenValiditySeconds() != null && client.getAccessTokenValiditySeconds() > 0) {
|
||||||
Date expiration = new Date(System.currentTimeMillis() + (client.getAccessTokenValiditySeconds() * 1000L));
|
Date expiration = new Date(System.currentTimeMillis() + (client.getAccessTokenValiditySeconds() * 1000L));
|
||||||
token.setExpiration(expiration);
|
token.setExpiration(expiration);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// attach the authorization so that we can look it up later
|
// attach the authorization so that we can look it up later
|
||||||
AuthenticationHolderEntity authHolder = new AuthenticationHolderEntity();
|
AuthenticationHolderEntity authHolder = new AuthenticationHolderEntity();
|
||||||
|
|
Loading…
Reference in New Issue