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 Description static org.jboss.logging.Logger
logger
-
Constructor Summary
Constructors Constructor 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 Description boolean
approve(RealmModel realm, String userCode, String userSessionId, Map<String,String> additionalParams)
Approve the given user codevoid
close()
boolean
deny(RealmModel realm, String userCode)
Deny the given user codeOAuth2DeviceCodeModel
getByDeviceCode(RealmModel realm, String deviceCode)
Get the model object by the given device codeOAuth2DeviceCodeModel
getByUserCode(RealmModel realm, String userCode)
Get the model object by the given user codeboolean
isPollingAllowed(OAuth2DeviceCodeModel deviceCode)
Check the device code is allowed to pollvoid
put(OAuth2DeviceCodeModel deviceCode, OAuth2DeviceUserCodeModel userCode, int lifespanSeconds)
Stores the given device code and user codeboolean
removeDeviceCode(RealmModel realm, String deviceCode)
Remove the given device codeboolean
removeUserCode(RealmModel realm, String userCode)
Remove the given user code
-
-
-
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 interfaceOAuth2DeviceTokenStoreProvider
- Returns:
-
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 interfaceOAuth2DeviceTokenStoreProvider
-
isPollingAllowed
public boolean isPollingAllowed(OAuth2DeviceCodeModel deviceCode)
Description copied from interface:OAuth2DeviceTokenStoreProvider
Check the device code is allowed to poll- Specified by:
isPollingAllowed
in interfaceOAuth2DeviceTokenStoreProvider
- 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 interfaceOAuth2DeviceTokenStoreProvider
- Returns:
-
approve
public boolean approve(RealmModel realm, String userCode, String userSessionId, Map<String,String> additionalParams)
Description copied from interface:OAuth2DeviceTokenStoreProvider
Approve the given user code- Specified by:
approve
in interfaceOAuth2DeviceTokenStoreProvider
- 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 interfaceOAuth2DeviceTokenStoreProvider
- 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 interfaceOAuth2DeviceTokenStoreProvider
- 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 interfaceOAuth2DeviceTokenStoreProvider
- Returns:
- Return true if removing successful. If the code is already expired and cleared, it returns false.
-
-