001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.data.oauth;
003
004import org.openstreetmap.josm.tools.HttpClient;
005
006/**
007 * An interface for oauth tokens
008 * @author Taylor Smock
009 * @since 18650
010 */
011public interface IOAuthToken {
012    /**
013     * Sign a client
014     * @param client The client to sign
015     * @throws OAuthException if the OAuth token type is unknown (AKA we don't know how to handle it)
016     */
017    void sign(HttpClient client) throws OAuthException;
018
019    /**
020     * Get the preferences string of this auth token.
021     * This should match the expected return body from the authentication server.
022     * For OAuth, this is typically JSON.
023     * @return The preferences string
024     */
025    String toPreferencesString();
026
027    /**
028     * Get the auth type of this token
029     * @return The auth type
030     */
031    OAuthVersion getOAuthType();
032
033    /**
034     * Get the OAuth parameters
035     * @return The OAuth parameters
036     */
037    IOAuthParameters getParameters();
038}