Created
February 7, 2022 08:00
-
-
Save m87h/1d918e769b34e5fbbeb96f5c422b3676 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example; | |
import org.springframework.security.oauth2.core.OAuth2TokenType; | |
import org.springframework.security.oauth2.server.authorization.JwtEncodingContext; | |
import org.springframework.security.oauth2.server.authorization.OAuth2TokenCustomizer; | |
import org.springframework.stereotype.Component; | |
@Component | |
public class JwtCustomizer implements OAuth2TokenCustomizer<JwtEncodingContext> { | |
@Override | |
public void customize(JwtEncodingContext context) { | |
if (OAuth2TokenType.ACCESS_TOKEN.equals(context.getTokenType())) { | |
context.getClaims().claim("key", "value"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment