10Duke Scale C++ Client
Loading...
Searching...
No Matches
tenduke::oidc::osbrowser::OIDCLoginWithLoopbackRedirection Class Reference

#include <OIDCLoginWithLoopbackRedirection.h>

Detailed Description

An implementation of tenduke::sso::OIDCLogin using external browser (the OS default browser) and with "Loopback Interface Redirection" (see https://www.rfc-editor.org/rfc/rfc8252#section-7.3).

In terms of user-experience, this flow is quite obtrusive, but is relatively easy to implement in platform-independent manner. It also has the benefit of not including embedded browser, which might increase the footprint of application noticeably (and embedded browsers are not recommended nowadays, for several reasons).

This flow first starts lightweight local HTTP-server. Then the default OS browser is opened with the URL to start the login. Once the execute succeeds (or fails), the backend sends "redirect"-response to the browser. In this case, the redirect points to an HTTP URL with localhost, e.g. "http://localhost:9999/callback". The browser receives the redirect response and navigates to the URL. The local HTTP server is listening this URL and then notifies the application of the success (or failure). Finally the HTTP-server is shutdown.

Inheritance diagram for tenduke::oidc::osbrowser::OIDCLoginWithLoopbackRedirection:
tenduke::oidc::OIDCLogin

Public Member Functions

 OIDCLoginWithLoopbackRedirection (const tenduke::oauth::OAuthConfiguration &oauthConfiguration, const std::shared_ptr< const tenduke::oidc::OIDCConfiguration > &oidcConfiguration, std::string scope, const std::shared_ptr< const tenduke::oidc::OIDCClientFactory > &oidcClientFactory, const std::shared_ptr< const tenduke::net::URLParser > &urlParser, const std::shared_ptr< const tenduke::osa::BrowserIntegration > &browser, const std::shared_ptr< const tenduke::http::server::HTTPServerFactory > &httpServerFactory, std::string responseMessage, std::uint16_t httpServerPort)
 Constructs new instance.
 
std::unique_ptr< tenduke::oidc::OIDCLoginRequestlogin () const override
 Starts the login process by creating a login request.
 

Protected Member Functions

virtual std::unique_ptr< tenduke::oauth::OAuthConfigurationtweakOAuthConfiguration (std::uint16_t port) const
 Creates new OAuthConfiguration by replacing port to the redirectURI.
 

Constructor & Destructor Documentation

◆ OIDCLoginWithLoopbackRedirection()

tenduke::oidc::osbrowser::OIDCLoginWithLoopbackRedirection::OIDCLoginWithLoopbackRedirection ( const tenduke::oauth::OAuthConfiguration oauthConfiguration,
const std::shared_ptr< const tenduke::oidc::OIDCConfiguration > &  oidcConfiguration,
std::string  scope,
const std::shared_ptr< const tenduke::oidc::OIDCClientFactory > &  oidcClientFactory,
const std::shared_ptr< const tenduke::net::URLParser > &  urlParser,
const std::shared_ptr< const tenduke::osa::BrowserIntegration > &  browser,
const std::shared_ptr< const tenduke::http::server::HTTPServerFactory > &  httpServerFactory,
std::string  responseMessage,
std::uint16_t  httpServerPort 
)

Constructs new instance.

Parameters
oauthConfiguration-
oidcConfiguration-
scope-
oidcClientFactory-
urlParser-
browser-
httpServerFactory-
responseMessage-
httpServerPort-

Member Function Documentation

◆ login()

std::unique_ptr< xdoidc::OIDCLoginRequest > tenduke::oidc::osbrowser::OIDCLoginWithLoopbackRedirection::login ( ) const
overridevirtual

Starts the login process by creating a login request.

Execute the login request to perform the login.

You can keep the login request to e.g. abort a long-running login.

Returns
login request.

Implements tenduke::oidc::OIDCLogin.

◆ tweakOAuthConfiguration()

std::unique_ptr< tenduke::oauth::OAuthConfiguration > tenduke::oidc::osbrowser::OIDCLoginWithLoopbackRedirection::tweakOAuthConfiguration ( std::uint16_t  port) const
protectedvirtual

Creates new OAuthConfiguration by replacing port to the redirectURI.

This is used in OOB-cases, where the redirect URI is being listened by a locally started HTTP-server.

Parameters
port-
Returns
-

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