public class AuthorizationServiceImpl extends java.lang.Object implements AuthorizationService
Modifier and Type | Field and Description |
---|---|
private ShopRepository |
repository |
private TokenCache |
tokenCache |
private AccessTokenService |
tokenService |
Constructor and Description |
---|
AuthorizationServiceImpl(javax.inject.Provider<TokenCache> cacheProvider,
AccessTokenService tokenService,
ShopRepository repository) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAccessToken(GUID shopGuid)
Get the access token that is bound to the passed shop id.
|
java.lang.String |
getInitialAccessToken(GUID shopGuid,
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(GUID shopGuid,
java.lang.String authcode,
java.lang.String redirectUri) |
private void |
requestNewAccess(GUID shopGuid) |
private TokenCache tokenCache
private AccessTokenService tokenService
private ShopRepository repository
@Inject public AuthorizationServiceImpl(javax.inject.Provider<TokenCache> cacheProvider, AccessTokenService tokenService, ShopRepository repository)
public java.lang.String getInitialAccessToken(GUID shopGuid, java.lang.String authcode, java.lang.String redirectUri)
AuthorizationService
getInitialAccessToken
in interface AuthorizationService
shopGuid
- GUID of the shop to use the access token for.authcode
- Authcode to use for receiving the access token.redirectUri
- Redirect Uri used to receive the authcode.public java.lang.String getAccessToken(GUID shopGuid)
AuthorizationService
getAccessToken
in interface AuthorizationService
shopGuid
- GUID of the shop to get a access token for.private void requestInitialAccess(GUID shopGuid, java.lang.String authcode, java.lang.String redirectUri)
private void requestNewAccess(GUID shopGuid)
private void persistAccess(AccessTokenResponse response)
private void persistRefreshTokenToDatabase(AccessTokenResponse response)
private void persistAccessTokenToCache(AccessTokenResponse response)