Class JwtGenerator
java.lang.Object
org.springframework.security.oauth2.server.authorization.token.JwtGenerator
- All Implemented Interfaces:
OAuth2TokenGenerator<org.springframework.security.oauth2.jwt.Jwt>
public final class JwtGenerator
extends Object
implements OAuth2TokenGenerator<org.springframework.security.oauth2.jwt.Jwt>
- Since:
- 0.2.3
- See Also:
-
OAuth2TokenGenerator
Jwt
JwtEncoder
OAuth2TokenCustomizer
JwtEncodingContext
OAuth2AccessToken
OidcIdToken
-
Constructor Summary
ConstructorDescriptionJwtGenerator
(org.springframework.security.oauth2.jwt.JwtEncoder jwtEncoder) Constructs aJwtGenerator
using the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.oauth2.jwt.Jwt
generate
(OAuth2TokenContext context) Generate an OAuth 2.0 Token using the attributes contained in theOAuth2TokenContext
, or returnnull
if theOAuth2TokenContext.getTokenType()
is not supported.void
setJwtCustomizer
(OAuth2TokenCustomizer<JwtEncodingContext> jwtCustomizer)
-
Constructor Details
-
JwtGenerator
public JwtGenerator(org.springframework.security.oauth2.jwt.JwtEncoder jwtEncoder) Constructs aJwtGenerator
using the provided parameters.- Parameters:
jwtEncoder
- the jwt encoder
-
-
Method Details
-
generate
Description copied from interface:OAuth2TokenGenerator
Generate an OAuth 2.0 Token using the attributes contained in theOAuth2TokenContext
, or returnnull
if theOAuth2TokenContext.getTokenType()
is not supported.If the returned
OAuth2Token
has a set of claims, it should implementClaimAccessor
in order for it to be stored with theOAuth2Authorization
.- Specified by:
generate
in interfaceOAuth2TokenGenerator<org.springframework.security.oauth2.jwt.Jwt>
- Parameters:
context
- the context containing the OAuth 2.0 Token attributes- Returns:
- an
OAuth2Token
ornull
if theOAuth2TokenContext.getTokenType()
is not supported
-
setJwtCustomizer
- Parameters:
jwtCustomizer
- theOAuth2TokenCustomizer
that customizes the headers and/or claims for the generatedJwt
-