public class AuthorizationServiceImpl extends java.lang.Object implements AuthorizationService
Modifier and Type | Field and Description |
---|---|
private RefreshTokenService |
refreshTokenService |
private TokenCache |
tokenCache |
private AccessTokenService |
tokenService |
Constructor and Description |
---|
AuthorizationServiceImpl(javax.inject.Provider<TokenCache> cacheProvider,
AccessTokenService tokenService,
RefreshTokenService refreshTokenService) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAccessToken(java.lang.String shopId)
Get the access token that is bound to the passed
shop id.
|
java.lang.String |
getInitialAccessToken(java.lang.String shopId,
java.lang.String authcode,
java.lang.String redirectUri)
Gets a access token for using the passed authcode
and binds it to the passed shop id.
|
private void |
persistAccess(AccessTokenResponse response) |
private void |
persistAccessTokenToCache(AccessTokenResponse response) |
private void |
persistRefreshTokenToDatabase(AccessTokenResponse response) |
private void |
requestInitialAccess(java.lang.String shopId,
java.lang.String authcode,
java.lang.String redirectUri) |
private void |
requestNewAccess(java.lang.String shopId) |
private TokenCache tokenCache
private AccessTokenService tokenService
private RefreshTokenService refreshTokenService
@Inject public AuthorizationServiceImpl(javax.inject.Provider<TokenCache> cacheProvider, AccessTokenService tokenService, RefreshTokenService refreshTokenService)
public java.lang.String getInitialAccessToken(java.lang.String shopId, java.lang.String authcode, java.lang.String redirectUri) throws AuthorizationException, javax.persistence.PersistenceException
AuthorizationService
getInitialAccessToken
in interface AuthorizationService
AuthorizationException
- in case no access token
could be obtained.javax.persistence.PersistenceException
- in case there was an error
while persisting the the data.public java.lang.String getAccessToken(java.lang.String shopId) throws AuthorizationException, javax.persistence.PersistenceException
AuthorizationService
getAccessToken
in interface AuthorizationService
AuthorizationException
- in case no access token
could be obtained.javax.persistence.PersistenceException
- in case there was an error
while persisting the the data.private void requestInitialAccess(java.lang.String shopId, java.lang.String authcode, java.lang.String redirectUri) throws AuthorizationException, javax.persistence.PersistenceException
AuthorizationException
javax.persistence.PersistenceException
private void requestNewAccess(java.lang.String shopId) throws AuthorizationException, javax.persistence.PersistenceException
AuthorizationException
javax.persistence.PersistenceException
private void persistAccess(AccessTokenResponse response) throws javax.persistence.PersistenceException
javax.persistence.PersistenceException
private void persistRefreshTokenToDatabase(AccessTokenResponse response)
private void persistAccessTokenToCache(AccessTokenResponse response)