1#ifndef TENDUKE_OAUTH_DEVICE_DEFAULTOAUTHDEVICEFLOWAUTHORIZATIONREQUEST_H
2#define TENDUKE_OAUTH_DEVICE_DEFAULTOAUTHDEVICEFLOWAUTHORIZATIONREQUEST_H
4#include "./OAuthDeviceFlowAuthorizationRequest.h"
5#include "./DeviceAuthorizationResponse.h"
6#include "oauth/OAuthConfiguration.h"
7#include "oauth/OAuthState.h"
9#include "http/HTTPClient.h"
10#include "http/HTTPResponseToException.h"
11#include "json/JSONParser.h"
12#include "time/Clock.h"
15#include <condition_variable>
44 const std::map<std::string, std::string> &additionalParameters,
45 std::uint64_t timeoutS,
46 const std::shared_ptr<const tenduke::oauth::OAuthConfiguration> &configuration,
47 const std::shared_ptr<tenduke::time::Clock> &clock,
48 const std::shared_ptr<const tenduke::http::HTTPClient> &httpClient,
49 const std::shared_ptr<const tenduke::http::HTTPResponseToException> &throwException,
50 const std::shared_ptr<const tenduke::json::JSONParser> &jsonParser
64 virtual void sleepFor(std::chrono::milliseconds slumbertime);
68 void throwIfCanceled(
const std::string &where)
const;
70 const std::string scope;
71 const std::map<std::string, std::string> additionalParameters;
72 const std::uint64_t timeoutS;
76 mutable std::mutex cancelMutex;
77 std::condition_variable cancelSignal;
81 std::unique_ptr<tenduke::oauth::device::DeviceAuthorizationResponse> response;
83 const std::shared_ptr<const tenduke::oauth::OAuthConfiguration> configuration;
84 const std::shared_ptr<tenduke::time::Clock> clock;
85 const std::shared_ptr<const tenduke::http::HTTPClient> http;
86 const std::shared_ptr<const tenduke::http::HTTPResponseToException> throwException;
87 const std::shared_ptr<const tenduke::json::JSONParser> parseJSON;
DefaultOAuthDeviceFlowAuthorizationRequest(std::string scope, const std::map< std::string, std::string > &additionalParameters, std::uint64_t timeoutS, const std::shared_ptr< const tenduke::oauth::OAuthConfiguration > &configuration, const std::shared_ptr< tenduke::time::Clock > &clock, const std::shared_ptr< const tenduke::http::HTTPClient > &httpClient, const std::shared_ptr< const tenduke::http::HTTPResponseToException > &throwException, const std::shared_ptr< const tenduke::json::JSONParser > &jsonParser)
Constructs new instance.
Definition DefaultOAuthDeviceFlowAuthorizationRequest.cpp:345
DefaultOAuthDeviceFlowAuthorizationRequest(std::string scope, const std::map< std::string, std::string > &additionalParameters, std::uint64_t timeoutS, const std::shared_ptr< const tenduke::oauth::OAuthConfiguration > &configuration, const std::shared_ptr< tenduke::time::Clock > &clock, const std::shared_ptr< const tenduke::http::HTTPClient > &httpClient, const std::shared_ptr< const tenduke::http::HTTPResponseToException > &throwException, const std::shared_ptr< const tenduke::json::JSONParser > &jsonParser)
Constructs new instance.
Definition DefaultOAuthDeviceFlowAuthorizationRequest.cpp:345
virtual void sleepFor(std::chrono::milliseconds slumbertime)
Sleeps for given time, or until cancel() is called.
Definition DefaultOAuthDeviceFlowAuthorizationRequest.cpp:329
tenduke::oauth::device::DeviceAuthorizationResponse authorizationRequest() override
Performs Device Authorization Request.
Definition DefaultOAuthDeviceFlowAuthorizationRequest.cpp:174
std::unique_ptr< tenduke::oauth::OAuthState > accessTokenRequest() override
Performs Device Access Token Request.
Definition DefaultOAuthDeviceFlowAuthorizationRequest.cpp:238
void cancel() override
Marks the request canceled.
Definition DefaultOAuthDeviceFlowAuthorizationRequest.cpp:320
Device Authorization Response.
Definition DeviceAuthorizationResponse.h:23
Authorization request for OAuth Device Flow.
Definition OAuthDeviceFlowAuthorizationRequest.h:23
Implementation of OAuth device flow.
Definition DefaultOAuthDeviceFlow.h:18
OAuth services.
Definition AccessTokenRequestAuthenticator.h:8
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4