Class JCacheOAuthDataProvider
- java.lang.Object
-
- org.apache.cxf.rs.security.oauth2.provider.AbstractOAuthDataProvider
-
- org.apache.cxf.rs.security.oauth2.provider.JCacheOAuthDataProvider
-
- All Implemented Interfaces:
ClientRegistrationProvider,OAuthDataProvider
- Direct Known Subclasses:
JCacheCodeDataProvider
public class JCacheOAuthDataProvider extends AbstractOAuthDataProvider
-
-
Field Summary
Fields Modifier and Type Field Description static StringACCESS_TOKEN_CACHE_KEYprotected javax.cache.CacheManagercacheManagerstatic StringCLIENT_CACHE_KEYstatic StringDEFAULT_CONFIG_URLstatic StringREFRESH_TOKEN_CACHE_KEY
-
Constructor Summary
Constructors Constructor Description JCacheOAuthDataProvider()JCacheOAuthDataProvider(boolean storeJwtTokenKeyOnly)JCacheOAuthDataProvider(String configFileURL, Bus bus)JCacheOAuthDataProvider(String configFileURL, Bus bus, boolean storeJwtTokenKeyOnly)JCacheOAuthDataProvider(String configFileURL, Bus bus, String clientCacheKey, String accessTokenCacheKey, String refreshTokenCacheKey)JCacheOAuthDataProvider(String configFileURL, Bus bus, String clientCacheKey, String accessTokenCacheKey, String refreshTokenCacheKey, boolean storeJwtTokenKeyOnly)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected static <K,V>
javax.cache.Cache<K,V>createCache(javax.cache.CacheManager cacheManager, String cacheKey, Class<K> keyType, Class<V> valueType)protected static javax.cache.CacheManagercreateCacheManager(String configFile, Bus bus)ClientdoGetClient(String clientId)protected voiddoRemoveClient(Client c)protected voiddoRevokeAccessToken(ServerAccessToken at)protected voiddoRevokeRefreshToken(RefreshToken rt)ServerAccessTokengetAccessToken(String accessTokenKey)Get access tokenList<ServerAccessToken>getAccessTokens(Client c, UserSubject sub)Return all access tokens associated with a given clientList<Client>getClients(UserSubject resourceOwner)Get a list of clients registered by a resource owner.protected ServerAccessTokengetJwtAccessToken(String key)protected List<ServerAccessToken>getJwtAccessTokens(Client client, UserSubject sub)protected RefreshTokengetRefreshToken(String refreshTokenKey)List<RefreshToken>getRefreshTokens(Client c, UserSubject sub)Return all refresh tokens associated with a given clientprotected static <V extends ServerAccessToken>
VgetToken(javax.cache.Cache<String,V> cache, String key)protected static <K,V extends ServerAccessToken>
List<V>getTokens(javax.cache.Cache<K,V> cache, Client client, UserSubject sub)protected static booleanisExpired(ServerAccessToken token)booleanisStoreJwtTokenKeyOnly()protected voidlinkRefreshTokenToAccessToken(RefreshToken rt, ServerAccessToken at)protected voidsaveAccessToken(ServerAccessToken serverToken)protected voidsaveRefreshToken(RefreshToken refreshToken)voidsetClient(Client client)Set a ClientvoidsetJwtTokenConsumer(JoseJwtConsumer jwtTokenConsumer)-
Methods inherited from class org.apache.cxf.rs.security.oauth2.provider.AbstractOAuthDataProvider
authenticateUnregisteredClient, checkRequestedScopes, convertScopeToPermissions, convertSingleScopeToPermission, convertToJWTAccessToken, createAccessToken, createClientCredentialsClient, createJwtAccessToken, createNewAccessToken, createNewRefreshToken, doCreateAccessToken, doCreateAccessToken, doCreateNewRefreshToken, doRefreshAccessToken, getClient, getCurrentClientSecret, getCurrentRequestedGrantType, getCurrentTokenRequestParams, getDefaultScopes, getInvisibleToClientScopes, getIssuer, getJwtAccessTokenClaimMap, getJwtAccessTokenProducer, getMessageContext, getPermissionMap, getPreauthorizedToken, getRequiredScopes, handleLinkedRefreshToken, init, isClientMatched, isPersistJwtEncoding, isRecycleRefreshTokens, isRefreshTokenSupported, isSupportPreauthorizedTokens, isTokenMatched, isUseJwtFormatForAccessTokens, linkAccessTokenToRefreshToken, processJwtAccessToken, refreshAccessToken, removeClient, removeClientTokens, revokeAccessToken, revokeAccessTokens, revokeRefreshToken, revokeToken, setAccessTokenLifetime, setAuthenticationStrategy, setClients, setDefaultScopes, setInvisibleToClientScopes, setIssuer, setJwtAccessTokenClaimMap, setJwtAccessTokenProducer, setMessageContext, setPermissionMap, setPersistJwtEncoding, setRecycleRefreshTokens, setRefreshTokenLifetime, setRequiredScopes, setSupportedScopes, setSupportPreauthorizedTokens, setUseJwtFormatForAccessTokens, unlinkRefreshAccessToken, updateExistingRefreshToken, updateRefreshToken
-
-
-
-
Field Detail
-
CLIENT_CACHE_KEY
public static final String CLIENT_CACHE_KEY
- See Also:
- Constant Field Values
-
ACCESS_TOKEN_CACHE_KEY
public static final String ACCESS_TOKEN_CACHE_KEY
- See Also:
- Constant Field Values
-
REFRESH_TOKEN_CACHE_KEY
public static final String REFRESH_TOKEN_CACHE_KEY
- See Also:
- Constant Field Values
-
DEFAULT_CONFIG_URL
public static final String DEFAULT_CONFIG_URL
- See Also:
- Constant Field Values
-
cacheManager
protected final javax.cache.CacheManager cacheManager
-
-
Constructor Detail
-
JCacheOAuthDataProvider
public JCacheOAuthDataProvider()
-
JCacheOAuthDataProvider
public JCacheOAuthDataProvider(boolean storeJwtTokenKeyOnly)
-
JCacheOAuthDataProvider
public JCacheOAuthDataProvider(String configFileURL, Bus bus, boolean storeJwtTokenKeyOnly)
-
JCacheOAuthDataProvider
public JCacheOAuthDataProvider(String configFileURL, Bus bus, String clientCacheKey, String accessTokenCacheKey, String refreshTokenCacheKey)
-
-
Method Detail
-
doGetClient
public Client doGetClient(String clientId) throws OAuthServiceException
- Specified by:
doGetClientin classAbstractOAuthDataProvider- Throws:
OAuthServiceException
-
setClient
public void setClient(Client client)
Description copied from interface:ClientRegistrationProviderSet a Client- Parameters:
client- the client
-
doRemoveClient
protected void doRemoveClient(Client c)
- Specified by:
doRemoveClientin classAbstractOAuthDataProvider
-
getClients
public List<Client> getClients(UserSubject resourceOwner)
Description copied from interface:ClientRegistrationProviderGet a list of clients registered by a resource owner.- Parameters:
resourceOwner- the resource owner, can be null- Returns:
- the list of clients
-
getAccessTokens
public List<ServerAccessToken> getAccessTokens(Client c, UserSubject sub)
Description copied from interface:OAuthDataProviderReturn all access tokens associated with a given client- Parameters:
c- the clientsub- the user subject, can be null- Returns:
- list of access tokens
-
getRefreshTokens
public List<RefreshToken> getRefreshTokens(Client c, UserSubject sub)
Description copied from interface:OAuthDataProviderReturn all refresh tokens associated with a given client- Parameters:
c- the clientsub- the user subject, can be null- Returns:
- list of refresh tokens
-
getAccessToken
public ServerAccessToken getAccessToken(String accessTokenKey) throws OAuthServiceException
Description copied from interface:OAuthDataProviderGet access token- Parameters:
accessTokenKey- the token key- Returns:
- AccessToken
- Throws:
OAuthServiceException
-
doRevokeAccessToken
protected void doRevokeAccessToken(ServerAccessToken at)
- Specified by:
doRevokeAccessTokenin classAbstractOAuthDataProvider
-
getRefreshToken
protected RefreshToken getRefreshToken(String refreshTokenKey)
- Specified by:
getRefreshTokenin classAbstractOAuthDataProvider
-
doRevokeRefreshToken
protected void doRevokeRefreshToken(RefreshToken rt)
- Specified by:
doRevokeRefreshTokenin classAbstractOAuthDataProvider
-
saveAccessToken
protected void saveAccessToken(ServerAccessToken serverToken)
- Specified by:
saveAccessTokenin classAbstractOAuthDataProvider
-
saveRefreshToken
protected void saveRefreshToken(RefreshToken refreshToken)
- Specified by:
saveRefreshTokenin classAbstractOAuthDataProvider
-
linkRefreshTokenToAccessToken
protected void linkRefreshTokenToAccessToken(RefreshToken rt, ServerAccessToken at)
- Overrides:
linkRefreshTokenToAccessTokenin classAbstractOAuthDataProvider
-
close
public void close()
- Overrides:
closein classAbstractOAuthDataProvider
-
getToken
protected static <V extends ServerAccessToken> V getToken(javax.cache.Cache<String,V> cache, String key)
-
getJwtAccessToken
protected ServerAccessToken getJwtAccessToken(String key)
-
getTokens
protected static <K,V extends ServerAccessToken> List<V> getTokens(javax.cache.Cache<K,V> cache, Client client, UserSubject sub)
-
getJwtAccessTokens
protected List<ServerAccessToken> getJwtAccessTokens(Client client, UserSubject sub)
-
isExpired
protected static boolean isExpired(ServerAccessToken token)
-
createCacheManager
protected static javax.cache.CacheManager createCacheManager(String configFile, Bus bus)
-
createCache
protected static <K,V> javax.cache.Cache<K,V> createCache(javax.cache.CacheManager cacheManager, String cacheKey, Class<K> keyType, Class<V> valueType)
-
isStoreJwtTokenKeyOnly
public boolean isStoreJwtTokenKeyOnly()
-
setJwtTokenConsumer
public void setJwtTokenConsumer(JoseJwtConsumer jwtTokenConsumer)
-
-