Added bunch of javadocs and restricted some visibility.

No functional changes
This commit is contained in:
Pablo Fernandez committed 2010-10-24 11:48:21 -03:00
1 parent aad8dac580
commit 59f16bfdda
35 files changed
+393 -64

No files matched your search

@@ -5,52 +5,89 @@ import org.scribe.model.*;
import org.scribe.oauth.*;
import org.scribe.services.*;
/**
* Default implementation of the OAuth protocol, version 1.0a
*
* This class is meant to be extended by concrete implementations of the API.
* If your Api adheres to the 1.0a protocol correctly, you just need to extend
* this class and define the getters for your endpoints.
*
* @author Pablo Fernandez
*
*/
public abstract class DefaultApi10a implements Api
{
public AccessTokenExtractor getAccessTokenExtractor()
protected AccessTokenExtractor getAccessTokenExtractor()
{
return new TokenExtractorImpl();
}
public BaseStringExtractor getBaseStringExtractor()
protected BaseStringExtractor getBaseStringExtractor()
{
return new BaseStringExtractorImpl();
}
public HeaderExtractor getHeaderExtractor()
protected HeaderExtractor getHeaderExtractor()
{
return new HeaderExtractorImpl();
}
public RequestTokenExtractor getRequestTokenExtractor()
protected RequestTokenExtractor getRequestTokenExtractor()
{
return new TokenExtractorImpl();
}
public SignatureService getSignatureService()
protected SignatureService getSignatureService()
{
return new HMACSha1SignatureService();
}
public TimestampService getTimestampService()
protected TimestampService getTimestampService()
{
return new TimestampServiceImpl();
}
public Verb getAccessTokenVerb()
protected Verb getAccessTokenVerb()
{
return Verb.POST;
}
public Verb getRequestTokenVerb()
protected Verb getRequestTokenVerb()
{
return Verb.POST;
}
public abstract String getRequestTokenEndpoint();
public abstract String getAccessTokenEndpoint();
/**
* Returns the URL that receives the request token requests.
*
* @return request token URL
*/
protected abstract String getRequestTokenEndpoint();
public OAuthService createService(String apiKey, String apiSecret, String callback)
/**
* Returns the URL that receives the access token requests.
*
* @return access token URL
*/
protected abstract String getAccessTokenEndpoint();
/**
* Returns the {@link OAuthService} for this Api
*
* @param apiKey Key
* @param apiSecret Api Secret
* @param callback OAuth callback (either URL or 'oob')
* @param scope OAuth scope (optional)
*/
public OAuthService createService(String apiKey, String apiSecret, String callback, String scope)
{
OAuthService service = createService(apiKey, apiSecret, callback);
service.addScope(scope);
return service;
}
private OAuthService createService(String apiKey, String apiSecret, String callback)
{
return new OAuth10aServiceImpl( getSignatureService(),
getTimestampService(),
@@ -61,13 +98,6 @@ public abstract class DefaultApi10a implements Api
createConfig(apiKey, apiSecret, callback));
}
public OAuthService createService(String apiKey, String apiSecret, String callback, String scope)
{
OAuthService service = createService(apiKey, apiSecret, callback);
service.addScope(scope);
return service;
}
private OAuthConfig createConfig(String apiKey, String apiSecret, String callback)
{
OAuthConfig config = new OAuthConfig();