public class OAuthStore extends Object
Modifier and Type | Class and Description |
---|---|
static class |
OAuthStore.OAuthStoreSerializable
Serializable equivalent for OAuth Store to support clustered environments
|
Constructor and Description |
---|
OAuthStore(FriendProvider friendProvider)
Instantiates a store which uses the specified provider to grant access to some friend applications.
|
OAuthStore(String identifier,
FriendProvider friendProvider)
Instantiates a store which uses the specified provider to grant access to some friend applications.
|
OAuthStore(String identifier,
FriendProvider friendProvider,
OAuthStore.OAuthStoreSerializable oAuthStoreSerializable)
Instantiates a store which uses the specified provider to grant access to some friend applications.
|
Modifier and Type | Method and Description |
---|---|
void |
clearAuthorization(URI resourceUri)
Revokes any authorization obtained for the specified resource.
|
String |
getAuthorization(String httpMethod,
URI resourceUri,
OAuthHandler handler)
Triggers the OAuth connection to the specified target resource.
|
Optional<String> |
getExistingAuthorization(String httpMethod,
URI resourceUri,
OAuthHandler handler)
Returns the known Authorization header to use for accessing specified target resource, if any.
|
OAuthStore.OAuthStoreSerializable |
getExternalizable()
Get the serializable OAuth Store to support clustered environments
|
String |
getIdentifier()
Returns the store identifier.
|
static void |
setVerifier(String verifierId,
String verifier)
Associates a verifier to an ID to approve the OAuth connection.
|
static void |
validate(Friend friend,
RootServices rootServices)
Verifies an OAuth connection can be realized for the specified friend and root services.
|
public OAuthStore(FriendProvider friendProvider)
friendProvider
- provides access to friend applications.public OAuthStore(String identifier, FriendProvider friendProvider)
identifier
- the store identifier.friendProvider
- provides access to friend applications.public OAuthStore(String identifier, FriendProvider friendProvider, OAuthStore.OAuthStoreSerializable oAuthStoreSerializable)
identifier
- the store identifier.friendProvider
- provides access to friend applications.oAuthStoreSerializable
- OAuth Store serializablepublic static void setVerifier(String verifierId, String verifier) throws IOException
verifierId
- the ID of the verifierverifier
- the verifier value sent within the callback URLIOException
- if this operation involves serializing the verifier information and an error occurs.OAuthHandler.createCallback(RootServices, String)
public String getAuthorization(String httpMethod, URI resourceUri, OAuthHandler handler)
httpMethod
- the HTTP method use to connect to the resource (one of "GET", "PUT", "POST" or "DELETE")resourceUri
- the location of the target resourcehandler
- the handler helping the realization of the OAuth connection, if the connection is not yet approved.ClientRuntimeException
- if no friend matches the given resource, or an OAuth problem or an I/O exception occurspublic Optional<String> getExistingAuthorization(String httpMethod, URI resourceUri, OAuthHandler handler)
httpMethod
- the HTTP method use to connect to the resource (one of "GET", "PUT", "POST" or "DELETE")resourceUri
- the location of the target resourcehandler
- the handler helping the realization of the OAuth connection, if the connection was approved but no access token was yet obtained.null
if the OAuth connection is not yet authorized.ClientRuntimeException
- if no friend matches the given resource, or an OAuth problem or an I/O exception occurspublic void clearAuthorization(URI resourceUri)
resourceUri
- the location of a target resource.public static void validate(Friend friend, RootServices rootServices) throws net.oauth.OAuthException, URISyntaxException, IOException
friend
- the friend to validate.rootServices
- the root services declaring the application on which the validation shall be performed.net.oauth.OAuthException
- if the OAuth information is invalid.URISyntaxException
- if a URI is invalid.IOException
- if an error occurs when exchanging bytes with the application.public String getIdentifier()
public OAuthStore.OAuthStoreSerializable getExternalizable()