|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.veriplace.client.Client
public class Client
Veriplace client implementation in Java.
Users of the Veriplace client will minimally require an oauth_consumer_key and an
oauth_consumer_secret representing their application. In addition, some
(but not all) API functions will require an application-specific Access Token.
As a convenience, these and other parameters can be specified more concisely by
using the DefaultClientFactory.
Users of the Veriplace client will primarily operate through one of the standard APIs:
| Field Summary | |
|---|---|
static java.lang.String |
ACCESS_TOKEN_PATH
The URL path, after the baseUrl, for access token requests. |
static java.lang.String |
APPLICATION_INFO_PATH
The URL path, after the baseUrl, for request token requests. |
static java.lang.String |
LONG_TIMEOUT
|
static java.lang.String |
PRETTY_USER_DISCOVERY_USER_AUTHORIZATION_PATH
The URL path, after the baseUrl, for user authorization requests, for user discovery. |
static java.lang.String |
REQUEST_TOKEN_PATH
The URL path, after the baseUrl, for request token requests. |
static java.lang.String |
USER_AUTHORIZATION_PATH
The URL path, after the baseUrl, for user authorization requests. |
| Constructor Summary | |
|---|---|
Client(ClientConfiguration config)
|
|
Client(java.lang.String consumerKey,
java.lang.String consumerSecret)
Minimal client constructor, requiring only a consumer key and secret. |
|
Client(java.lang.String consumerKey,
java.lang.String consumerSecret,
Revision revision)
Deprecated. Obsolete; use ClientConfiguration constructor instead. |
|
Client(java.lang.String consumerKey,
java.lang.String consumerSecret,
Revision revision,
Token applicationToken)
Deprecated. Obsolete; use ClientConfiguration constructor instead. |
|
Client(java.lang.String consumerKey,
java.lang.String consumerSecret,
Revision revision,
Token applicationToken,
java.lang.String baseUrl,
CallbackFactory callbackFactory,
TokenStore requestTokenStore,
java.lang.String defaultLocationMode)
Deprecated. Obsolete; use ClientConfiguration constructor instead. |
|
Client(java.lang.String consumerKey,
java.lang.String consumerSecret,
Revision revision,
Token applicationToken,
java.lang.String baseUrl,
java.lang.String callbackServerName,
java.lang.Integer callbackServerPort,
TokenStore requestTokenStore)
Deprecated. Obsolete; use ClientConfiguration constructor instead. |
|
Client(java.lang.String consumerKey,
java.lang.String consumerSecret,
Revision revision,
Token applicationToken,
java.lang.String baseUrl,
TokenStore requestTokenStore)
Deprecated. Obsolete; use ClientConfiguration constructor instead. |
|
| Method Summary | |
|---|---|
Token |
getAccessToken(HttpServletRequest request)
Get an access token for an OAuth callback request |
java.lang.String |
getApplicationInfoUrl()
Constructs a URL, using the previously configured application consumer key, which will display the application's information page on the Veriplace web site. |
Token |
getApplicationToken()
|
java.lang.String |
getBaseUrl()
Deprecated. Obsolete; use getServerUri(). |
java.lang.String |
getBaseUrlWithHttps()
Deprecated. Obsolete; use getServerDirectUri(). |
CallbackFactory |
getCallbackFactory()
|
Consumer |
getConsumer()
|
GetLocationAPI |
getGetLocationAPI()
Get the GetLocation API client. |
InvitationAPI |
getInvitationAPI()
Get the Invitation API client. |
PermissionAPI |
getPermissionAPI()
Get the Permission API client. |
PollingAPI |
getPollingAPI()
Get the Polling API client. |
java.lang.String |
getPreferredEncoding()
|
protected Response |
getProtectedResource(com.veriplace.client.APIInfo info,
ParameterSet parameters,
Token accessToken)
Utility method for retrieving the protected resource used by a particular API. |
protected Response |
getProtectedResource(com.veriplace.client.APIInfo info,
ParameterSet parameters,
Token accessToken,
java.lang.Integer timeout)
Utility method for retrieving the protected resource used by a particular API. |
protected java.lang.String |
getRedirectURL(java.lang.String callback,
boolean immediate,
java.lang.String uriPath)
Utility method for constructing a Veriplace redirect URL for OAuth user authorization. |
protected java.lang.String |
getRedirectURL(Token requestToken,
java.lang.String callback,
boolean immediate,
java.lang.String uriPath)
Utility method for constructing a Veriplace redirect URL for OAuth user authorization, given an OAuth request token. |
java.lang.String |
getRequestToken(HttpServletRequest request)
Returns the request token value from the OAuth callback request. |
protected Token |
getRequestToken(java.lang.String callback)
Utility method for obtaining an OAuth request token. |
protected TokenStore |
getRequestTokenStore()
|
java.lang.String |
getServerDirectUri()
Returns the base URI for all direct communications with the Veriplace server (all requests except user authorization redirects). |
java.lang.String |
getServerUri()
Returns the base URI for the Veriplace server. |
boolean |
getUseHttps()
Deprecated. Obsolete; use isSecure(). |
UserDiscoveryAPI |
getUserDiscoveryAPI()
Get the UserDiscovery API client. |
java.lang.String |
getUserDiscoveryRequestToken(java.lang.String callback)
Obtains a request token value which can be used to perform user discovery. |
java.lang.String |
getUserDiscoveryUrl(java.lang.String requestToken)
Constructs a URL, using a request token previously obtained from getUserDiscoveryRequestToken(String), which will tell the Veriplace server
to initiate user discovery and then call your application (using the callback previously
specified in getUserDiscoveryRequestToken). |
boolean |
hasApplicationToken()
|
boolean |
isCallback(HttpServletRequest request)
Is this request an OAuth callback. |
boolean |
isSecure()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String REQUEST_TOKEN_PATH
public static final java.lang.String USER_AUTHORIZATION_PATH
public static final java.lang.String ACCESS_TOKEN_PATH
public static final java.lang.String PRETTY_USER_DISCOVERY_USER_AUTHORIZATION_PATH
This form uses a "pretty" URL that is more suitable for out-of-band communications.
public static final java.lang.String APPLICATION_INFO_PATH
public static final java.lang.String LONG_TIMEOUT
| Constructor Detail |
|---|
public Client(java.lang.String consumerKey,
java.lang.String consumerSecret)
throws ConfigurationException
ClientConfiguration with the same parameters.
This constructor uses the default baseUrl and requestTokenStore implementations,
does not configure an application-specific access token, and uses
OAuth Core 1.0 Rev A.
consumerKey - the OAuth consumer key, which is requiredconsumerSecret - the OAuth consumer secret, which is required
ConfigurationException
@Deprecated
public Client(java.lang.String consumerKey,
java.lang.String consumerSecret,
Revision revision)
throws ConfigurationException
ConfigurationException
@Deprecated
public Client(java.lang.String consumerKey,
java.lang.String consumerSecret,
Revision revision,
Token applicationToken)
throws ConfigurationException
ConfigurationException
@Deprecated
public Client(java.lang.String consumerKey,
java.lang.String consumerSecret,
Revision revision,
Token applicationToken,
java.lang.String baseUrl,
TokenStore requestTokenStore)
throws ConfigurationException
ConfigurationException
@Deprecated
public Client(java.lang.String consumerKey,
java.lang.String consumerSecret,
Revision revision,
Token applicationToken,
java.lang.String baseUrl,
java.lang.String callbackServerName,
java.lang.Integer callbackServerPort,
TokenStore requestTokenStore)
throws ConfigurationException
ConfigurationException
@Deprecated
public Client(java.lang.String consumerKey,
java.lang.String consumerSecret,
Revision revision,
Token applicationToken,
java.lang.String baseUrl,
CallbackFactory callbackFactory,
TokenStore requestTokenStore,
java.lang.String defaultLocationMode)
throws ConfigurationException
ConfigurationException
public Client(ClientConfiguration config)
throws ConfigurationException
ConfigurationException| Method Detail |
|---|
public UserDiscoveryAPI getUserDiscoveryAPI()
public GetLocationAPI getGetLocationAPI()
public PermissionAPI getPermissionAPI()
public InvitationAPI getInvitationAPI()
public PollingAPI getPollingAPI()
public CallbackFactory getCallbackFactory()
public boolean isCallback(HttpServletRequest request)
request - the callback request
public java.lang.String getRequestToken(HttpServletRequest request)
throws InvalidCallbackException
getUserDiscoveryUrl(String), and need to match the current callback to the
previously stored token for a particular user.
request -
InvalidCallbackException
public Token getAccessToken(HttpServletRequest request)
throws InvalidCallbackException,
TransportException,
VeriplaceOAuthException
request - the callback request
InvalidCallbackException
TransportException
VeriplaceOAuthException
protected java.lang.String getRedirectURL(java.lang.String callback,
boolean immediate,
java.lang.String uriPath)
throws TransportException,
VeriplaceOAuthException
This version obtains an OAuth request token before constructing the redirect URL.
callback - the OAuth callbackimmediate - should responses return immediately if user interaction would be required?uriPath - the resource for which authorization is requested (e.g. location)
TransportException
VeriplaceOAuthException
protected Token getRequestToken(java.lang.String callback)
throws TransportException,
VeriplaceOAuthException
callback - the OAuth callback, which is required for Rev A.
TransportException
VeriplaceOAuthException
protected java.lang.String getRedirectURL(Token requestToken,
java.lang.String callback,
boolean immediate,
java.lang.String uriPath)
throws TransportException,
VeriplaceOAuthException
requestToken - the OAuth request tokencallback - the OAuth callbackimmediate - should responses return immediately if user interaction would be required?uriPath - the resource for which authorization is requested (e.g. location)
TransportException
VeriplaceOAuthException
protected Response getProtectedResource(com.veriplace.client.APIInfo info,
ParameterSet parameters,
Token accessToken)
throws TransportException,
VeriplaceOAuthException
TransportException - if there is an I/O error in communication with the server
VeriplaceOAuthException - if the server denied the request
protected Response getProtectedResource(com.veriplace.client.APIInfo info,
ParameterSet parameters,
Token accessToken,
java.lang.Integer timeout)
throws TransportException,
VeriplaceOAuthException
TransportException - if there is an I/O error in communication with the server
VeriplaceOAuthException - if the server denied the requestpublic java.lang.String getServerUri()
getServerDirectUri()@Deprecated public java.lang.String getBaseUrl()
getServerUri().
public java.lang.String getServerDirectUri()
isSecure() is true then this will use HTTPS.
@Deprecated public java.lang.String getBaseUrlWithHttps()
getServerDirectUri().
public java.lang.String getPreferredEncoding()
public boolean isSecure()
@Deprecated public boolean getUseHttps()
isSecure().
public Consumer getConsumer()
public boolean hasApplicationToken()
public Token getApplicationToken()
protected TokenStore getRequestTokenStore()
public java.lang.String getUserDiscoveryRequestToken(java.lang.String callback)
throws TransportException,
VeriplaceOAuthException
getUserDiscoveryUrl(String), and also save the request token
value so you can identify which user the callback is coming from (see
getRequestToken(HttpServletRequest)).
callback - the callback URL to which Veriplace should redirect the user after
user discovery has finished
TransportException
VeriplaceOAuthExceptionpublic java.lang.String getUserDiscoveryUrl(java.lang.String requestToken)
getUserDiscoveryRequestToken(String), which will tell the Veriplace server
to initiate user discovery and then call your application (using the callback previously
specified in getUserDiscoveryRequestToken). You can then ask an end user to visit this
URL to sign up with Veriplace.
public java.lang.String getApplicationInfoUrl()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||