|
10Duke Enterprise C++ SDK
|
#include <OIDCLoginRequestWithLoopbackRedirection.h>
An implementation of tenduke::sso::OIDCLogin using an 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 a platform-independent manner. It also has the benefit of not including an embedded browser, which might increase the footprint of an application noticeably (and embedded browsers are not recommended nowadays, for several reasons).
This flow first starts a lightweight local HTTP server. Then the default OS browser is opened with the URL to start the login. Once the execution 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 to this URL and then notifies the application of the success (or failure). Finally, the HTTP server is shutdown.
Public Member Functions | |
| OIDCLoginRequestWithLoopbackRedirection (const std::shared_ptr< const ::tenduke::oidc::osbrowser::LoopbackRedirectionLoginParameters > ¶meters, uint32_t acceptTimeoutMs=250, uint32_t receiveTimeoutMs=250) | |
| Constructs a new instance. | |
| std::unique_ptr<::tenduke::oidc::OIDCState > | execute () override |
| Performs the login. | |
| void | abort () override |
| Aborts the login. | |
Protected Member Functions | |
| std::unique_ptr<::tenduke::oauth::OAuthConfiguration > | tweakOAuthConfiguration (std::uint16_t port) const |
| Creates a new OAuthConfiguration by replacing port to the redirectURI. | |
| tenduke::oidc::osbrowser::OIDCLoginRequestWithLoopbackRedirection::OIDCLoginRequestWithLoopbackRedirection | ( | const std::shared_ptr< const ::tenduke::oidc::osbrowser::LoopbackRedirectionLoginParameters > & | parameters, |
| uint32_t | acceptTimeoutMs = 250, | ||
| uint32_t | receiveTimeoutMs = 250 ) |
Constructs a new instance.
| parameters | login parameters |
| acceptTimeoutMs | timeout for socket accept calls in milliseconds |
| receiveTimeoutMs | timeout for socket receive calls in milliseconds |
|
overridevirtual |
Aborts the login.
This allows another thread to abort a dangling login process.
Implements tenduke::oidc::OIDCLoginRequest.
|
overridevirtual |
Performs the login.
Implements tenduke::oidc::OIDCLoginRequest.
|
protected |
Creates a new OAuthConfiguration by replacing port to the redirectURI.
This is used in OOB-cases, where the redirect URI is being listened to by a locally started HTTP server.
| port | the port number |