public interface TokenStrategy
SimpleTokenStrategy
is a basic implementation, but you can implement
this interface to generate and validate OAuth tokens your own way.Modifier and Type | Method and Description |
---|---|
void |
generateAccessToken(OAuthRequest oAuthRequest)
Generates an access token and token secret and sets it in the accessor in
the
OAuthRequest . |
void |
generateRequestToken(OAuthRequest oAuthRequest)
Generates a request token and token secret and sets it in the accessor in
the
OAuthRequest . |
String |
generateVerificationCode(javax.servlet.http.HttpServletRequest httpRequest,
String requestToken)
Generates an "unguessable" OAuth verification code.
|
String |
getCallback(javax.servlet.http.HttpServletRequest httpRequest,
String requestToken)
Gets the OAuth callback associated with this consumer for OAuth 1.0a
authentication flows.
|
String |
getTokenSecret(javax.servlet.http.HttpServletRequest httpRequest,
String token)
Gets the token secret for token to validate signatures.
|
boolean |
isRequestTokenAuthorized(javax.servlet.http.HttpServletRequest httpRequest,
String requestToken)
Checks with the request token has been authorized by the end user.
|
void |
markRequestTokenAuthorized(javax.servlet.http.HttpServletRequest httpRequest,
String requestToken)
Indicates that a user has typed in a valid ID and password, and that the
request token can now be exchanged for an access token.
|
void |
validateAccessToken(OAuthRequest oAuthRequest)
Validates that the access token is valid, throwing an exception if not.
|
String |
validateRequestToken(javax.servlet.http.HttpServletRequest httpRequest,
net.oauth.OAuthMessage message)
Validates that the request token is valid, throwing an exception if not.
|
void |
validateVerificationCode(OAuthRequest oAuthRequest)
Validates that the verification code is recognized and associated with
the request token.
|
void generateRequestToken(OAuthRequest oAuthRequest) throws net.oauth.OAuthException, IOException
OAuthRequest
.oAuthRequest
- the OAuth requestIOException
- on errors reading from the request messagenet.oauth.OAuthException
- on OAuth problemsOAuthRequest.getAccessor()
String validateRequestToken(javax.servlet.http.HttpServletRequest httpRequest, net.oauth.OAuthMessage message) throws net.oauth.OAuthException, IOException
httpRequest
- the HTTP requestmessage
- the OAuth messagenet.oauth.OAuthException
- if the tokens are not validIOException
- on I/O errorsString getCallback(javax.servlet.http.HttpServletRequest httpRequest, String requestToken) throws net.oauth.OAuthException
httpRequest
- the HTTP requestrequestToken
- the request tokennet.oauth.OAuthException
- on OAuth problemsvoid markRequestTokenAuthorized(javax.servlet.http.HttpServletRequest httpRequest, String requestToken) throws net.oauth.OAuthException
httpRequest
- the servlet requestrequestToken
- the request token stringnet.oauth.OAuthException
- if the token is not validisRequestTokenAuthorized(HttpServletRequest, String)
boolean isRequestTokenAuthorized(javax.servlet.http.HttpServletRequest httpRequest, String requestToken) throws net.oauth.OAuthException
httpRequest
- the servlet requestrequestToken
- the request tokennet.oauth.OAuthException
- on OAuth problems#markRequestTokenAuthorized(HttpServletRequest, OAuthAccessor)
String generateVerificationCode(javax.servlet.http.HttpServletRequest httpRequest, String requestToken) throws net.oauth.OAuthException
httpRequest
- the HTTP requestrequestToken
- the request tokennet.oauth.OAuthException
- on OAuth problems (e.g., the request token is invalid)void validateVerificationCode(OAuthRequest oAuthRequest) throws net.oauth.OAuthException, IOException
oAuthRequest
- the OAuth requestnet.oauth.OAuthException
- on OAuth problems (e.g., the request token is invalid)IOException
- on I/O errorsvoid generateAccessToken(OAuthRequest oAuthRequest) throws net.oauth.OAuthException, IOException
OAuthRequest
. Clears any request tokens set.oAuthRequest
- the OAuth requestnet.oauth.OAuthException
- on OAuth problemsIOException
- on I/O errorsOAuthRequest.getAccessor()
void validateAccessToken(OAuthRequest oAuthRequest) throws net.oauth.OAuthException, IOException
oAuthRequest
- the OAuth requestnet.oauth.OAuthException
- if the token is invalidIOException
- on I/O errorsString getTokenSecret(javax.servlet.http.HttpServletRequest httpRequest, String token) throws net.oauth.OAuthException
httpRequest
- the HTTP requesttoken
- the token string, either a request token or access tokennet.oauth.OAuthException
- on OAuth problems (e.g., the token is invalid)Copyright © 2018. All Rights Reserved.