java.lang.Object
com.irurueta.authserver.authorization.api.web.consent.ConsentController
All Implemented Interfaces:
ConsentPageApi

@Controller public class ConsentController extends Object implements ConsentPageApi
Serves the consent page the authorization endpoint redirects to when a client needs the user's approval, as the contract apis/auth-server/web-pages/auth-server-pages-v1.yaml describes it through the generated ConsentPageApi. It lives in this adapter because it works with the framework's RegisteredClientRepository and OAuth2AuthorizationConsentService.
  • Field Details

    • VIEW_NAME

      static final String VIEW_NAME
      Name of the consent template.
      See Also:
    • DECISION_PATH_ATTRIBUTE

      static final String DECISION_PATH_ATTRIBUTE
      Name of the model attribute that holds the path the decision is posted to.
      See Also:
    • USER_CODE_ATTRIBUTE

      static final String USER_CODE_ATTRIBUTE
      Name of the model attribute that holds the user code of a device.
      See Also:
    • AUTHORIZE_PATH

      static final String AUTHORIZE_PATH
      Path of the authorization endpoint, where the decision of an authorization request is posted.
      See Also:
    • registeredClientRepository

      private final org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository registeredClientRepository
      Finds the client that asks for access.
    • authorizationConsentService

      private final org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationConsentService authorizationConsentService
      Finds the scopes the user granted earlier.
    • mapper

      private final ConsentPageModelMapper mapper
      Builds the view model.
    • pageRenderer

      private final PageRenderer pageRenderer
      Renders the page.
    • request

      private final jakarta.servlet.http.HttpServletRequest request
      The current request, injected as a thread-bound proxy, which carries the signed-in user and the locale.
  • Constructor Details

    • ConsentController

      public ConsentController()
  • Method Details

    • consentPage

      public org.springframework.http.ResponseEntity<String> consentPage(String clientId, String scope, String state, String userCode)
      Renders the consent page.
      Specified by:
      consentPage in interface ConsentPageApi
      Parameters:
      clientId - identifier of the client that asks for access.
      scope - requested scopes, space delimited.
      state - state of the authorization request.
      userCode - user code of the device the consent is asked for, null for an authorization request; the decision of a device is posted to the device verification endpoint, with the code.
      Returns:
      the consent page.
      Throws:
      org.springframework.web.server.ResponseStatusException - with status 400 when the client is unknown.