public class OAuthProviderChecker extends Object implements OAuthProvider
| Constructor and Description |
|---|
OAuthProviderChecker(OAuthProvider provider) |
| Modifier and Type | Method and Description |
|---|---|
String |
authoriseRequestToken(String consumerKey,
String requestKey)
Authorises the given Request Token for the given Consumer and return a new Verifier to be returned to the Client.
|
void |
checkTimestamp(OAuthToken token,
long timestamp)
Checks that the given timestamp is valid for the given OAuth Token.
|
Set<String> |
convertPermissionsToRoles(String[] permissions)
Converts custom permissions which may have been associated with consumers
or access tokens into domain specific roles, example,
given a "printResources" permission this method may return a role name "printerService"
|
OAuthToken |
getAccessToken(String consumerKey,
String accessKey)
Returns the OAuth Access Token for the given Consumer key and Access Token.
|
OAuthConsumer |
getConsumer(String consumerKey)
Returns the OAuth Consumer for the given Consumer key.
|
String |
getRealm()
Returns the Realm of this provider.
|
OAuthRequestToken |
getRequestToken(String consumerKey,
String requestKey)
Returns the OAuth Request Token for the given Consumer key and Request Token.
|
OAuthToken |
makeAccessToken(String consumerKey,
String requestKey,
String verifier)
Make a new OAuth Access Token for the given Consumer, using the given Request Token and Verifier.
|
OAuthToken |
makeRequestToken(String consumerKey,
String callback,
String[] scopes,
String[] permissions)
Make a new OAuth Request Token for the given Consumer, using the given callback.
|
OAuthConsumer |
registerConsumer(String consumerKey,
String displayName,
String connectURI)
Creates a new OAuth Consumer
|
void |
registerConsumerPermissions(String consumerKey,
String[] permissions)
Registers Consumer Permissions
|
void |
registerConsumerScopes(String consumerKey,
String[] scopes)
Registers Consumer Scopes
|
public OAuthProviderChecker(OAuthProvider provider)
public OAuthConsumer registerConsumer(String consumerKey, String displayName, String connectURI) throws OAuthException
OAuthConsumerRegistrationregisterConsumer in interface OAuthConsumerRegistrationconsumerKey - the Consumer key.displayName - display nameconnectURI - uriOAuthConsumerOAuthException - thrown if Consumer can not be registered.public OAuthConsumer getConsumer(String consumerKey) throws OAuthException
OAuthProvidergetConsumer in interface OAuthProviderconsumerKey - the Consumer key to load.OAuthException - thrown if the given Consumer does not exist.public String getRealm()
OAuthProvidergetRealm in interface OAuthProviderpublic OAuthRequestToken getRequestToken(String consumerKey, String requestKey) throws OAuthException
OAuthProvidergetRequestToken in interface OAuthProviderconsumerKey - the Consumer key whose Request Token we want to loadrequestKey - the Request Token to loadOAuthException - thrown if the given Request Token does not exist.public OAuthToken getAccessToken(String consumerKey, String accessKey) throws OAuthException
OAuthProvidergetAccessToken in interface OAuthProviderconsumerKey - the Consumer key whose Access Token we want to loadaccessKey - the Access Token to loadOAuthException - thrown if the given Consumer or Access Token do not exist.public void checkTimestamp(OAuthToken token, long timestamp) throws OAuthException
OAuthProvidercheckTimestamp in interface OAuthProvidertoken - the OAuth Token whose timestamp to check and save if validtimestamp - the timestamp to check and save if validOAuthException - thrown if the given timestamp is not greater or equal to the last timestamp associated
with the given OAuth Tokenpublic OAuthToken makeAccessToken(String consumerKey, String requestKey, String verifier) throws OAuthException
OAuthProvidermakeAccessToken in interface OAuthProviderconsumerKey - the Consumer key for whom to create a new Access TokenrequestKey - the Request Token to exchange for a new Access Tokenverifier - the Client-specified Verifier that must match the Verifier that was given to the Client
when the given Request Token was authorised.OAuthException - thrown if the given Consumer or Request Token does not exist, if the Request Token is not authorised
or if the Verifier is invalid.public OAuthToken makeRequestToken(String consumerKey, String callback, String[] scopes, String[] permissions) throws OAuthException
OAuthProvidermakeRequestToken in interface OAuthProviderconsumerKey - the Consumer key for whom to create a new Request Tokencallback - the Client-specified callback for this Request Tokenscopes - resource URIs the consumer would like to accesspermissions - permissions the consumer is requestingOAuthException - thrown if the given Consumer does not existpublic String authoriseRequestToken(String consumerKey, String requestKey) throws OAuthException
OAuthProviderauthoriseRequestToken in interface OAuthProviderconsumerKey - the Consumer Key whose Request Token we want to authoriserequestKey - the Request Token to authoriseOAuthException - thrown if the given Consumer or Request Token do not exist, or if the Request Token has already been authorised.public void registerConsumerScopes(String consumerKey, String[] scopes) throws OAuthException
OAuthConsumerRegistrationregisterConsumerScopes in interface OAuthConsumerRegistrationconsumerKey - the Consumer key.scopes - the consumer scopesOAuthException - thrown if scopes can not be registered.public void registerConsumerPermissions(String consumerKey, String[] permissions) throws OAuthException
OAuthConsumerRegistrationregisterConsumerPermissions in interface OAuthConsumerRegistrationconsumerKey - the Consumer key.permissions - the consumer permissionsOAuthException - thrown if permissions can not be registered.public Set<String> convertPermissionsToRoles(String[] permissions)
OAuthProviderconvertPermissionsToRoles in interface OAuthProviderpermissions - array of permissionsCopyright © 2018 JBoss by Red Hat. All rights reserved.