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

#include <OAuthBrowserFlow.h>

Detailed Description

OAuth-client to initiate OAuth authorization flow.

The client creates an OAuthRequest, which handles the flow.

IMPORTANT NOTE: There is no browser integration provided, the implementors must bring their own browser. This is intentional to prevent large browser-dependency if the implementor wants to use another browser.

The OAuth-service works both with embedded browser and OS-browser. With embedded browser:

  1. open embedded browser
  2. call OAuthPKCEFlow::authorize() to create OAuthRequest
  3. call OAuthRequest::buildAuthorizationRequestUrl() to create URL
  4. navigate the embedded browser to the URL create in step #3
  5. listen navigations of the embedded browser. The OAuth-server performs series of page-navigations and on success (or failure) navigates (with HTTP-redirect) to configured redirect-URI. You must detect this navigation, which depends entirely on the embedded browser: Some browsers might provide a hook to get notified by navigation. In QT WebEngine, you can register custom URL-scheme and get notified when this custom scheme is navigated to.
  6. Once you detect that the redirect-URI is navigated to (e.g. via custom scheme), call OAuthRequest::handleCallback().
  7. The OAuthRequest::handleCallback() completes the flow and returns OAuthStateService.

Steps for OS-browser are similar, but OS-specific. In many cases application can register custom URL-scheme to the OS and use OS-calls to open the browser and navigate.

Inheritance diagram for tenduke::oauth::OAuthBrowserFlow:
tenduke::oauth::OAuthClient tenduke::oauth::pkce::OAuthPKCEFlow tenduke::test::mocks::OAuthBrowserFlowMock

Public Member Functions

virtual std::unique_ptr< const tenduke::oauth::OAuthBrowserAuthorizationRequestauthorize (const std::string &scopes) const =0
 Creates OAuthRequest to start the OAuth-authorization flow.
 
virtual std::unique_ptr< const tenduke::oauth::OAuthBrowserAuthorizationRequestauthorize (const std::string &scopes, const std::map< std::string, std::string > &additionalParameters) const =0
 Creates OAuthRequest to start the OAuth-authorization flow.
 
- Public Member Functions inherited from tenduke::oauth::OAuthClient
virtual std::unique_ptr< const tenduke::oauth::OAuthRefreshRequestrefresh (std::shared_ptr< tenduke::oauth::OAuthState > state) const =0
 Creates OAuthRefreshRequest for refreshing the state.
 

Member Function Documentation

◆ authorize() [1/2]

virtual std::unique_ptr< const tenduke::oauth::OAuthBrowserAuthorizationRequest > tenduke::oauth::OAuthBrowserFlow::authorize ( const std::string &  scopes) const
pure virtual

Creates OAuthRequest to start the OAuth-authorization flow.

Parameters
scopesscopes to authorize
Returns
the OAuth-request

Implemented in tenduke::oauth::pkce::OAuthPKCEFlow.

◆ authorize() [2/2]

virtual std::unique_ptr< const tenduke::oauth::OAuthBrowserAuthorizationRequest > tenduke::oauth::OAuthBrowserFlow::authorize ( const std::string &  scopes,
const std::map< std::string, std::string > &  additionalParameters 
) const
pure virtual

Creates OAuthRequest to start the OAuth-authorization flow.

Parameters
scopesscopes to authorize
additionalParametersadditional parameters for the request
Returns
the OAuth-request

Implemented in tenduke::oauth::pkce::OAuthPKCEFlow.


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