Browse Source

Enhancer AccessToken

MaxKey 2 years ago
parent
commit
69900167d9

+ 5 - 1
maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/token/DefaultTokenServices.java

@@ -97,7 +97,7 @@ public class DefaultTokenServices implements AuthorizationServerTokenServices, R
 			else {
 				// Re-store the access token in case the authentication has changed
 				tokenStore.storeAccessToken(existingAccessToken, authentication);
-				return existingAccessToken;
+				return enhancerToken(existingAccessToken, authentication);
 			}
 		}
 
@@ -299,6 +299,10 @@ public class DefaultTokenServices implements AuthorizationServerTokenServices, R
 		token.setRefreshToken(refreshToken);
 		token.setScope(authentication.getOAuth2Request().getScope());
 
+		return enhancerToken(token, authentication);
+	}
+	
+	private OAuth2AccessToken enhancerToken(OAuth2AccessToken token , OAuth2Authentication authentication) {
 		return accessTokenEnhancer != null ? accessTokenEnhancer.enhance(token, authentication) : token;
 	}