org.keycloak.models.sessions.infinispan

## Class InfinispanOAuth2DeviceTokenStoreProvider

- java.lang.Object
- - org.keycloak.models.sessions.infinispan.InfinispanOAuth2DeviceTokenStoreProvider

- All Implemented Interfaces:
    OAuth2DeviceTokenStoreProvider, Provider

      public class InfinispanOAuth2DeviceTokenStoreProvider
      extends Object
      implements OAuth2DeviceTokenStoreProvider

  Author:
    Hiroyuki Wada

- - ### Field Summary

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

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InfinispanOAuth2DeviceTokenStoreProvider(KeycloakSession session, Supplier<org.infinispan.commons.api.BasicCache<String,ActionTokenValueEntity>> actionKeyCache)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `approve(RealmModel realm, String userCode, String userSessionId)` Approve the given user code
    `void` | `close()`
    `boolean` | `deny(RealmModel realm, String userCode)` Deny the given user code
    `OAuth2DeviceCodeModel` | `getByDeviceCode(RealmModel realm, String deviceCode)` Get the model object by the given device code
    `OAuth2DeviceCodeModel` | `getByUserCode(RealmModel realm, String userCode)` Get the model object by the given user code
    `boolean` | `isPollingAllowed(OAuth2DeviceCodeModel deviceCode)` Check the device code is allowed to poll
    `void` | `put(OAuth2DeviceCodeModel deviceCode, OAuth2DeviceUserCodeModel userCode, int lifespanSeconds)` Stores the given device code and user code
    `boolean` | `removeDeviceCode(RealmModel realm, String deviceCode)` Remove the given device code
    `boolean` | `removeUserCode(RealmModel realm, String userCode)` Remove the given user code

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

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

- - ### Field Detail

    - #### logger

          public static final org.jboss.logging.Logger logger

  - ### Constructor Detail

    - #### InfinispanOAuth2DeviceTokenStoreProvider

          public InfinispanOAuth2DeviceTokenStoreProvider(KeycloakSession session,
                                                          Supplier<org.infinispan.commons.api.BasicCache<String,ActionTokenValueEntity>> actionKeyCache)

  - ### Method Detail

    - #### getByDeviceCode

          public OAuth2DeviceCodeModel getByDeviceCode(RealmModel realm,
                                                       String deviceCode)

      Description copied from interface: `OAuth2DeviceTokenStoreProvider`
      Get the model object by the given device code
      Specified by:
        `getByDeviceCode` in interface `OAuth2DeviceTokenStoreProvider`
      Returns:

    - #### close

          public void close()

      Specified by:
        `close` in interface `Provider`

    - #### put

          public void put(OAuth2DeviceCodeModel deviceCode,
                          OAuth2DeviceUserCodeModel userCode,
                          int lifespanSeconds)

      Description copied from interface: `OAuth2DeviceTokenStoreProvider`
      Stores the given device code and user code
      Specified by:
        `put` in interface `OAuth2DeviceTokenStoreProvider`

    - #### isPollingAllowed

          public boolean isPollingAllowed(OAuth2DeviceCodeModel deviceCode)

      Description copied from interface: `OAuth2DeviceTokenStoreProvider`
      Check the device code is allowed to poll
      Specified by:
        `isPollingAllowed` in interface `OAuth2DeviceTokenStoreProvider`
      Returns:
        Return true if the given device code is allowed to poll

    - #### getByUserCode

          public OAuth2DeviceCodeModel getByUserCode(RealmModel realm,
                                                     String userCode)

      Description copied from interface: `OAuth2DeviceTokenStoreProvider`
      Get the model object by the given user code
      Specified by:
        `getByUserCode` in interface `OAuth2DeviceTokenStoreProvider`
      Returns:

    - #### approve

          public boolean approve(RealmModel realm,
                                 String userCode,
                                 String userSessionId)

      Description copied from interface: `OAuth2DeviceTokenStoreProvider`
      Approve the given user code
      Specified by:
        `approve` in interface `OAuth2DeviceTokenStoreProvider`
      Returns:
        Return true if approving successful. If the code is already expired and cleared, it returns false.

    - #### deny

          public boolean deny(RealmModel realm,
                              String userCode)

      Description copied from interface: `OAuth2DeviceTokenStoreProvider`
      Deny the given user code
      Specified by:
        `deny` in interface `OAuth2DeviceTokenStoreProvider`
      Returns:
        Return true if denying successful. If the code is already expired and cleared, it returns false.

    - #### removeDeviceCode

          public boolean removeDeviceCode(RealmModel realm,
                                          String deviceCode)

      Description copied from interface: `OAuth2DeviceTokenStoreProvider`
      Remove the given device code
      Specified by:
        `removeDeviceCode` in interface `OAuth2DeviceTokenStoreProvider`
      Returns:
        Return true if removing successful. If the code is already expired and cleared, it returns false.

    - #### removeUserCode

          public boolean removeUserCode(RealmModel realm,
                                        String userCode)

      Description copied from interface: `OAuth2DeviceTokenStoreProvider`
      Remove the given user code
      Specified by:
        `removeUserCode` in interface `OAuth2DeviceTokenStoreProvider`
      Returns:
        Return true if removing successful. If the code is already expired and cleared, it returns false.

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