org.keycloak.protocol.oidc.grants.device.endpoints

## Class DeviceEndpoint

- java.lang.Object
- - org.keycloak.protocol.AuthorizationEndpointBase
  - - org.keycloak.protocol.oidc.grants.device.endpoints.DeviceEndpoint

- All Implemented Interfaces:
    Provider, RealmResourceProvider

      public class DeviceEndpoint
      extends AuthorizationEndpointBase
      implements RealmResourceProvider

  Author:
    Hiroyuki Wada

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static org.jboss.logging.Logger` | `logger`

    - ### Fields inherited from class org.keycloak.protocol.AuthorizationEndpointBase

      `APP_INITIATED_FLOW, authManager, clientConnection, event, headers, httpRequest, realm, session`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DeviceEndpoint(RealmModel realm, EventBuilder event)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `protected AuthenticationSessionModel` | `createAuthenticationSession(ClientModel client)`
    `Object` | `getResource()` Returns a JAX-RS resource instance.
    `javax.ws.rs.core.Response` | `handleDeviceRequest()` Handles device authorization requests.
    `javax.ws.rs.core.Response` | `status(String error)` Showing the result of verification process for OAuth 2.0 Device Authorization Grant.
    `javax.ws.rs.core.Response` | `verifyUserCode()` Verifies the code provided by the end-user and start the authentication.
    `javax.ws.rs.core.Response` | `verifyUserCode(String userCode)` This endpoint is used by end-users to start the flow to authorize a device.

    - ### Methods inherited from class org.keycloak.protocol.AuthorizationEndpointBase

      `checkRealm, checkSsl, createAuthenticationSession, createProcessor, getAuthenticationFlow, handleBrowserAuthenticationRequest`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### logger

          protected static final org.jboss.logging.Logger logger

  - ### Constructor Detail

    - #### DeviceEndpoint

          public DeviceEndpoint(RealmModel realm,
                                EventBuilder event)

  - ### Method Detail

    - #### handleDeviceRequest

          @Path(value="")
           @POST
           @Consumes(value="application/x-www-form-urlencoded")
           @Produces(value="application/json")
          public javax.ws.rs.core.Response handleDeviceRequest()

      Handles device authorization requests.
      Returns:
        the device authorization response.

    - #### verifyUserCode

          @GET
          public javax.ws.rs.core.Response verifyUserCode(@QueryParam(value="user_code")
                                                               String userCode)

      This endpoint is used by end-users to start the flow to authorize a device.
      Parameters:
        `userCode` - the user code to authorize
      Returns:

    - #### verifyUserCode

          @Path(value="/")
           @POST
           @Consumes(value="application/x-www-form-urlencoded")
          public javax.ws.rs.core.Response verifyUserCode()

      Verifies the code provided by the end-user and start the authentication.
      Returns:

    - #### status

          @Path(value="status")
           @GET
          public javax.ws.rs.core.Response status(@QueryParam(value="error")
                                                                              String error)

      Showing the result of verification process for OAuth 2.0 Device Authorization Grant. This outputs login success or failure messages.
      Parameters:
        `error` -
      Returns:

    - #### getResource

          public Object getResource()

      Description copied from interface: `RealmResourceProvider`

      Returns a JAX-RS resource instance.

      Specified by:
        `getResource` in interface `RealmResourceProvider`
      Returns:
        a JAX-RS sub-resource instance

    - #### close

          public void close()

      Specified by:
        `close` in interface `Provider`

    - #### createAuthenticationSession

          protected AuthenticationSessionModel createAuthenticationSession(ClientModel client)

Copyright © 2021 JBoss by Red Hat. All rights reserved.