/** * Store an access token for the given user/gadget/service/token name */ public void storeTokenKeyAndSecret(SecurityToken securityToken, ConsumerInfo consumerInfo, OAuthArguments arguments, TokenInfo tokenInfo, OAuthResponseParams responseParams) throws OAuthRequestException { try { store.setTokenInfo(securityToken, consumerInfo, arguments.getServiceName(), arguments.getTokenName(), tokenInfo); } catch (GadgetException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Unable to store access token", e); } }
/** * Remove an access token for the given user/gadget/service/token name */ public void removeToken(SecurityToken securityToken, ConsumerInfo consumerInfo, OAuthArguments arguments, OAuthResponseParams responseParams) throws OAuthRequestException { try { store.removeToken(securityToken, consumerInfo, arguments.getServiceName(), arguments.getTokenName()); } catch (GadgetException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Unable to remove access token", e); } } }
/** * Save off our new token and secret to the persistent store. */ private void saveAccessToken() throws OAuthRequestException { OAuthAccessor accessor = accessorInfo.getAccessor(); TokenInfo tokenInfo = new TokenInfo(accessor.accessToken, accessor.tokenSecret, accessorInfo.getSessionHandle(), accessorInfo.getTokenExpireMillis()); fetcherConfig.getTokenStore().storeTokenKeyAndSecret(realRequest.getSecurityToken(), accessorInfo.getConsumer(), realRequest.getOAuthArguments(), tokenInfo, responseParams); }
private static void addConsumer( BasicOAuthStore base, String gadgetUrl, String serviceName, String consumerKey, String consumerSecret) { BasicOAuthStoreConsumerIndex providerKey = new BasicOAuthStoreConsumerIndex(); providerKey.setGadgetUri(gadgetUrl); providerKey.setServiceName(serviceName); BasicOAuthStoreConsumerKeyAndSecret kas = new BasicOAuthStoreConsumerKeyAndSecret( consumerKey, consumerSecret, KeyType.HMAC_SYMMETRIC, null, null); base.setConsumerKeyAndSecret(providerKey, kas); }
/** * Do we need to exchange a request token for an access token? */ private boolean needAccessToken() { if (realRequest.getOAuthArguments().mustUseToken() && accessorInfo.getAccessor().requestToken != null && accessorInfo.getAccessor().accessToken == null) { return true; } return realRequest.getOAuthArguments().mayUseToken() && accessTokenExpired(); }
public boolean matches(Object argument) { if (!(argument instanceof OAuthGadgetContext)) { return false; } OAuthGadgetContext context = (OAuthGadgetContext) argument; return (securityToken == context.getToken() && arguments.getBypassSpecCache() == context.getIgnoreCache()); }
private static void addDefaultKey(BasicOAuthStore base) { BasicOAuthStoreConsumerKeyAndSecret defaultKey = new BasicOAuthStoreConsumerKeyAndSecret( "signedfetch", FakeOAuthServiceProvider.PRIVATE_KEY_TEXT, KeyType.RSA_PRIVATE, "foo", null); base.setDefaultKey(defaultKey); }
/** * Save off our new token and secret to the persistent store. */ private void saveAccessToken() throws OAuthRequestException { OAuthAccessor accessor = accessorInfo.getAccessor(); TokenInfo tokenInfo = new TokenInfo(accessor.accessToken, accessor.tokenSecret, accessorInfo.getSessionHandle(), accessorInfo.getTokenExpireMillis()); fetcherConfig.getTokenStore().storeTokenKeyAndSecret(realRequest.getSecurityToken(), accessorInfo.getConsumer(), realRequest.getOAuthArguments(), tokenInfo, responseParams); }
private static void addConsumer( BasicOAuthStore base, String gadgetUrl, String serviceName, String consumerKey, String consumerSecret) { BasicOAuthStoreConsumerIndex providerKey = new BasicOAuthStoreConsumerIndex(); providerKey.setGadgetUri(gadgetUrl); providerKey.setServiceName(serviceName); BasicOAuthStoreConsumerKeyAndSecret kas = new BasicOAuthStoreConsumerKeyAndSecret( consumerKey, consumerSecret, KeyType.HMAC_SYMMETRIC, null, null); base.setConsumerKeyAndSecret(providerKey, kas); }
/** * Store an access token for the given user/gadget/service/token name */ public void storeTokenKeyAndSecret(SecurityToken securityToken, ConsumerInfo consumerInfo, OAuthArguments arguments, TokenInfo tokenInfo, OAuthResponseParams responseParams) throws OAuthRequestException { try { store.setTokenInfo(securityToken, consumerInfo, arguments.getServiceName(), arguments.getTokenName(), tokenInfo); } catch (GadgetException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Unable to store access token", e); } }
/** * Remove an access token for the given user/gadget/service/token name */ public void removeToken(SecurityToken securityToken, ConsumerInfo consumerInfo, OAuthArguments arguments, OAuthResponseParams responseParams) throws OAuthRequestException { try { store.removeToken(securityToken, consumerInfo, arguments.getServiceName(), arguments.getTokenName()); } catch (GadgetException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Unable to remove access token", e); } } }
/** * Do we need to exchange a request token for an access token? */ private boolean needAccessToken() { if (realRequest.getOAuthArguments().mustUseToken() && accessorInfo.getAccessor().requestToken != null && accessorInfo.getAccessor().accessToken == null) { return true; } return realRequest.getOAuthArguments().mayUseToken() && accessTokenExpired(); }
public boolean matches(Object argument) { if (!(argument instanceof OAuthGadgetContext)) { return false; } OAuthGadgetContext context = (OAuthGadgetContext) argument; return (securityToken == context.getToken() && arguments.getBypassSpecCache() == context.getIgnoreCache()); }
private static void addDefaultKey(BasicOAuthStore base) { BasicOAuthStoreConsumerKeyAndSecret defaultKey = new BasicOAuthStoreConsumerKeyAndSecret( "signedfetch", FakeOAuthServiceProvider.PRIVATE_KEY_TEXT, KeyType.RSA_PRIVATE, "foo", null); base.setDefaultKey(defaultKey); }
/** * Save off our new token and secret to the persistent store. */ private void saveAccessToken() throws OAuthRequestException { OAuthAccessor accessor = accessorInfo.getAccessor(); TokenInfo tokenInfo = new TokenInfo(accessor.accessToken, accessor.tokenSecret, accessorInfo.getSessionHandle(), accessorInfo.getTokenExpireMillis()); fetcherConfig.getTokenStore().storeTokenKeyAndSecret(realRequest.getSecurityToken(), accessorInfo.getConsumer(), realRequest.getOAuthArguments(), tokenInfo, responseParams); }
private static void addConsumer( BasicOAuthStore base, String gadgetUrl, String serviceName, String consumerKey, String consumerSecret) { BasicOAuthStoreConsumerIndex providerKey = new BasicOAuthStoreConsumerIndex(); providerKey.setGadgetUri(gadgetUrl); providerKey.setServiceName(serviceName); BasicOAuthStoreConsumerKeyAndSecret kas = new BasicOAuthStoreConsumerKeyAndSecret( consumerKey, consumerSecret, KeyType.HMAC_SYMMETRIC, null, null); base.setConsumerKeyAndSecret(providerKey, kas); }
/** * Store an access token for the given user/gadget/service/token name */ public void storeTokenKeyAndSecret(SecurityToken securityToken, ConsumerInfo consumerInfo, OAuthArguments arguments, TokenInfo tokenInfo, OAuthResponseParams responseParams) throws OAuthRequestException { try { store.setTokenInfo(securityToken, consumerInfo, arguments.getServiceName(), arguments.getTokenName(), tokenInfo); } catch (GadgetException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Unable to store access token", e); } }
/** * Do we need to exchange a request token for an access token? */ private boolean needAccessToken() { if (realRequest.getOAuthArguments().mustUseToken() && accessorInfo.getAccessor().requestToken != null && accessorInfo.getAccessor().accessToken == null) { return true; } return realRequest.getOAuthArguments().mayUseToken() && accessTokenExpired(); }
public boolean matches(Object argument) { if (!(argument instanceof OAuthGadgetContext)) { return false; } OAuthGadgetContext context = (OAuthGadgetContext) argument; return (securityToken == context.getToken() && arguments.getBypassSpecCache() == context.getIgnoreCache()); }
private static void addDefaultKey(BasicOAuthStore base) { BasicOAuthStoreConsumerKeyAndSecret defaultKey = new BasicOAuthStoreConsumerKeyAndSecret( "signedfetch", FakeOAuthServiceProvider.PRIVATE_KEY_TEXT, KeyType.RSA_PRIVATE, "foo", null); base.setDefaultKey(defaultKey); }