Class DeviceVerificationController

java.lang.Object
com.irurueta.authserver.authorization.api.web.implicit.DeviceVerificationController
All Implemented Interfaces:
DeviceVerificationPageApi

@Controller public class DeviceVerificationController extends Object implements DeviceVerificationPageApi
Serves the device verification page, as the contract apis/auth-server/web-pages/auth-server-pages-v1.yaml describes it through the generated DeviceVerificationPageApi: the form where the user types the code the device shows. The form posts to the framework's own endpoint (POST /oauth2/device_verification); a request that already carries a code never reaches this controller, because that endpoint answers it. The page is also where the endpoint sends the browser back to, with ?error when the attempt failed and ?success when the device was approved.
  • Field Details

    • VERIFICATION_PATH

      public static final String VERIFICATION_PATH
      Path of the page, and of the verification endpoint, taken from the contract.
      See Also:
    • SUCCESS_PARAMETER

      public static final String SUCCESS_PARAMETER
      Name of the parameter that tells the page that the device was just approved.
      See Also:
    • VIEW_NAME

      static final String VIEW_NAME
      Name of the template of the page.
      See Also:
    • USER_CODE_ATTRIBUTE

      static final String USER_CODE_ATTRIBUTE
      Name of the model attribute that holds the code to prefill.
      See Also:
    • ERROR_ATTRIBUTE

      static final String ERROR_ATTRIBUTE
      Name of the model attribute that tells whether the previous attempt failed.
      See Also:
    • SUCCESS_ATTRIBUTE

      static final String SUCCESS_ATTRIBUTE
      Name of the model attribute that tells whether the device was just approved.
      See Also:
    • PLAUSIBLE_CODE

      private static final Pattern PLAUSIBLE_CODE
      Shape of a user code worth prefilling: letters, digits and dashes.
    • pageRenderer

      private final PageRenderer pageRenderer
      Renders the page.
  • Constructor Details

    • DeviceVerificationController

      public DeviceVerificationController()
  • Method Details

    • deviceVerificationPage

      public org.springframework.http.ResponseEntity<String> deviceVerificationPage(String userCode, String error, String success)
      Renders the device verification page.
      Specified by:
      deviceVerificationPage in interface DeviceVerificationPageApi
      Parameters:
      userCode - a code to prefill, ignored unless it looks like a user code.
      error - present when the previous attempt failed.
      success - present when the device was just approved.
      Returns:
      the page.