Interface CustomTokenResponseComposer

All Superinterfaces:
Lifecycle

@ThreadSafe public interface CustomTokenResponseComposer extends Lifecycle
Service Provider Interface (SPI) for composing custom token responses. Implementations must be thread-safe.

This SPI can be used to include additional parameters in the token response, such as an authorization_details parameter required in OAuth 2.0 Rich Authorization Requests.

The SPI allows a successful access token response to be replaced with a token error response.

  • Method Summary

    Modifier and Type
    Method
    Description
    com.nimbusds.oauth2.sdk.TokenResponse
    compose(com.nimbusds.oauth2.sdk.TokenResponse originalResponse, TokenResponseContext context)
    Composes a custom token response.

    Methods inherited from interface com.nimbusds.openid.connect.provider.spi.Lifecycle

    init, isEnabled, shutdown
  • Method Details

    • compose

      com.nimbusds.oauth2.sdk.TokenResponse compose(com.nimbusds.oauth2.sdk.TokenResponse originalResponse, TokenResponseContext context)
      Composes a custom token response.
      Parameters:
      originalResponse - The original success or error response. For an OpenID token response an instance of OIDCTokenResponse. Not null.
      context - The token response context. Not null.
      Returns:
      The token response to return to the client. If no customisation is required the original response.