java.lang.Object
org.springframework.security.oauth2.server.authorization.token.JwtEncodingContext
All Implemented Interfaces:
Context, OAuth2TokenContext

public final class JwtEncodingContext extends Object implements OAuth2TokenContext
An OAuth2TokenContext implementation used when encoding a Jwt.
Since:
0.1.0
See Also:
  • OAuth2TokenContext
  • JwsHeader.Builder
  • JwtClaimsSet.Builder
  • JwtEncoder.encode(JwtEncoderParameters)
  • Method Details

    • get

      @Nullable public <V> V get(Object key)
      Description copied from interface: Context
      Returns the value of the attribute associated to the key.
      Specified by:
      get in interface Context
      Type Parameters:
      V - the type of the value for the attribute
      Parameters:
      key - the key for the attribute
      Returns:
      the value of the attribute associated to the key, or null if not available
    • hasKey

      public boolean hasKey(Object key)
      Description copied from interface: Context
      Returns true if an attribute associated to the key exists, false otherwise.
      Specified by:
      hasKey in interface Context
      Parameters:
      key - the key for the attribute
      Returns:
      true if an attribute associated to the key exists, false otherwise
    • getJwsHeader

      public org.springframework.security.oauth2.jwt.JwsHeader.Builder getJwsHeader()
      Returns the JWS headers allowing the ability to add, replace, or remove.
      Returns:
      the JwsHeader.Builder
    • getClaims

      public org.springframework.security.oauth2.jwt.JwtClaimsSet.Builder getClaims()
      Returns the claims allowing the ability to add, replace, or remove.
      Returns:
      the JwtClaimsSet.Builder
    • with

      public static JwtEncodingContext.Builder with(org.springframework.security.oauth2.jwt.JwsHeader.Builder jwsHeaderBuilder, org.springframework.security.oauth2.jwt.JwtClaimsSet.Builder claimsBuilder)
      Constructs a new JwtEncodingContext.Builder with the provided JWS headers and claims.
      Parameters:
      jwsHeaderBuilder - the JWS headers to initialize the builder
      claimsBuilder - the claims to initialize the builder
      Returns:
      the JwtEncodingContext.Builder