public class OAuth2AppInstallationServiceImpl extends AbstractAppInstallationService implements OAuth2AppInstallationService
Modifier and Type | Field and Description |
---|---|
private com.google.common.eventbus.EventBus |
eventBus |
private OAuth2Service |
oauth2Service |
appInstallationRepositoryProvider, LOGGER
Constructor and Description |
---|
OAuth2AppInstallationServiceImpl(javax.inject.Provider<AppInstallationOAuth2Repository> appInstallationRepositoryProvider,
OAuth2Service oauth2Service) |
Modifier and Type | Method and Description |
---|---|
private AppInstallationOAuth2Entity |
doPrepareExistingInstallation(AppInstallationOAuth2Entity appInstallation,
java.util.Set<java.lang.String> scopes,
App app) |
private AppInstallationOAuth2Entity |
doPrepareInitialInstallation(GUID shopGUID,
GUID clientId,
java.util.Set<java.lang.String> scopes) |
protected AppInstallationEntity |
doUninstall(AppInstallationEntity appInstallation) |
AppInstallationOAuth2Entity |
finalizeInstallation(GUID shopGUID,
App app,
OAuth2Credentials credentials) |
java.util.Optional<AppInstallationOAuth2Entity> |
getAppInstallationByToken(java.lang.String token) |
AppInstallationOAuth2Entity |
prepareInstallation(GUID shopGuid,
App app,
java.util.Set<java.lang.String> scopes)
For OAuth2 apps the installation procedure follows the OAuth2 flow:
|
void |
setEventBus(com.google.common.eventbus.EventBus eventBus) |
void |
terminateAllInstallationsOf(OfficialApp officialApp) |
findPreviousAppInstallation, getAppInstallation, getAppInstallation, getAppInstallationActions, getAppsByInstallationState, save, uninstall, validateAppInstallationState
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAppInstallation, getAppInstallation, getAppInstallationActions, getAppsByInstallationState, uninstall
private final OAuth2Service oauth2Service
private com.google.common.eventbus.EventBus eventBus
@Inject public OAuth2AppInstallationServiceImpl(javax.inject.Provider<AppInstallationOAuth2Repository> appInstallationRepositoryProvider, OAuth2Service oauth2Service)
@Inject public void setEventBus(com.google.common.eventbus.EventBus eventBus)
public java.util.Optional<AppInstallationOAuth2Entity> getAppInstallationByToken(java.lang.String token)
getAppInstallationByToken
in interface OAuth2AppInstallationService
public AppInstallationOAuth2Entity prepareInstallation(@Nonnull GUID shopGuid, @Nonnull App app, @Nonnull java.util.Set<java.lang.String> scopes)
It creates an AppInstallationEntity for an OfficialApp in a shop in a AppInstallationState.PENDING state. If the AppInstallationEntity exists already it will throw AppInstallationException, unless its status is pending. In this case the authorization code timestamp is updated instead.
Part of OAuth2 authorization flow.
prepareInstallation
in interface OAuth2AppInstallationService
AppInstallationException
- If the the official app type is not installable. If there is
already an installed apppublic AppInstallationOAuth2Entity finalizeInstallation(@NotNull GUID shopGUID, @NotNull App app, @NotNull OAuth2Credentials credentials)
finalizeInstallation
in interface OAuth2AppInstallationService
protected AppInstallationEntity doUninstall(AppInstallationEntity appInstallation)
doUninstall
in class AbstractAppInstallationService
private AppInstallationOAuth2Entity doPrepareInitialInstallation(GUID shopGUID, GUID clientId, java.util.Set<java.lang.String> scopes)
private AppInstallationOAuth2Entity doPrepareExistingInstallation(AppInstallationOAuth2Entity appInstallation, java.util.Set<java.lang.String> scopes, App app)
public void terminateAllInstallationsOf(OfficialApp officialApp)
terminateAllInstallationsOf
in interface AppInstallationService
terminateAllInstallationsOf
in interface OAuth2AppInstallationService