org.keycloak.models.sessions.infinispan

## Class InfinispanSingleUseTokenStoreProvider

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

- All Implemented Interfaces:
    SingleUseTokenStoreProvider, Provider

      public class InfinispanSingleUseTokenStoreProvider
      extends Object
      implements SingleUseTokenStoreProvider

  TODO: Check if Boolean can be used as single-use cache argument instead of ActionTokenValueEntity. With respect to other single-use cache usecases like "Revoke Refresh Token" . Also with respect to the usage of streams iterating over "actionTokens" cache (check there are no ClassCastExceptions when casting values directly to ActionTokenValueEntity)
  Author:
    Marek Posolda

- - ### Field Summary

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

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InfinispanSingleUseTokenStoreProvider(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
    --- | ---
    `void` | `close()`
    `boolean` | `putIfAbsent(String tokenId, int lifespanInSeconds)` Will try to put the token into the cache.

    - ### 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

    - #### InfinispanSingleUseTokenStoreProvider

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

  - ### Method Detail

    - #### putIfAbsent

          public boolean putIfAbsent(String tokenId,
                                     int lifespanInSeconds)

      Description copied from interface: `SingleUseTokenStoreProvider`
      Will try to put the token into the cache. It will success just if token is not already there.
      Specified by:
        `putIfAbsent` in interface `SingleUseTokenStoreProvider`
        `lifespanInSeconds` - Minimum lifespan for which successfully added token will be kept in the cache.
      Returns:
        true if token was successfully put into the cache. This means that same token wasn't in the cache before

    - #### close

          public void close()

      Specified by:
        `close` in interface `Provider`

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