10Duke Scale C++ Client
Loading...
Searching...
No Matches
tenduke::oauth::device::DefaultOAuthDeviceFlowAuthorizationRequest Class Reference

#include <DefaultOAuthDeviceFlowAuthorizationRequest.h>

Detailed Description

Inheritance diagram for tenduke::oauth::device::DefaultOAuthDeviceFlowAuthorizationRequest:
tenduke::oauth::device::OAuthDeviceFlowAuthorizationRequest tenduke::oauth::OAuthAuthorizationRequest tenduke::test::oauth::device::FakeRequest

Public Member Functions

 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.
 
tenduke::oauth::device::DeviceAuthorizationResponse authorizationRequest () override
 Performs Device Authorization Request.
 
std::unique_ptr< tenduke::oauth::OAuthStateaccessTokenRequest () override
 Performs Device Access Token Request.
 
void cancel () override
 Marks the request canceled.
 

Protected Member Functions

virtual void sleepFor (std::chrono::milliseconds slumbertime)
 Sleeps for given time.
 

Constructor & Destructor Documentation

◆ DefaultOAuthDeviceFlowAuthorizationRequest()

tenduke::oauth::device::DefaultOAuthDeviceFlowAuthorizationRequest::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.

Parameters
scope-
additionalParameters-
timeoutStimeout (in seconds) at the client end
configuration-
clock-
httpClient-
throwException-
jsonParser-

Member Function Documentation

◆ accessTokenRequest()

std::unique_ptr<::OAuthState > tenduke::oauth::device::DefaultOAuthDeviceFlowAuthorizationRequest::accessTokenRequest ( )
overridevirtual

Performs Device Access Token Request.

See: https://datatracker.ietf.org/doc/html/rfc8628#section-3.4

Returns
the OAuth state
Exceptions
tenduke::Canceledif the request was canceled by caller
tenduke::TimedOutif the request has timed out (either in client or by backend)
tenduke::http::HTTPException(or subclasses) in case of HTTPExceptions (e.g. HTTP 500)
tenduke::json::JSONException(or subclasses) in case response is not valid JSON (should not happen)
tenduke::net::NetworkingException(or subclasses) e.g. no network, invalid hostname, timeouts
tenduke::oauth::OAuthServerErrorif OAuth server returned an error
tenduke::oauth::OAuthExceptionif some other OAuth error occurred

Implements tenduke::oauth::device::OAuthDeviceFlowAuthorizationRequest.

◆ authorizationRequest()

DeviceAuthorizationResponse tenduke::oauth::device::DefaultOAuthDeviceFlowAuthorizationRequest::authorizationRequest ( )
overridevirtual

Performs Device Authorization Request.

See: https://datatracker.ietf.org/doc/html/rfc8628#section-3.1

Returns
the Device Authorization Response (see https://datatracker.ietf.org/doc/html/rfc8628#section-3.2)
Exceptions
tenduke::TimedOutif the request has timed out (either in client or by backend)
tenduke::http::HTTPException(or subclasses) in case of HTTPExceptions (e.g. HTTP 500)
tenduke::net::NetworkingException(or subclasses) e.g. no network, invalid hostname, timeouts
tenduke::oauth::OAuthServerErrorif OAuth server returned an error
tenduke::oauth::OAuthExceptionif some other OAuth error occurred

Implements tenduke::oauth::device::OAuthDeviceFlowAuthorizationRequest.

◆ cancel()

void tenduke::oauth::device::DefaultOAuthDeviceFlowAuthorizationRequest::cancel ( )
overridevirtual

Marks the request canceled.

This will cause the polling to throw tenduke::TimedOut.

Implements tenduke::oauth::device::OAuthDeviceFlowAuthorizationRequest.

◆ sleepFor()

void tenduke::oauth::device::DefaultOAuthDeviceFlowAuthorizationRequest::sleepFor ( std::chrono::milliseconds  slumbertime)
protectedvirtual

Sleeps for given time.

Parameters
slumbertime-

Reimplemented in tenduke::test::oauth::device::FakeRequest.


The documentation for this class was generated from the following files: