All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.scribejava.core.model.OAuth1Token Maven / Gradle / Ivy

There is a newer version: 3.0.61
Show newest version
package com.github.scribejava.core.model;

import com.github.scribejava.core.utils.Preconditions;

/**
 * Represents an abstract OAuth 1 Token (either request or access token)
 */
public abstract class OAuth1Token extends Token {

    private static final long serialVersionUID = 6285873427974823019L;

    private final String token;

    private final String tokenSecret;

    public OAuth1Token(String token, String tokenSecret, String rawResponse) {
        super(rawResponse);
        Preconditions.checkNotNull(token, "oauth_token can't be null");
        Preconditions.checkNotNull(tokenSecret, "oauth_token_secret can't be null");
        this.token = token;
        this.tokenSecret = tokenSecret;
    }

    public String getToken() {
        return token;
    }

    public String getTokenSecret() {
        return tokenSecret;
    }

    /**
     * @return true if the token is empty (oauth_token = "", oauth_token_secret = "")
     */
    public boolean isEmpty() {
        return "".equals(token) && "".equals(tokenSecret);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy