001package org.syncany.plugins.transfer.oauth;
002
003/**
004 * A OAuthTokenExtractor is responsible for the extraction of an {@link OAuthTokenFinish} from a given URL string.
005 * Such URLs a are typically callback URLs called by an oauth provider who adds token and status fields to such an URL.
006 * {@link OAuthTokenExtractors} provides some predefined OAuthTokenExtractors.
007 *
008 * <p>See: {@link OAuthTokenExtractors}</p>
009 *
010 * @author Christian Roth (christian.roth@port17.de)
011 */
012
013public interface OAuthTokenExtractor {
014
015        /**
016         * Extract a {@link OAuthTokenFinish} from a given URL. It has to fail with an exception instead of returning null.
017         *
018         * @param urlWithToken The callback URL as it is invoked by the oauth provider
019         * @return A {@link OAuthTokenFinish} with a token and sometimes a state secret
020         * @throws NoSuchFieldException Thrown if the URL does not contain a token or a state field (depending on the implementation)
021         */
022        OAuthTokenFinish parse(String urlWithToken) throws NoSuchFieldException;
023
024}