10Duke Scale C++ Client
All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
BaseOAuthClient.h
1#ifndef TENDUKE_OAUTH_BASEOAUTHCLIENT_H
2#define TENDUKE_OAUTH_BASEOAUTHCLIENT_H
3
4#include "./OAuthClient.h"
5#include "./OAuthConfiguration.h"
6
7#include "crypto/MessageDigestFactory.h"
8#include "http/HTTPClient.h"
9#include "json/JSONParser.h"
10#include "net/URLParser.h"
11#include "time/Clock.h"
12#include "utl/Base64Encoder.h"
13#include "utl/random/RandomURLSafeString.h"
14
15#include <cstddef>
16#include <map>
17#include <memory>
18#include <string>
19
20namespace tenduke { namespace oauth {
21
27{
28public:
37 std::shared_ptr<const tenduke::oauth::OAuthConfiguration> config,
38 std::shared_ptr<const tenduke::http::HTTPClient> httpClient,
39 std::shared_ptr<const tenduke::json::JSONParser> jsonParser,
40 std::shared_ptr<tenduke::time::Clock> clock
41 );
42
47 std::shared_ptr<const OAuthConfiguration> getConfiguration() const {return config;}
48
49 // tenduke::oauth::OAuthClient interface
50public:
51 std::unique_ptr<const tenduke::oauth::OAuthRefreshRequest> refresh(std::shared_ptr<tenduke::oauth::OAuthState> state) const override;
52
53protected:
55 const std::shared_ptr<const OAuthConfiguration> config;
57 const std::shared_ptr<const tenduke::http::HTTPClient> httpClient;
59 const std::shared_ptr<const tenduke::json::JSONParser> jsonParser;
61 const std::shared_ptr<tenduke::time::Clock> clock;
62};
63
64
65}}
66
67#endif // TENDUKE_OAUTH_BASEOAUTHCLIENT_H
Base class for OAuth-clients.
Definition BaseOAuthClient.h:27
const std::shared_ptr< const tenduke::json::JSONParser > jsonParser
For parsing responses.
Definition BaseOAuthClient.h:59
const std::shared_ptr< tenduke::time::Clock > clock
Clock to generate "expires-at" from "expires-in".
Definition BaseOAuthClient.h:61
std::shared_ptr< const OAuthConfiguration > getConfiguration() const
Returns the configuration of this client.
Definition BaseOAuthClient.h:47
BaseOAuthClient(std::shared_ptr< const tenduke::oauth::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 BaseOAuthClient.cpp:32
std::unique_ptr< const tenduke::oauth::OAuthRefreshRequest > refresh(std::shared_ptr< tenduke::oauth::OAuthState > state) const override
Creates OAuthRefreshRequest for refreshing the state.
Definition BaseOAuthClient.cpp:12
const std::shared_ptr< const tenduke::http::HTTPClient > httpClient
HTTP client.
Definition BaseOAuthClient.h:57
const std::shared_ptr< const OAuthConfiguration > config
OAuth configuration.
Definition BaseOAuthClient.h:55
OAuth-client to initiate OAuth authorization flow.
Definition OAuthClient.h:19
OAuth services.
Definition AccessTokenRequestAuthenticator.h:8
Root for classes, functions and globals of 10Duke C++ Client.
Definition BackendConfiguration.h:7