Search in sources :

Example 1 with TokenSecretAuthData

use of org.dataportabilityproject.shared.auth.TokenSecretAuthData in project data-transfer-project by google.

the class FlickrAuth method getAuth.

public Auth getAuth(AuthData authData) throws IOException {
    checkArgument(authData instanceof TokenSecretAuthData, "authData expected to be TokenSecretAuthData not %s", authData.getClass().getCanonicalName());
    Token requestToken = fromAuthData(authData);
    try {
        Auth auth = flickr.getAuthInterface().checkToken(requestToken);
        return auth;
    } catch (FlickrException e) {
        throw new IOException("Problem verifying auth token", e);
    }
}
Also used : TokenSecretAuthData(org.dataportabilityproject.shared.auth.TokenSecretAuthData) FlickrException(com.flickr4java.flickr.FlickrException) Auth(com.flickr4java.flickr.auth.Auth) Token(org.scribe.model.Token) IOException(java.io.IOException)

Example 2 with TokenSecretAuthData

use of org.dataportabilityproject.shared.auth.TokenSecretAuthData in project data-transfer-project by google.

the class SmugMugAuth method generateConsumer.

OAuthConsumer generateConsumer(AuthData authData) {
    Preconditions.checkArgument(authData instanceof TokenSecretAuthData, "authData expected to be TokenSecretAuthData not %s", authData.getClass().getCanonicalName());
    TokenSecretAuthData tokenSecretAuthData = (TokenSecretAuthData) authData;
    OAuthConsumer consumer = new GoogleOAuthConsumer(appCredentials.key(), appCredentials.secret());
    consumer.setTokenWithSecret(tokenSecretAuthData.token(), tokenSecretAuthData.secret());
    return consumer;
}
Also used : TokenSecretAuthData(org.dataportabilityproject.shared.auth.TokenSecretAuthData) GoogleOAuthConsumer(org.dataportabilityproject.shared.signpost.GoogleOAuthConsumer) OAuthConsumer(oauth.signpost.OAuthConsumer) GoogleOAuthConsumer(org.dataportabilityproject.shared.signpost.GoogleOAuthConsumer)

Aggregations

TokenSecretAuthData (org.dataportabilityproject.shared.auth.TokenSecretAuthData)2 FlickrException (com.flickr4java.flickr.FlickrException)1 Auth (com.flickr4java.flickr.auth.Auth)1 IOException (java.io.IOException)1 OAuthConsumer (oauth.signpost.OAuthConsumer)1 GoogleOAuthConsumer (org.dataportabilityproject.shared.signpost.GoogleOAuthConsumer)1 Token (org.scribe.model.Token)1