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 SummaryFields Modifier and Type Field Description protected static org.jboss.logging.Loggerloggerstatic StringSHORT_VERIFICATION_URI- 
Fields inherited from class org.keycloak.protocol.AuthorizationEndpointBaseAPP_INITIATED_FLOW, authManager, clientConnection, event, headers, httpRequest, realm, session
 
- 
 - 
Constructor SummaryConstructors Constructor Description DeviceEndpoint(KeycloakSession session, EventBuilder event)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected AuthenticationSessionModelcreateAuthenticationSession(ClientModel client, String scope)static OAuth2DeviceCodeModelgetDeviceByUserCode(KeycloakSession session, RealmModel realm, String userCode)ObjectgetResource()Returns a JAX-RS resource instance.javax.ws.rs.core.ResponsehandleDeviceRequest()Handles device authorization requests.javax.ws.rs.core.Responsepreflight()javax.ws.rs.core.Responsestatus(String error)Showing the result of verification process for OAuth 2.0 Device Authorization Grant.javax.ws.rs.core.ResponseverifyUserCode()Verifies the code provided by the end-user and start the authentication.javax.ws.rs.core.ResponseverifyUserCode(String userCode)This endpoint is used by end-users to start the flow to authorize a device.- 
Methods inherited from class org.keycloak.protocol.AuthorizationEndpointBasecheckRealm, checkSsl, createProcessor, getAuthenticationFlow, handleBrowserAuthenticationRequest
 
- 
 
- 
- 
- 
Field Detail- 
loggerprotected static final org.jboss.logging.Logger logger 
 - 
SHORT_VERIFICATION_URIpublic static final String SHORT_VERIFICATION_URI - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
DeviceEndpointpublic DeviceEndpoint(KeycloakSession session, EventBuilder event) 
 
- 
 - 
Method Detail- 
handleDeviceRequest@Path("") @POST @Consumes("application/x-www-form-urlencoded") @Produces("application/json") public javax.ws.rs.core.Response handleDeviceRequest()Handles device authorization requests.- Returns:
- the device authorization response.
 
 - 
preflight@OPTIONS public javax.ws.rs.core.Response preflight() 
 - 
verifyUserCode@GET public javax.ws.rs.core.Response verifyUserCode(@QueryParam("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("/") @POST @Consumes("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("status") @GET public javax.ws.rs.core.Response status(@QueryParam("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:
 
 - 
getDeviceByUserCodepublic static OAuth2DeviceCodeModel getDeviceByUserCode(KeycloakSession session, RealmModel realm, String userCode) 
 - 
getResourcepublic Object getResource() Description copied from interface:RealmResourceProviderReturns a JAX-RS resource instance. - Specified by:
- getResourcein interface- RealmResourceProvider
- Returns:
- a JAX-RS sub-resource instance
 
 - 
createAuthenticationSessionprotected AuthenticationSessionModel createAuthenticationSession(ClientModel client, String scope) - Overrides:
- createAuthenticationSessionin class- AuthorizationEndpointBase
 
 
- 
 
-