org.apache.camel.component.gae.auth
Class GAuthUpgradeBinding

java.lang.Object
  extended by org.apache.camel.component.gae.auth.GAuthUpgradeBinding
All Implemented Interfaces:
OutboundBinding<GAuthEndpoint,com.google.gdata.client.authn.oauth.GoogleOAuthParameters,com.google.gdata.client.authn.oauth.GoogleOAuthParameters>

public class GAuthUpgradeBinding
extends Object
implements OutboundBinding<GAuthEndpoint,com.google.gdata.client.authn.oauth.GoogleOAuthParameters,com.google.gdata.client.authn.oauth.GoogleOAuthParameters>

Binds GoogleOAuthParameters to a Camel Exchange. This binding is used by gauth:upgrade endpoints by default.


Field Summary
static String GAUTH_ACCESS_TOKEN
          Name of the Camel header containing an access token.
static String GAUTH_ACCESS_TOKEN_SECRET
          Name of the Camel header containing an access token secret.
 
Constructor Summary
GAuthUpgradeBinding()
           
 
Method Summary
 org.apache.camel.Exchange readResponse(GAuthEndpoint endpoint, org.apache.camel.Exchange exchange, com.google.gdata.client.authn.oauth.GoogleOAuthParameters response)
          Creates an exchange.getOut() message that containing the access token and the access token secret in the message header.
 com.google.gdata.client.authn.oauth.GoogleOAuthParameters writeRequest(GAuthEndpoint endpoint, org.apache.camel.Exchange exchange, com.google.gdata.client.authn.oauth.GoogleOAuthParameters request)
          Creates a GoogleOAuthParameters object from endpoint and exchange.getIn() data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GAUTH_ACCESS_TOKEN

public static final String GAUTH_ACCESS_TOKEN
Name of the Camel header containing an access token.

See Also:
Constant Field Values

GAUTH_ACCESS_TOKEN_SECRET

public static final String GAUTH_ACCESS_TOKEN_SECRET
Name of the Camel header containing an access token secret.

See Also:
Constant Field Values
Constructor Detail

GAuthUpgradeBinding

public GAuthUpgradeBinding()
Method Detail

writeRequest

public com.google.gdata.client.authn.oauth.GoogleOAuthParameters writeRequest(GAuthEndpoint endpoint,
                                                                              org.apache.camel.Exchange exchange,
                                                                              com.google.gdata.client.authn.oauth.GoogleOAuthParameters request)
                                                                       throws Exception
Creates a GoogleOAuthParameters object from endpoint and exchange.getIn() data. The created parameter object is used to upgrade an authorized request token to an access token. If the GAuthComponent is configured to use the HMAC_SHA1 signature method, a request token secret is obtained from a GAuthTokenSecret.COOKIE_NAME cookie.

Specified by:
writeRequest in interface OutboundBinding<GAuthEndpoint,com.google.gdata.client.authn.oauth.GoogleOAuthParameters,com.google.gdata.client.authn.oauth.GoogleOAuthParameters>
Parameters:
endpoint - endpoint providing binding-relevant information.
exchange - exchange to read data from.
request - request to be populated or created (if null) from exchange data.
Returns:
the populated response.
Throws:
GAuthException - if the GAuthComponent is configured to use the HMAC_SHA1 signature method but there's no cookie with the request token secret.
Exception

readResponse

public org.apache.camel.Exchange readResponse(GAuthEndpoint endpoint,
                                              org.apache.camel.Exchange exchange,
                                              com.google.gdata.client.authn.oauth.GoogleOAuthParameters response)
                                       throws IOException
Creates an exchange.getOut() message that containing the access token and the access token secret in the message header.

Specified by:
readResponse in interface OutboundBinding<GAuthEndpoint,com.google.gdata.client.authn.oauth.GoogleOAuthParameters,com.google.gdata.client.authn.oauth.GoogleOAuthParameters>
Parameters:
endpoint - endpoint providing binding-relevant information.
exchange - exchange to be populated or created (if null) from response data.
response - response to read data from.
Returns:
the populated exchange.
Throws:
IOException
See Also:
GAUTH_ACCESS_TOKEN, GAUTH_ACCESS_TOKEN_SECRET


Apache Camel