|
10Duke Enterprise C++ Client
|
#include <OAuthStateServiceImpl.h>
Default implementation of tenduke::oauth::OAuthStateService.
Public Member Functions | |
| OAuthStateServiceImpl (std::string accessToken, std::string refreshToken, int64_t expiresAt, bool infinite, std::map< std::string, std::string > additionalProperties, std::shared_ptr< const OAuthConfiguration > config, std::shared_ptr< const tenduke::http::HTTPClient > httpClient, std::shared_ptr< const tenduke::json::JSONParser > jsonParser, std::shared_ptr< tenduke::time::Clock > clock) | |
| Constructs new instance. | |
| OAuthStateServiceImpl (std::string accessToken, std::string refreshToken, int64_t expiresAt, std::map< std::string, std::string > additionalProperties, std::shared_ptr< const OAuthConfiguration > config, std::shared_ptr< const tenduke::http::HTTPClient > httpClient, std::shared_ptr< const tenduke::json::JSONParser > jsonParser, std::shared_ptr< tenduke::time::Clock > clock) | |
| Constructs new instance. | |
| const std::string & | getAccessToken () const override |
| Returns the access token. | |
| const std::string & | getRefreshToken () const override |
| Returns the refresh token. | |
| int64_t | getExpiresAt () const override |
| Returns timestamp (as epoch seconds) when the current access token expires. | |
| const std::string * | getAdditionalProperty (const std::string &name) const override |
| Returns additional property returned by the server. | |
| bool | hasAccessToken () const override |
Returns true if the state contains an access token. | |
| bool | doesExpire () const override |
Returns true if the access token expires. | |
| bool | isRefreshable () const override |
Returns true if the state is refreshable (i.e. | |
| bool | refresh () override |
| Refresh the state, i.e. | |
Public Member Functions inherited from tenduke::oauth::OAuthState | |
| virtual const std::map< std::string, std::string > & | getAdditionalProperties () const =0 |
| Returns all additional properties returned by the server. | |
| virtual bool | hasAdditionalProperty (const std::string &name) const =0 |
| Checks if the state has additional property. | |
| virtual void | removeAdditionalProperty (const std::string &propertyName)=0 |
| Removes given additional property. | |
| virtual void | setAccessToken (const std::string &newAccessToken)=0 |
| Set the access token. | |
| virtual void | setExpiresAt (std::int64_t newExpiresAt)=0 |
| Set the "expires at". | |
| virtual void | setRefreshToken (const std::string &newRefreshToken)=0 |
| Set the refresh token. | |
| virtual void | refreshFrom (const OAuthState &state)=0 |
| Refreshes the state from another state, This is called after refreshing the state with the service. | |
Protected Member Functions | |
| virtual std::map< std::string, std::string > | buildRefreshRequestParameters () const |
| Builds parameters for refresh-request. | |
| virtual std::unique_ptr< OAuthTokenRequest > | createRefreshTokenRequest () const |
| Creates refresh-token request. | |
|
inline |
Constructs new instance.
| accessToken | - |
| refreshToken | - |
| expiresAt | - |
| infinite | - |
| additionalProperties | - |
| config | - |
| httpClient | - |
| jsonParser | - |
| clock | - |
|
inline |
Constructs new instance.
| accessToken | - |
| refreshToken | - |
| expiresAt | - |
| additionalProperties | - |
| config | - |
| httpClient | - |
| jsonParser | - |
| clock | - |
|
protectedvirtual |
Builds parameters for refresh-request.
|
protectedvirtual |
Creates refresh-token request.
|
inlineoverridevirtual |
Returns true if the access token expires.
Returns false if the access token does not expire.
Implements tenduke::oauth::OAuthState.
|
inlineoverridevirtual |
Returns the access token.
Implements tenduke::oauth::OAuthState.
|
overridevirtual |
Returns additional property returned by the server.
| name | property name |
Implements tenduke::oauth::OAuthState.
|
inlineoverridevirtual |
Returns timestamp (as epoch seconds) when the current access token expires.
Implements tenduke::oauth::OAuthState.
|
inlineoverridevirtual |
Returns the refresh token.
Implements tenduke::oauth::OAuthState.
|
inlineoverridevirtual |
Returns true if the state contains an access token.
(Uninitialized states do not contain access token).
Implements tenduke::oauth::OAuthState.
|
inlineoverridevirtual |
Returns true if the state is refreshable (i.e.
it contains refresh-token).
Implements tenduke::oauth::OAuthState.
|
overridevirtual |
Refresh the state, i.e.
requests new access token. The refresh is done synchronously.
true if refreshed. Returns false if nothing was done (because the state does not contain refresh token).| tenduke::oauth::OAuthServerException | when the server responds with an error |
| tenduke::oauth::OAuthException | when the server response is not what we expected, e.g.
|
| tenduke::json::JSONParsingException | when response is not valid JSON |
| tenduke::net::NetworkingException | (or subclasses of it) when networking error occurred, e.g.
|
| tenduke::http::HTTPException | (or subclasses of it) when the server responds with HTTP error status code which does not indicate OAuth-error, e.g. 500 (internal server error) or 404 (not found = wrong endpoint configured). |
Implements tenduke::oauth::OAuthStateService.