Class DeviceCodeVerificationResource

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doCatch​(Throwable throwable)
      Handles any exception that is thrown when processing a OAuth2 authorization request.
      org.restlet.representation.Representation userCodeForm()
      Handles GET requests to the OAuth2 device/user endpoint, returning a form to allow the user to submit their user code.
      org.restlet.representation.Representation verify​(org.restlet.representation.Representation body)
      Handles POST requests to the OAuth2 device/user endpoint.
      • Methods inherited from class org.restlet.resource.ServerResource

        abort, commit, delete, delete, describeVariants, doConditionalHandle, doError, doHandle, doHandle, doHandle, doNegotiatedHandle, get, get, getAnnotation, getAnnotation, getAnnotations, getAttribute, getDescription, getInfo, getInfo, getName, getOnSent, getPreferredVariant, getRole, getVariants, getVariants, handle, hasAnnotations, head, head, isAnnotated, isAutoCommitting, isCommitted, isConditional, isExisting, isInRole, isNegotiated, options, options, patch, patch, post, post, put, put, redirectPermanent, redirectPermanent, redirectSeeOther, redirectSeeOther, redirectTemporary, redirectTemporary, setAllowedMethods, setAnnotated, setAttribute, setAutoCommitting, setChallengeRequests, setCommitted, setConditional, setCookieSettings, setDescription, setDimensions, setExisting, setLocationRef, setLocationRef, setName, setNegotiated, setOnSent, setProxyChallengeRequests, setServerInfo, setStatus, setStatus, setStatus, setStatus, updateAllowedMethods, updateDimensions
      • Methods inherited from class org.restlet.resource.Resource

        doError, doInit, doRelease, getAllowedMethods, getApplication, getChallengeRequests, getChallengeResponse, getClientInfo, getConditions, getConnegService, getConverterService, getCookies, getCookieSettings, getDimensions, getHostRef, getLocationRef, getLogger, getMatrix, getMatrixValue, getMaxForwards, getMetadataService, getMethod, getOriginalRef, getProtocol, getProxyChallengeRequests, getProxyChallengeResponse, getQuery, getQueryValue, getRanges, getReference, getReferrerRef, getRequest, getRequestAttributes, getRequestCacheDirectives, getRequestEntity, getResponse, getResponseAttributes, getResponseCacheDirectives, getResponseEntity, getRootRef, getServerInfo, getStatus, getStatusService, init, isConfidential, isLoggable, release, setApplication, setQueryValue, setRequest, setResponse, toBoolean, toByte, toDouble, toFloat, toInteger, toLong, toObject, toRepresentation, toRepresentation, toRepresentation, toShort, toString
    • Method Detail

      • userCodeForm

        @Get
        public org.restlet.representation.Representation userCodeForm()
        Handles GET requests to the OAuth2 device/user endpoint, returning a form to allow the user to submit their user code.

        A GET never acts on a user code, whatever the request carries. It is the one request a foreign origin can make the resource owner's browser send with its session cookie attached - SameSite=Lax blocks a cross-site POST but not a top-level navigation - so it may only render this form.

        A user code in the query string is not merely ignored, it is redirected away. The form has no action of its own, so it posts back to the address it was served from, and a code left in that address would be submitted alongside the one the user typed - which getSubmittedUserCode(org.forgerock.oauth2.core.OAuth2Request) then refuses, leaving whoever followed such a link with a bare 400 and no form to retry on. Serving the form only from an address that carries no code makes the query string that reaches the POST the user's own.

        Returns:
        The form to allow the user to submit their user code, or null if the request is being redirected to the same address without its user code.
      • doCatch

        protected void doCatch​(Throwable throwable)
        Handles any exception that is thrown when processing a OAuth2 authorization request.
        Overrides:
        doCatch in class org.restlet.resource.ServerResource
        Parameters:
        throwable - The throwable.