|
cxxmcp 1.1.6
C++ MCP SDK
|
High-level OAuth 2.1 client orchestrator. More...
#include <client_orchestrator.hpp>
Public Member Functions | |
| OAuthClientOrchestrator (OAuthClientOrchestratorConfig config, OAuthClientCallback &callback, OAuthMetadataEndpoint &metadata_endpoint, OAuthTokenEndpoint &token_endpoint, PkceGenerator &pkce_generator, OAuthClientRegistrationEndpoint *registration_endpoint=nullptr) | |
| Construct an orchestrator with all required dependencies. | |
| core::Result< TokenSet > | authorize () |
| Execute the full OAuth authorization flow. | |
| core::Result< std::string > | get_access_token () |
| Get a valid access token, refreshing if necessary. | |
| core::Result< OAuthRefreshRetryResult > | handle_auth_response (const HttpResponseMetadata &response) |
| Handle a 401/403 response and attempt recovery. | |
| OAuthLifecycleState | lifecycle_state () const |
| Get the current lifecycle state. | |
| const OAuthClientConfig & | client_config () const |
| Get the current client configuration. | |
| const std::optional< AuthorizationServerMetadata > & | metadata () const |
| Get the discovered authorization server metadata. | |
| const std::optional< ProtectedResourceMetadata > & | protected_resource_metadata () const |
| Get the discovered protected resource metadata. | |
High-level OAuth 2.1 client orchestrator.
Wraps AuthorizationManager with the missing orchestration steps:
All network I/O is injected via OAuthMetadataEndpoint, OAuthTokenEndpoint, and optionally OAuthClientRegistrationEndpoint. User interaction is injected via OAuthClientCallback.
|
inline |
Construct an orchestrator with all required dependencies.
| config | Orchestrator configuration (resource URL, scopes, etc.) |
| callback | Application callback for presenting auth URL and receiving the authorization code. |
| metadata_endpoint | Network boundary for metadata discovery. |
| token_endpoint | Network boundary for token exchange/refresh. |
| pkce_generator | PKCE challenge generator (OpenSslPkceGenerator). |
| registration_endpoint | Optional DCR endpoint. When null, the client_id must be pre-configured. |
|
inline |
Execute the full OAuth authorization flow.
Discovers metadata, registers the client (if needed), presents the authorization URL, waits for the callback, and exchanges the code for tokens. After this call, get_access_token() returns a valid bearer token.
|
inline |
Get a valid access token, refreshing if necessary.
Must be called after a successful authorize() call.
|
inline |
Handle a 401/403 response and attempt recovery.
Analyzes the WWW-Authenticate header and attempts token refresh or scope upgrade if appropriate.
| response | The HTTP response metadata (status code + headers). |