Package org.refcodes.rest
Class OauthTokenHandler
- java.lang.Object
-
- org.refcodes.net.OauthTokenImpl
-
- org.refcodes.rest.OauthTokenHandler
-
- All Implemented Interfaces:
org.refcodes.mixin.Disposable,org.refcodes.mixin.Disposable.Disposedable,org.refcodes.mixin.DisposedAccessor,org.refcodes.mixin.ValidAccessor,org.refcodes.net.OauthToken
public class OauthTokenHandler extends org.refcodes.net.OauthTokenImpl implements org.refcodes.net.OauthTokenSelf refreshing implementation of theOauthToken. In case a refresh token (as ofOauthTokenImpl.getRefreshToken()and has been provided, then the access token (as ofOauthTokenImpl.getAccessToken()is refreshed within the "expires in" time (as ofOauthTokenImpl.getExpiresIn(). The refresh daemon terminates and this instance is disposed when the providedHttpRestClient'sClosable.close()method is called or thedispose()method is invoked.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.Disposable
org.refcodes.mixin.Disposable.Disposedable
-
-
Constructor Summary
Constructors Constructor Description OauthTokenHandler(java.lang.String aUrl, java.lang.String aAccessToken, java.lang.String aRefreshToken, java.lang.String aTokenType, java.lang.Integer aExpiresIn, java.lang.String aScope)Constructs an instance of theOauthTokenHandlerwith the given parameters.OauthTokenHandler(java.lang.String aUrl, java.lang.String aClientId, java.lang.String aClientSecret, java.lang.String aUserName, java.lang.String aUserPassword)Constructs an instance of theOauthTokenHandlerwith the given parameters by using the user's name and password for a "password" grant type authentication to retrieve aOauthToken.OauthTokenHandler(java.lang.String aUrl, org.refcodes.net.OauthToken aOauthToken)Constructs an instance of theOauthTokenHandlerwith the given parameters.OauthTokenHandler(java.lang.String aUrl, HttpRestClient aHttpRestClient, java.lang.String aAccessToken, java.lang.String aRefreshToken, java.lang.String aTokenType, java.lang.Integer aExpiresIn, java.lang.String aScope)Constructs an instance of theOauthTokenHandlerwith the given parameters.OauthTokenHandler(java.lang.String aUrl, HttpRestClient aHttpRestClient, java.lang.String aClientId, java.lang.String aClientSecret, java.lang.String aUserName, java.lang.String aUserPassword)Constructs an instance of theOauthTokenHandlerwith the given parameters by using the user's name and password for a "password" grant type authentication to retrieve aOauthToken.OauthTokenHandler(java.lang.String aUrl, HttpRestClient aHttpRestClient, org.refcodes.net.OauthToken aOauthToken)Constructs an instance of theOauthTokenHandlerwith the given parameters.OauthTokenHandler(org.refcodes.net.Url aUrl, java.lang.String aAccessToken, java.lang.String aRefreshToken, java.lang.String aTokenType, java.lang.Integer aExpiresIn, java.lang.String aScope)Constructs an instance of theOauthTokenHandlerwith the given parameters.OauthTokenHandler(org.refcodes.net.Url aUrl, java.lang.String aClientId, java.lang.String aClientSecret, java.lang.String aUserName, java.lang.String aUserPassword)Constructs an instance of theOauthTokenHandlerwith the given parameters by using the user's name and password for a "password" grant type authentication to retrieve aOauthToken.OauthTokenHandler(org.refcodes.net.Url aUrl, org.refcodes.net.HttpBodyMap aOauthToken)Constructs an instance of theOauthTokenHandlerwith the given parameters.OauthTokenHandler(org.refcodes.net.Url aUrl, org.refcodes.net.OauthToken aOauthToken)Constructs an instance of theOauthTokenHandlerwith the given parameters.OauthTokenHandler(org.refcodes.net.Url aUrl, HttpRestClient aHttpRestClient, java.lang.String aAccessToken, java.lang.String aRefreshToken, java.lang.String aTokenType, java.lang.Integer aExpiresIn, java.lang.String aScope)Constructs an instance of theOauthTokenHandlerwith the given parameters.OauthTokenHandler(org.refcodes.net.Url aUrl, HttpRestClient aHttpRestClient, java.lang.String aClientId, java.lang.String aClientSecret, java.lang.String aUserName, java.lang.String aUserPassword)Constructs an instance of theOauthTokenHandlerwith the given parameters by using the user's name and password for a "password" grant type authentication to retrieve aOauthToken.OauthTokenHandler(org.refcodes.net.Url aUrl, HttpRestClient aHttpRestClient, org.refcodes.net.HttpBodyMap aOauthToken)Constructs an instance of theOauthTokenHandlerwith the given parameters.OauthTokenHandler(org.refcodes.net.Url aUrl, HttpRestClient aHttpRestClient, org.refcodes.net.OauthToken aOauthToken)Constructs an instance of theOauthTokenHandlerwith the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()-
Methods inherited from interface org.refcodes.net.OauthToken
getAccessToken, getExpiresIn, getNotBeforePolicy, getRefreshExpiresIn, getRefreshToken, getScope, getSessionState, getTokenType, isValid
-
-
-
-
Constructor Detail
-
OauthTokenHandler
public OauthTokenHandler(org.refcodes.net.Url aUrl, java.lang.String aClientId, java.lang.String aClientSecret, java.lang.String aUserName, java.lang.String aUserPassword) throws org.refcodes.net.HttpStatusException, java.net.MalformedURLExceptionConstructs an instance of theOauthTokenHandlerwith the given parameters by using the user's name and password for a "password" grant type authentication to retrieve aOauthToken.- Parameters:
aUrl- TheUrlto be used when refreshing the access token.aUserName- The user's name for "password" grant type.aUserPassword- The user's password for "password" grant type.aClientId- The client's ID for "password" grant type.aClientSecret- The client's secret for "password" grant type.- Throws:
java.net.MalformedURLException- thrown in case of a malformed URL.org.refcodes.net.HttpStatusException- thrown in case a HTTP response was of an erroneous status.
-
OauthTokenHandler
public OauthTokenHandler(org.refcodes.net.Url aUrl, HttpRestClient aHttpRestClient, java.lang.String aClientId, java.lang.String aClientSecret, java.lang.String aUserName, java.lang.String aUserPassword) throws org.refcodes.net.HttpStatusException, java.net.MalformedURLExceptionConstructs an instance of theOauthTokenHandlerwith the given parameters by using the user's name and password for a "password" grant type authentication to retrieve aOauthToken.- Parameters:
aUrl- TheUrlto be used when refreshing the access token.aHttpRestClient- TheHttpRestClientto use when refreshing the token.aUserName- The user's name for "password" grant type.aUserPassword- The user's password for "password" grant type.aClientId- The client's ID for "password" grant type.aClientSecret- The client's secret for "password" grant type.- Throws:
java.net.MalformedURLException- thrown in case of a malformed URL.org.refcodes.net.HttpStatusException- thrown in case a HTTP response was of an erroneous status.
-
OauthTokenHandler
public OauthTokenHandler(java.lang.String aUrl, java.lang.String aClientId, java.lang.String aClientSecret, java.lang.String aUserName, java.lang.String aUserPassword) throws org.refcodes.net.HttpStatusException, java.net.MalformedURLExceptionConstructs an instance of theOauthTokenHandlerwith the given parameters by using the user's name and password for a "password" grant type authentication to retrieve aOauthToken.- Parameters:
aUrl- The URL to be used when refreshing the access token.aUserName- The user's name for "password" grant type.aUserPassword- The user's password for "password" grant type.aClientId- The client's ID for "password" grant type.aClientSecret- The client's secret for "password" grant type.- Throws:
java.net.MalformedURLException- thrown in case of a malformed URL.org.refcodes.net.HttpStatusException- thrown in case a HTTP response was of an erroneous status.
-
OauthTokenHandler
public OauthTokenHandler(java.lang.String aUrl, HttpRestClient aHttpRestClient, java.lang.String aClientId, java.lang.String aClientSecret, java.lang.String aUserName, java.lang.String aUserPassword) throws org.refcodes.net.HttpStatusException, java.net.MalformedURLExceptionConstructs an instance of theOauthTokenHandlerwith the given parameters by using the user's name and password for a "password" grant type authentication to retrieve aOauthToken.- Parameters:
aUrl- The URL to be used when refreshing the access token.aHttpRestClient- TheHttpRestClientto use when refreshing the token.aUserName- The user's name for "password" grant type.aUserPassword- The user's password for "password" grant type.aClientId- The client's ID for "password" grant type.aClientSecret- The client's secret for "password" grant type.- Throws:
java.net.MalformedURLException- thrown in case of a malformed URL.org.refcodes.net.HttpStatusException- thrown in case a HTTP response was of an erroneous status.
-
OauthTokenHandler
public OauthTokenHandler(java.lang.String aUrl, java.lang.String aAccessToken, java.lang.String aRefreshToken, java.lang.String aTokenType, java.lang.Integer aExpiresIn, java.lang.String aScope)Constructs an instance of theOauthTokenHandlerwith the given parameters. For the refresh token parameters, please refer to "https://www.oauth.com/oauth2-servers/access-tokens/refreshing-access-tokens".- Parameters:
aUrl- TheUrlto be used when refreshing the access token.aAccessToken- The access token to be stored (as ofOauthTokenImpl.getAccessToken()).aRefreshToken- The refresh token to be used (as ofOauthTokenImpl.getRefreshToken()).aTokenType- The token type to be stored (as ofOauthTokenImpl.getTokenType()).aExpiresIn- The "expires in" time to be stored (as ofOauthTokenImpl.getExpiresIn()).aScope- The scope to be stored (as ofOauthTokenImpl.getScope()).
-
OauthTokenHandler
public OauthTokenHandler(org.refcodes.net.Url aUrl, java.lang.String aAccessToken, java.lang.String aRefreshToken, java.lang.String aTokenType, java.lang.Integer aExpiresIn, java.lang.String aScope)Constructs an instance of theOauthTokenHandlerwith the given parameters.- Parameters:
aUrl- TheUrlto be used when refreshing the access token.aAccessToken- The access token to be stored (as ofOauthTokenImpl.getAccessToken()).aRefreshToken- The refresh token to be used (as ofOauthTokenImpl.getRefreshToken()).aTokenType- The token type to be stored (as ofOauthTokenImpl.getTokenType()).aExpiresIn- The "expires in" time to be stored (as ofOauthTokenImpl.getExpiresIn()).aScope- The scope to be stored (as ofOauthTokenImpl.getScope()).
-
OauthTokenHandler
public OauthTokenHandler(org.refcodes.net.Url aUrl, org.refcodes.net.HttpBodyMap aOauthToken)Constructs an instance of theOauthTokenHandlerwith the given parameters.- Parameters:
aUrl- TheUrlto be used when refreshing the access token.aOauthToken- TheHttpBodyMapcontaining the OAuth token with the required information.
-
OauthTokenHandler
public OauthTokenHandler(org.refcodes.net.Url aUrl, org.refcodes.net.OauthToken aOauthToken)Constructs an instance of theOauthTokenHandlerwith the given parameters.- Parameters:
aUrl- TheUrlto be used when refreshing the access token.aOauthToken- TheOauthTokencontaining the required information.
-
OauthTokenHandler
public OauthTokenHandler(java.lang.String aUrl, org.refcodes.net.OauthToken aOauthToken)Constructs an instance of theOauthTokenHandlerwith the given parameters. For the refresh token parameters, please refer to "https://www.oauth.com/oauth2-servers/access-tokens/refreshing-access-tokens".- Parameters:
aUrl- TheUrlto be used when refreshing the access token.aOauthToken- TheOauthTokencontaining the required information.
-
OauthTokenHandler
public OauthTokenHandler(org.refcodes.net.Url aUrl, HttpRestClient aHttpRestClient, java.lang.String aAccessToken, java.lang.String aRefreshToken, java.lang.String aTokenType, java.lang.Integer aExpiresIn, java.lang.String aScope)Constructs an instance of theOauthTokenHandlerwith the given parameters.- Parameters:
aUrl- TheUrlto be used when refreshing the access token.aHttpRestClient- TheHttpRestClientto use when refreshing the token.aAccessToken- The access token to be stored (as ofOauthTokenImpl.getAccessToken()).aRefreshToken- The refresh token to be used (as ofOauthTokenImpl.getRefreshToken()).aTokenType- The token type to be stored (as ofOauthTokenImpl.getTokenType()).aExpiresIn- The "expires in" time to be stored (as ofOauthTokenImpl.getExpiresIn()).aScope- The scope to be stored (as ofOauthTokenImpl.getScope()).
-
OauthTokenHandler
public OauthTokenHandler(org.refcodes.net.Url aUrl, HttpRestClient aHttpRestClient, org.refcodes.net.HttpBodyMap aOauthToken)Constructs an instance of theOauthTokenHandlerwith the given parameters.- Parameters:
aUrl- TheUrlto be used when refreshing the access token.aHttpRestClient- TheHttpRestClientto use when refreshing the token.aOauthToken- TheHttpBodyMapcontaining the OAuth token with the required information.
-
OauthTokenHandler
public OauthTokenHandler(java.lang.String aUrl, HttpRestClient aHttpRestClient, org.refcodes.net.OauthToken aOauthToken)Constructs an instance of theOauthTokenHandlerwith the given parameters.- Parameters:
aUrl- The URL to be used when refreshing the access token.aHttpRestClient- TheHttpRestClientto use when refreshing the token.aOauthToken- TheOauthTokencontaining the required information.
-
OauthTokenHandler
public OauthTokenHandler(org.refcodes.net.Url aUrl, HttpRestClient aHttpRestClient, org.refcodes.net.OauthToken aOauthToken)Constructs an instance of theOauthTokenHandlerwith the given parameters.- Parameters:
aUrl- TheUrlto be used when refreshing the access token.aHttpRestClient- TheHttpRestClientto use when refreshing the token.aOauthToken- TheOauthTokencontaining the required information.
-
OauthTokenHandler
public OauthTokenHandler(java.lang.String aUrl, HttpRestClient aHttpRestClient, java.lang.String aAccessToken, java.lang.String aRefreshToken, java.lang.String aTokenType, java.lang.Integer aExpiresIn, java.lang.String aScope)Constructs an instance of theOauthTokenHandlerwith the given parameters. For the refresh token parameters, please refer to "https://www.oauth.com/oauth2-servers/access-tokens/refreshing-access-tokens".- Parameters:
aUrl- TheUrlto be used when refreshing the access token.aHttpRestClient- TheHttpRestClientto use when refreshing the token.aAccessToken- The access token to be stored (as ofOauthTokenImpl.getAccessToken()).aRefreshToken- The refresh token to be used (as ofOauthTokenImpl.getRefreshToken()).aTokenType- The token type to be stored (as ofOauthTokenImpl.getTokenType()).aExpiresIn- The "expires in" time to be stored (as ofOauthTokenImpl.getExpiresIn()).aScope- The scope to be stored (as ofOauthTokenImpl.getScope()).
-
-