1#ifndef TENDUKE_OAUTH_OAUTHSTATESERVICEIMPL_H
2#define TENDUKE_OAUTH_OAUTHSTATESERVICEIMPL_H
4#include "./OAuthStateService.h"
5#include "./OAuthTokenRequest.h"
6#include "./OAuthConfiguration.h"
8#include "http/HTTPClient.h"
9#include "json/JSONParser.h"
10#include "time/Clock.h"
37 std::string accessToken,
38 std::string refreshToken,
41 std::map<std::string, std::string> additionalProperties,
42 std::shared_ptr<const OAuthConfiguration> config,
43 std::shared_ptr<const tenduke::http::HTTPClient> httpClient,
44 std::shared_ptr<const tenduke::json::JSONParser> jsonParser,
45 std::shared_ptr< tenduke::time::Clock> clock
46 ) : accessToken(std::move(accessToken)), refreshToken(std::move(refreshToken)), expiresAt(expiresAt), infinite(infinite),
47 additionalProperties(std::move(additionalProperties)), config(std::move(config)), http(std::move(httpClient)),
48 parseJSON(std::move(jsonParser)), clock(std::move(clock))
63 std::string accessToken,
64 std::string refreshToken,
66 std::map<std::string, std::string> additionalProperties,
67 std::shared_ptr<const OAuthConfiguration> config,
68 std::shared_ptr<const tenduke::http::HTTPClient> httpClient,
69 std::shared_ptr<const tenduke::json::JSONParser> jsonParser,
70 std::shared_ptr< tenduke::time::Clock> clock
72 (expiresAt ==
tenduke::
oauth::TOKEN_DOES_NOT_EXPIRE), std::move(additionalProperties), std::move(config),
73 std::move(httpClient), std::move(jsonParser), std::move(clock))
101 std::string accessToken;
102 std::string refreshToken;
106 std::map<std::string, std::string> additionalProperties;
108 const std::shared_ptr<const OAuthConfiguration> config;
109 const std::shared_ptr<const tenduke::http::HTTPClient> http;
110 const std::shared_ptr<const tenduke::json::JSONParser> parseJSON;
111 const std::shared_ptr<tenduke::time::Clock> clock;
Default implementation of tenduke::oauth::OAuthStateService.
Definition OAuthStateServiceImpl.h:22
virtual std::map< std::string, std::string > buildRefreshRequestParameters() const
Builds parameters for refresh-request.
Definition OAuthStateServiceImpl.cpp:51
bool hasAccessToken() const override
Returns true if the state contains an access token.
Definition OAuthStateServiceImpl.h:81
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.
Definition OAuthStateServiceImpl.h:62
const std::string & getAccessToken() const override
Returns the access token.
Definition OAuthStateServiceImpl.h:77
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.
Definition OAuthStateServiceImpl.h:36
virtual std::unique_ptr< OAuthTokenRequest > createRefreshTokenRequest() const
Creates refresh-token request.
Definition OAuthStateServiceImpl.cpp:38
const std::string * getAdditionalProperty(const std::string &name) const override
Returns additional property returned by the server.
Definition OAuthStateServiceImpl.cpp:10
bool doesExpire() const override
Returns true if the access token expires.
Definition OAuthStateServiceImpl.h:82
int64_t getExpiresAt() const override
Returns timestamp (as epoch seconds) when the current access token expires.
Definition OAuthStateServiceImpl.h:79
bool isRefreshable() const override
Returns true if the state is refreshable (i.e.
Definition OAuthStateServiceImpl.h:83
const std::string & getRefreshToken() const override
Returns the refresh token.
Definition OAuthStateServiceImpl.h:78
bool refresh() override
Refresh the state, i.e.
Definition OAuthStateServiceImpl.cpp:23
OAuth-state after successful authentication.
Definition OAuthStateService.h:17
OAuth services.
Definition AccessTokenRequestAuthenticator.h:8
Root for classes, functions and globals of 10Duke C++ Client.
Definition BackendConfiguration.h:7