@Inject
public OAuth2StoreProvider(
@Named(OAuth2Module.OAUTH2_REDIRECT_URI) final String globalRedirectUri,
@Named(OAuth2Module.OAUTH2_IMPORT) final boolean importFromConfig,
@Named(OAuth2Module.OAUTH2_IMPORT_CLEAN) final boolean importClean,
final Authority authority, final OAuth2Cache cache, final OAuth2Persister persister,
final OAuth2Encrypter encrypter,
@Nullable @Named("shindig.contextroot") final String contextRoot,
@Named(OAuth2FetcherConfig.OAUTH2_STATE_CRYPTER) final BlobCrypter stateCrypter) {
this.store = new BasicOAuth2Store(cache, persister, encrypter, globalRedirectUri, authority,
contextRoot, stateCrypter);
if (importFromConfig) {
try {
final OAuth2Persister source = new JSONOAuth2Persister(encrypter, authority,
globalRedirectUri, contextRoot);
BasicOAuth2Store.runImport(source, persister, importClean);
} catch (final OAuth2PersistenceException e) {
if (OAuth2Module.LOG.isLoggable()) {
OAuth2Module.LOG.log("store init exception", e);
}
}
}
try {
this.store.init();
} catch (final GadgetException e) {
if (OAuth2Module.LOG.isLoggable()) {
OAuth2Module.LOG.log("store init exception", e);
}
}
}