cesium-native 0.46.0
Loading...
Searching...
No Matches
CesiumClientCommon::OAuth2PKCE Class Reference

Class for authenticating with an API that uses OAuth2 Proof of Key Code Exchange (PKCE). More...

#include <CesiumClientCommon/OAuth2PKCE.h>

Static Public Member Functions

static CesiumAsync::Future< CesiumUtility::Result< OAuth2TokenResponse > > authorize (const CesiumAsync::AsyncSystem &asyncSystem, const std::shared_ptr< CesiumAsync::IAssetAccessor > &pAssetAccessor, const std::string &friendlyApplicationName, const OAuth2ClientOptions &clientOptions, const std::vector< std::string > &scopes, std::function< void(const std::string &)> &&openUrlCallback, const std::string &tokenEndpointUrl, const std::string &authorizeBaseUrl)
 Initiates the OAuth2 PKCE authentication process.
 
static CesiumAsync::Future< CesiumUtility::Result< OAuth2TokenResponse > > refresh (const CesiumAsync::AsyncSystem &asyncSystem, const std::shared_ptr< CesiumAsync::IAssetAccessor > &pAssetAccessor, const OAuth2ClientOptions &clientOptions, const std::string &refreshBaseUrl, const std::string &refreshToken)
 Attempts to obtain new access and refresh tokens using a refresh token obtained from a previous call to authorize.
 

Detailed Description

Class for authenticating with an API that uses OAuth2 Proof of Key Code Exchange (PKCE).

For more information:

Definition at line 78 of file OAuth2PKCE.h.

Member Function Documentation

◆ authorize()

static CesiumAsync::Future< CesiumUtility::Result< OAuth2TokenResponse > > CesiumClientCommon::OAuth2PKCE::authorize ( const CesiumAsync::AsyncSystem & asyncSystem,
const std::shared_ptr< CesiumAsync::IAssetAccessor > & pAssetAccessor,
const std::string & friendlyApplicationName,
const OAuth2ClientOptions & clientOptions,
const std::vector< std::string > & scopes,
std::function< void(const std::string &)> && openUrlCallback,
const std::string & tokenEndpointUrl,
const std::string & authorizeBaseUrl )
static

Initiates the OAuth2 PKCE authentication process.

This will start an internal HTTP server to listen on the redirect URI for a response from the authorization endpoint. This HTTP is not currently shutdown until the user visits this redirect URI.

Parameters
asyncSystemThe CesiumAsync::AsyncSystem to use.
pAssetAccessorThe CesiumAsync::IAssetAccessor to use for API requests.
friendlyApplicationNameThe name of the application that will be displayed to the user in status messages from the internal HTTP server.
clientOptionsOptions to configure the OAuth2 authentication process.
scopesA set of scopes that the token obtained from the authentication process will have access to.
openUrlCallbackA callback that will be called with the created redirect URI after the internal server has been created. This callback should either present the URL to the user or open the URL in a web browser.
tokenEndpointUrlThe endpoint that will be requested to attempt to obtain an access token after the code has been acquired from the redirect URI.
authorizeBaseUrlThe base URL of the page the user will be prompted to open to confirm the authorization attempt.
Returns
A Future returning a Result containing either a OAuth2TokenResponse or error messages.

◆ refresh()

static CesiumAsync::Future< CesiumUtility::Result< OAuth2TokenResponse > > CesiumClientCommon::OAuth2PKCE::refresh ( const CesiumAsync::AsyncSystem & asyncSystem,
const std::shared_ptr< CesiumAsync::IAssetAccessor > & pAssetAccessor,
const OAuth2ClientOptions & clientOptions,
const std::string & refreshBaseUrl,
const std::string & refreshToken )
static

Attempts to obtain new access and refresh tokens using a refresh token obtained from a previous call to authorize.

Parameters
asyncSystemThe CesiumAsync::AsyncSystem to use.
pAssetAccessorThe CesiumAsync::IAssetAccessor to use for API requests.
clientOptionsOptions to configure the OAuth2 authentication process.
refreshBaseUrlThe base URL of the endpoint that will be requested to attempt to obtain new access and refresh tokens.
refreshTokenThe refresh token.
Returns
A Future returning a Result containing either a OAuth2TokenResponse or error messages.

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