public class JPAOAuthDataProvider extends AbstractOAuthDataProvider
Modifier and Type | Class and Description |
---|---|
static interface |
JPAOAuthDataProvider.EntityManagerOperation<T> |
Constructor and Description |
---|
JPAOAuthDataProvider() |
Modifier and Type | Method and Description |
---|---|
protected javax.persistence.EntityTransaction |
beginIfNeeded(javax.persistence.EntityManager em)
Begins the current transaction.
|
protected void |
closeIfNeeded(javax.persistence.EntityManager em)
Closes the current em.
|
protected void |
commitIfNeeded(javax.persistence.EntityManager em)
Commits the current transaction.
|
protected ServerAccessToken |
doCreateAccessToken(AccessTokenRegistration atReg) |
Client |
doGetClient(String clientId) |
protected void |
doRemoveClient(Client c) |
protected void |
doRevokeAccessToken(ServerAccessToken at) |
protected void |
doRevokeRefreshToken(RefreshToken rt) |
protected <T> T |
execute(JPAOAuthDataProvider.EntityManagerOperation<T> operation) |
protected <T> T |
executeInTransaction(JPAOAuthDataProvider.EntityManagerOperation<T> operation) |
protected void |
flushIfNeeded(javax.persistence.EntityManager em)
Flush the current transaction.
|
ServerAccessToken |
getAccessToken(String accessToken)
Get access token
|
List<ServerAccessToken> |
getAccessTokens(Client c,
UserSubject sub)
Return all access tokens associated with a given client
|
List<Client> |
getClients(UserSubject resourceOwner)
Get a list of clients registered by a resource owner.
|
protected javax.persistence.TypedQuery<Client> |
getClientsQuery(UserSubject resourceOwnerSubject,
javax.persistence.EntityManager entityManager) |
protected javax.persistence.EntityManager |
getEntityManager()
Returns the entityManaged used for the current operation.
|
protected RefreshToken |
getRefreshToken(String refreshTokenKey) |
List<RefreshToken> |
getRefreshTokens(Client c,
UserSubject sub)
Return all refresh tokens associated with a given client
|
protected javax.persistence.TypedQuery<RefreshToken> |
getRefreshTokensQuery(Client c,
UserSubject resourceOwnerSubject,
javax.persistence.EntityManager entityManager) |
protected javax.persistence.TypedQuery<BearerAccessToken> |
getTokensQuery(Client c,
UserSubject resourceOwnerSubject,
javax.persistence.EntityManager entityManager) |
protected void |
linkRefreshTokenToAccessToken(RefreshToken rt,
ServerAccessToken at) |
protected void |
persistEntity(Object entity) |
protected void |
removeEntity(Object entity) |
protected void |
saveAccessToken(ServerAccessToken serverToken) |
protected void |
saveRefreshToken(RefreshToken refreshToken) |
void |
setClient(Client client)
Set a Client
|
void |
setEntityManagerFactory(javax.persistence.EntityManagerFactory emf) |
authenticateUnregisteredClient, checkRequestedScopes, close, convertScopeToPermissions, convertSingleScopeToPermission, createAccessToken, createClientCredentialsClient, createJwtAccessToken, createNewAccessToken, createNewRefreshToken, 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
public void setEntityManagerFactory(javax.persistence.EntityManagerFactory emf)
public Client doGetClient(String clientId) throws OAuthServiceException
doGetClient
in class AbstractOAuthDataProvider
OAuthServiceException
protected <T> T execute(JPAOAuthDataProvider.EntityManagerOperation<T> operation)
protected <T> T executeInTransaction(JPAOAuthDataProvider.EntityManagerOperation<T> operation)
public void setClient(Client client)
ClientRegistrationProvider
client
- the clientprotected void doRemoveClient(Client c)
doRemoveClient
in class AbstractOAuthDataProvider
public List<Client> getClients(UserSubject resourceOwner)
ClientRegistrationProvider
resourceOwner
- the resource owner, can be nullpublic List<ServerAccessToken> getAccessTokens(Client c, UserSubject sub)
OAuthDataProvider
c
- the clientsub
- the user subject, can be nullpublic List<RefreshToken> getRefreshTokens(Client c, UserSubject sub)
OAuthDataProvider
c
- the clientsub
- the user subject, can be nullpublic ServerAccessToken getAccessToken(String accessToken) throws OAuthServiceException
OAuthDataProvider
accessToken
- the token keyOAuthServiceException
protected void doRevokeAccessToken(ServerAccessToken at)
doRevokeAccessToken
in class AbstractOAuthDataProvider
protected void linkRefreshTokenToAccessToken(RefreshToken rt, ServerAccessToken at)
linkRefreshTokenToAccessToken
in class AbstractOAuthDataProvider
protected RefreshToken getRefreshToken(String refreshTokenKey)
getRefreshToken
in class AbstractOAuthDataProvider
protected void doRevokeRefreshToken(RefreshToken rt)
doRevokeRefreshToken
in class AbstractOAuthDataProvider
protected ServerAccessToken doCreateAccessToken(AccessTokenRegistration atReg)
doCreateAccessToken
in class AbstractOAuthDataProvider
protected void saveAccessToken(ServerAccessToken serverToken)
saveAccessToken
in class AbstractOAuthDataProvider
protected void saveRefreshToken(RefreshToken refreshToken)
saveRefreshToken
in class AbstractOAuthDataProvider
protected void persistEntity(Object entity)
protected void removeEntity(Object entity)
protected javax.persistence.TypedQuery<Client> getClientsQuery(UserSubject resourceOwnerSubject, javax.persistence.EntityManager entityManager)
protected javax.persistence.TypedQuery<BearerAccessToken> getTokensQuery(Client c, UserSubject resourceOwnerSubject, javax.persistence.EntityManager entityManager)
protected javax.persistence.TypedQuery<RefreshToken> getRefreshTokensQuery(Client c, UserSubject resourceOwnerSubject, javax.persistence.EntityManager entityManager)
protected javax.persistence.EntityManager getEntityManager()
protected javax.persistence.EntityTransaction beginIfNeeded(javax.persistence.EntityManager em)
protected void flushIfNeeded(javax.persistence.EntityManager em)
protected void commitIfNeeded(javax.persistence.EntityManager em)
protected void closeIfNeeded(javax.persistence.EntityManager em)
Apache CXF