org.apache.shindig.gadgets.oauth
Interface OAuthStore

All Known Implementing Classes:
BasicOAuthStore

public interface OAuthStore

Interface to an OAuth Data Store. A shindig gadget server can act as an OAuth consumer, using OAuth tokens to talk to OAuth service providers on behalf of the gadgets it is proxying requests for. An OAuth consumer needs to permanently store gadgets it has collected, and retrieve the appropriate tokens when proxying a request for a gadget. An OAuth Data Store stores three things: (1) information about OAuth service providers, including the three URLs that define OAuth providers (defined in OAuthStore.ProviderInfo) (2) information about consumer keys and secrets that gadgets might have negotiated with OAuth service providers, or that containers might have negotiated on behalf of the gadgets. This information is bound to the service provider it pertains to and can only be stored if the corresponding service provider information is already stored in the OAuth store (defined in OAuthStore.ConsumerKeyAndSecret). (3) OAuth access tokens and their corresponding token secrets. (defined in OAuthStore.TokenInfo). Note that we do not store request tokens in the OAuth store.


Nested Class Summary
static class OAuthStore.ConsumerInfo
          Information about an OAuth consumer.
static class OAuthStore.TokenInfo
          Information about an access token.
 
Method Summary
 OAuthStore.ConsumerInfo getConsumerKeyAndSecret(SecurityToken securityToken, String serviceName, net.oauth.OAuthServiceProvider provider)
          Retrieve OAuth consumer to use for requests.
 OAuthStore.TokenInfo getTokenInfo(SecurityToken securityToken, OAuthStore.ConsumerInfo consumerInfo, String serviceName, String tokenName)
          Retrieve OAuth access token to use for the request.
 void removeToken(SecurityToken securityToken, OAuthStore.ConsumerInfo consumerInfo, String serviceName, String tokenName)
          Remove the access token for the given user/gadget/service/token
 void setTokenInfo(SecurityToken securityToken, OAuthStore.ConsumerInfo consumerInfo, String serviceName, String tokenName, OAuthStore.TokenInfo tokenInfo)
          Set the access token for the given user/gadget/service/token
 

Method Detail

getConsumerKeyAndSecret

OAuthStore.ConsumerInfo getConsumerKeyAndSecret(SecurityToken securityToken,
                                                String serviceName,
                                                net.oauth.OAuthServiceProvider provider)
                                                throws GadgetException
Retrieve OAuth consumer to use for requests. The returned consumer is ready to use for signed fetch requests.

Parameters:
securityToken - token for user/gadget making request.
serviceName - gadget's nickname for the service being accessed.
provider - OAuth service provider info to be inserted into the returned consumer.
Throws:
GadgetException - if no OAuth consumer can be found (e.g. no consumer key can be used.)

getTokenInfo

OAuthStore.TokenInfo getTokenInfo(SecurityToken securityToken,
                                  OAuthStore.ConsumerInfo consumerInfo,
                                  String serviceName,
                                  String tokenName)
                                  throws GadgetException
Retrieve OAuth access token to use for the request.

Parameters:
securityToken - token for user/gadget making request.
consumerInfo - OAuth consumer that will be used for the request.
serviceName - gadget's nickname for the service being accessed.
tokenName - gadget's nickname for the token to use.
Returns:
the token and secret, or null if none exist
Throws:
GadgetException - if an error occurs during lookup

setTokenInfo

void setTokenInfo(SecurityToken securityToken,
                  OAuthStore.ConsumerInfo consumerInfo,
                  String serviceName,
                  String tokenName,
                  OAuthStore.TokenInfo tokenInfo)
                  throws GadgetException
Set the access token for the given user/gadget/service/token

Throws:
GadgetException

removeToken

void removeToken(SecurityToken securityToken,
                 OAuthStore.ConsumerInfo consumerInfo,
                 String serviceName,
                 String tokenName)
                 throws GadgetException
Remove the access token for the given user/gadget/service/token

Throws:
GadgetException


Copyright © 2007-2012. All Rights Reserved.