org.mule.security.oauth
Class BaseOAuth1Manager
java.lang.Object
org.mule.security.oauth.callback.DefaultHttpCallbackAdapter
org.mule.security.oauth.BaseOAuth1Manager
- All Implemented Interfaces:
- Initialisable, HttpCallbackAdapter, OAuth1Manager
public abstract class BaseOAuth1Manager
- extends DefaultHttpCallbackAdapter
- implements OAuth1Manager
Method Summary |
String |
buildAuthorizeUrl(OAuth1Adapter adapter,
Map<String,String> extraParameters,
String requestTokenUrl,
String accessTokenUrl,
String authorizationUrl,
String redirectUri)
Builds the authorization url to initiate the OAuth dance |
void |
fetchAccessToken(OAuth1Adapter adapter,
String requestTokenUrl,
String accessTokenUrl,
String authorizationUrl,
String redirectUri)
Retrieves the access token for the given adapter with the given parameters. |
protected oauth.signpost.OAuthConsumer |
getConsumer(OAuth1Adapter adapter)
|
protected abstract Logger |
getLogger()
|
void |
hasBeenAuthorized(OAuth1Adapter adapter)
Determines if the adapter has been authorized or not by checking its access token |
void |
reset(OAuth1Adapter adapter)
Sets the adapter to a blank, unatuhorized state |
boolean |
restoreAccessToken(OAuth1Adapter adapter)
Restores the access token that belongs to the given adapter and sets its value
into it. |
Methods inherited from class org.mule.security.oauth.callback.DefaultHttpCallbackAdapter |
getAsync, getConnector, getDomain, getLocalPort, getPath, getRemotePort, initialise, setAsync, setConnector, setDomain, setLocalPort, setPath, setRemotePort |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.mule.security.oauth.callback.HttpCallbackAdapter |
getAsync, getConnector, getDomain, getLocalPort, getPath, getRemotePort, setAsync, setConnector, setDomain, setLocalPort, setPath, setRemotePort |
BaseOAuth1Manager
public BaseOAuth1Manager()
getLogger
protected abstract Logger getLogger()
buildAuthorizeUrl
public String buildAuthorizeUrl(OAuth1Adapter adapter,
Map<String,String> extraParameters,
String requestTokenUrl,
String accessTokenUrl,
String authorizationUrl,
String redirectUri)
throws org.mule.common.security.oauth.exception.UnableToAcquireRequestTokenException
- Builds the authorization url to initiate the OAuth dance
- Specified by:
buildAuthorizeUrl
in interface OAuth1Manager
- Parameters:
adapter
- the adapter that is going to be authorizedextraParameters
- provider specific extra parametersrequestTokenUrl
- the url of the request token serveraccessTokenUrl
- the url of the access token serverauthorizationUrl
- the url of the authorization serverredirectUri
- the redirection uri
- Returns:
- a String with the authorization url
- Throws:
org.mule.common.security.oauth.exception.UnableToAcquireRequestTokenException
restoreAccessToken
public boolean restoreAccessToken(OAuth1Adapter adapter)
- Restores the access token that belongs to the given adapter and sets its value
into it. The restoration relies on the adapter's restore callback. If it isn't
set, then no restoration is performed
- Specified by:
restoreAccessToken
in interface OAuth1Manager
- Parameters:
adapter
- the adapter which access token is to be restored
- Returns:
true
if the access token was succesfully restored.
false
otherwise.
fetchAccessToken
public void fetchAccessToken(OAuth1Adapter adapter,
String requestTokenUrl,
String accessTokenUrl,
String authorizationUrl,
String redirectUri)
throws org.mule.common.security.oauth.exception.UnableToAcquireAccessTokenException
- Retrieves the access token for the given adapter with the given parameters. The obtained token is set into the adapter
- Specified by:
fetchAccessToken
in interface OAuth1Manager
- Parameters:
adapter
- the adapter which access token you wantrequestTokenUrl
- the url of the request token serveraccessTokenUrl
- the url of the access token serverauthorizationUrl
- the url of the authorization serverredirectUri
- the redirection uri
- Throws:
org.mule.common.security.oauth.exception.UnableToAcquireAccessTokenException
hasBeenAuthorized
public void hasBeenAuthorized(OAuth1Adapter adapter)
throws org.mule.common.security.oauth.exception.NotAuthorizedException
- Determines if the adapter has been authorized or not by checking its access token
- Specified by:
hasBeenAuthorized
in interface OAuth1Manager
- Parameters:
adapter
- the adapter to be checked
- Throws:
org.mule.common.security.oauth.exception.NotAuthorizedException
- if the adapter hasn't been authorized
reset
public void reset(OAuth1Adapter adapter)
- Sets the adapter to a blank, unatuhorized state
- Specified by:
reset
in interface OAuth1Manager
- Parameters:
adapter
- the adapter to be reset
getConsumer
protected oauth.signpost.OAuthConsumer getConsumer(OAuth1Adapter adapter)
Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.