public boolean clearCache() throws GadgetException { final boolean isLogging = BasicOAuth2Store.LOG.isLoggable(); if (isLogging) { BasicOAuth2Store.LOG.entering(BasicOAuth2Store.LOG_CLASS, "clearCache"); } try { this.cache.clearClients(); this.cache.clearTokens(); this.cache.clearAccessors(); } catch (final OAuth2PersistenceException e) { if (isLogging) { BasicOAuth2Store.LOG.log("Error clearing OAuth2 cache", e); } throw new GadgetException(Code.OAUTH_STORAGE_ERROR, "Error clearing OAuth2 cache", e); } if (isLogging) { BasicOAuth2Store.LOG.exiting(BasicOAuth2Store.LOG_CLASS, "clearCache", true); } return true; }
public OAuth2Accessor getOAuth2Accessor(final OAuth2CallbackState state) { final boolean isLogging = BasicOAuth2Store.LOG.isLoggable(); if (isLogging) { BasicOAuth2Store.LOG.entering(BasicOAuth2Store.LOG_CLASS, "getOAuth2Accessor", state); } final OAuth2Accessor ret = this.cache.getOAuth2Accessor(state); if (isLogging) { BasicOAuth2Store.LOG.exiting(BasicOAuth2Store.LOG_CLASS, "getOAuth2Accessor", ret); } return ret; }
public OAuth2Client invalidateClient(final OAuth2Client client) { return this.cache.removeClient(client); }
if (this.cache.isPrimed()) { if (isLogging) { BasicOAuth2Store.LOG.exiting(BasicOAuth2Store.LOG_CLASS, "init", false); BasicOAuth2Store.LOG.log("clients = {0}", clients); this.cache.storeClients(clients); } catch (final OAuth2PersistenceException e) { throw new GadgetException(Code.OAUTH_STORAGE_ERROR, "Error loading OAuth2 clients", e); BasicOAuth2Store.LOG.log("tokens = {0}", tokens); this.cache.storeTokens(tokens); } catch (final OAuth2PersistenceException e) { throw new GadgetException(Code.OAUTH_STORAGE_ERROR, "Error loading OAuth2 tokens", e);
public OAuth2Client getClient(final String gadgetUri, final String serviceName) throws GadgetException { final boolean isLogging = BasicOAuth2Store.LOG.isLoggable(); if (isLogging) { BasicOAuth2Store.LOG.entering(BasicOAuth2Store.LOG_CLASS, "getClient", new Object[] { gadgetUri, serviceName }); } OAuth2Client client = this.cache.getClient(gadgetUri, serviceName); if (isLogging) { BasicOAuth2Store.LOG.log("client from cache = {0}", client); } if (client == null) { try { client = this.persister.findClient(gadgetUri, serviceName); if (client != null) { this.cache.storeClient(client); } } catch (final OAuth2PersistenceException e) { if (isLogging) { BasicOAuth2Store.LOG.log("Error loading OAuth2 client ", e); } throw new GadgetException(Code.OAUTH_STORAGE_ERROR, "Error loading OAuth2 client " + serviceName, e); } } if (isLogging) { BasicOAuth2Store.LOG.exiting(BasicOAuth2Store.LOG_CLASS, "getClient", client); } return client; }
OAuth2Token token = this.cache.getToken(processedGadgetUri, serviceName, user, scope, type); if (token == null) { try { try { token.setGadgetUri(processedGadgetUri); this.cache.storeToken(token); } finally { token.setGadgetUri(gadgetUri);
try { existingToken.setGadgetUri(processedGadgetUri); this.cache.removeToken(existingToken); this.persister.updateToken(token); } finally { this.cache.storeToken(token); } catch (final OAuth2CacheException e) { if (isLogging) {
public OAuth2Token invalidateToken(final OAuth2Token token) { return this.cache.removeToken(token); }
public OAuth2Accessor removeOAuth2Accessor(final OAuth2Accessor accessor) { final boolean isLogging = BasicOAuth2Store.LOG.isLoggable(); if (isLogging) { BasicOAuth2Store.LOG.entering(BasicOAuth2Store.LOG_CLASS, "removeOAuth2Accessor", accessor); } final OAuth2Accessor ret = null; if (accessor != null) { return this.cache.removeOAuth2Accessor(accessor); } if (isLogging) { BasicOAuth2Store.LOG.exiting(BasicOAuth2Store.LOG_CLASS, "removeOAuth2Accessor", ret); } return ret; }
public void clearClientCache() throws GadgetException { final boolean isLogging = BasicOAuth2Store.LOG.isLoggable(); if (isLogging) { BasicOAuth2Store.LOG.entering(BasicOAuth2Store.LOG_CLASS, "clearClientCache"); } try { this.cache.clearClients(); } catch (final OAuth2CacheException e) { if (isLogging) { BasicOAuth2Store.LOG.log("Error clearing OAuth2 Client cache", e); } throw new GadgetException(Code.OAUTH_STORAGE_ERROR, "Error clearing OAuth2Client cache", e); } if (isLogging) { BasicOAuth2Store.LOG.exiting(BasicOAuth2Store.LOG_CLASS, "clearClientCache"); } } }
public void clearAccessorCache() throws GadgetException { final boolean isLogging = BasicOAuth2Store.LOG.isLoggable(); if (isLogging) { BasicOAuth2Store.LOG.entering(BasicOAuth2Store.LOG_CLASS, "clearAccessorCache"); } try { this.cache.clearAccessors(); } catch (final OAuth2CacheException e) { if (isLogging) { BasicOAuth2Store.LOG.log("Error clearing OAuth2 Accessor cache", e); } throw new GadgetException(Code.OAUTH_STORAGE_ERROR, "Error clearing OAuth2Accessor cache", e); } if (isLogging) { BasicOAuth2Store.LOG.exiting(BasicOAuth2Store.LOG_CLASS, "clearAccessorCache"); } }
public void clearTokenCache() throws GadgetException { final boolean isLogging = BasicOAuth2Store.LOG.isLoggable(); if (isLogging) { BasicOAuth2Store.LOG.entering(BasicOAuth2Store.LOG_CLASS, "clearTokenCache"); } try { this.cache.clearTokens(); } catch (final OAuth2CacheException e) { if (isLogging) { BasicOAuth2Store.LOG.log("Error clearing OAuth2 Token cache", e); } throw new GadgetException(Code.OAUTH_STORAGE_ERROR, "Error clearing OAuth2Token cache", e); } if (isLogging) { BasicOAuth2Store.LOG.exiting(BasicOAuth2Store.LOG_CLASS, "clearTokenCache"); } }
try { this.cache.removeToken(token);
state.setScope(scope); OAuth2Accessor ret = this.cache.getOAuth2Accessor(state);