10Duke Scale C++ Client
Loading...
Searching...
No Matches
tenduke::oauth::OAuthBrowserAuthorizationRequest Class Referenceabstract

#include <OAuthBrowserAuthorizationRequest.h>

Detailed Description

OAuth-request to handle OAuth authorization using browser.

This interface does not actually contain any browser integration, but provides the hooks for browser integration.

Inheritance diagram for tenduke::oauth::OAuthBrowserAuthorizationRequest:
tenduke::oauth::OAuthAuthorizationRequest tenduke::oauth::pkce::OAuthPKCERequest tenduke::test::mocks::OAuthBrowserAuthorizationRequestMock

Public Member Functions

virtual std::string buildAuthorizationRequestUrl () const =0
 Creates the initial authorization request URL.
 
virtual std::unique_ptr< OAuthStatehandleCallback (const std::string &redirectURI) const =0
 Handles callback: performs consequent actions to authorize.
 

Member Function Documentation

◆ buildAuthorizationRequestUrl()

virtual std::string tenduke::oauth::OAuthBrowserAuthorizationRequest::buildAuthorizationRequestUrl ( ) const
pure virtual

Creates the initial authorization request URL.

Navigate browser to this URL.

Implemented in tenduke::oauth::pkce::OAuthPKCERequest.

◆ handleCallback()

virtual std::unique_ptr< OAuthState > tenduke::oauth::OAuthBrowserAuthorizationRequest::handleCallback ( const std::string &  redirectURI) const
pure virtual

Handles callback: performs consequent actions to authorize.

In the flow, the OAuth-server signals success or error by navigating (using HTTP-redirect) to configured redirect-URI. You must listen the browser events to detect, when the redirect-URI is navigated to. Once you detect navigation to the redirect-URI, call this method with the complete redirect-URI.

The call is synchronous.

Parameters
redirectURI-
Returns
the OAuth-state
Exceptions
std::nested_exceptionwhen the there is some nested cause
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)
tenduke::json::JSONParsingExceptionwhen server response is not valid JSON
tenduke::oauth::OAuthExceptionwhen the server response is not what we expected, e.g.
  • problems with the redirect-URI (missing or invalid "state", missing "code")
  • The token response does not contain access_token
  • The token response payload is not JSON-object
tenduke::oauth::OAuthServerErrorwhen the server responds with an error
tenduke::net::NetworkingException(or subclasses of it) when networking error occurred, e.g.
tenduke::net::URLExceptionif problem parsing the redirectURI (should not happen, though)
tenduke::net::MalformedURLExceptionif the redirectURI is invalid

Implemented in tenduke::oauth::pkce::OAuthPKCERequest.


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