public final class JwtGenerator extends java.lang.Object implements OAuth2TokenGenerator<org.springframework.security.oauth2.jwt.Jwt>
OAuth2TokenGenerator,
Jwt,
JwtEncoder,
OAuth2TokenCustomizer,
JwtEncodingContext,
OAuth2AccessToken,
OidcIdToken| Constructor and Description |
|---|
JwtGenerator(org.springframework.security.oauth2.jwt.JwtEncoder jwtEncoder)
Constructs a
JwtGenerator using the provided parameters. |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.security.oauth2.jwt.Jwt |
generate(OAuth2TokenContext context)
Generate an OAuth 2.0 Token using the attributes contained in the
OAuth2TokenContext,
or return null if the OAuth2TokenContext.getTokenType() is not supported. |
void |
setJwtCustomizer(OAuth2TokenCustomizer<JwtEncodingContext> jwtCustomizer)
|
public JwtGenerator(org.springframework.security.oauth2.jwt.JwtEncoder jwtEncoder)
JwtGenerator using the provided parameters.jwtEncoder - the jwt encoder@Nullable public org.springframework.security.oauth2.jwt.Jwt generate(OAuth2TokenContext context)
OAuth2TokenGeneratorOAuth2TokenContext,
or return null if the OAuth2TokenContext.getTokenType() is not supported.
If the returned OAuth2Token has a set of claims, it should implement ClaimAccessor
in order for it to be stored with the OAuth2Authorization.
generate in interface OAuth2TokenGenerator<org.springframework.security.oauth2.jwt.Jwt>context - the context containing the OAuth 2.0 Token attributesOAuth2Token or null if the OAuth2TokenContext.getTokenType() is not supportedpublic void setJwtCustomizer(OAuth2TokenCustomizer<JwtEncodingContext> jwtCustomizer)
jwtCustomizer - the OAuth2TokenCustomizer that customizes the headers and/or claims for the generated Jwt