cxxmcp 1.1.6
C++ MCP SDK
Loading...
Searching...
No Matches
server_auth_provider.hpp
Go to the documentation of this file.
1// Copyright (c) 2025 [caomengxuan666]
2
3#pragma once
4
5#include <utility>
6
12
15
16namespace mcp::auth::openssl {
17
21 public:
23 DpopReplayCache* replay_cache = nullptr,
24 DpopAuthProviderOptions auth_options = {},
25 OpenSslDpopVerifierOptions dpop_options = {})
26 : jwt_verifier_(std::move(jwks)),
27 dpop_verifier_(std::move(dpop_options)),
28 provider_(jwt_verifier_, dpop_verifier_, dpop_access_token_hash,
29 replay_cache, std::move(auth_options)) {}
30
32 const server::AuthRequest& request) override {
33 return provider_.authenticate(request);
34 }
35
36 private:
37 StaticJwksJwtVerifier jwt_verifier_;
38 OpenSslDpopVerifier dpop_verifier_;
39 DpopBearerAuthProvider provider_;
40};
41
45 public:
47 JwksEndpoint& endpoint, JwksCache* cache,
49 DpopReplayCache* replay_cache = nullptr,
50 DpopAuthProviderOptions auth_options = {},
51 OpenSslDpopVerifierOptions dpop_options = {})
52 : jwt_verifier_(endpoint, cache, std::move(jwks_options)),
53 dpop_verifier_(std::move(dpop_options)),
54 provider_(jwt_verifier_, dpop_verifier_, dpop_access_token_hash,
55 replay_cache, std::move(auth_options)) {}
56
58 const server::AuthRequest& request) override {
59 return provider_.authenticate(request);
60 }
61
62 private:
63 FetchingJwksJwtVerifier jwt_verifier_;
64 OpenSslDpopVerifier dpop_verifier_;
65 DpopBearerAuthProvider provider_;
66};
67
68} // namespace mcp::auth::openssl
Server AuthProvider backed by injected JWT and DPoP verifiers.
Definition server_auth_provider.hpp:93
core::Result< server::AuthIdentity > authenticate(const server::AuthRequest &request) override
Authenticate a transport request.
Definition server_auth_provider.hpp:108
Replay cache boundary used by DPoP proof validators.
Definition dpop.hpp:138
Application-provided JWKS cache boundary.
Definition jwks.hpp:69
Application-provided JWKS retrieval boundary.
Definition jwks.hpp:60
Owns fetching-JWKS JWT verification plus OpenSSL DPoP proof verification for server deployments.
Definition server_auth_provider.hpp:44
core::Result< server::AuthIdentity > authenticate(const server::AuthRequest &request) override
Authenticate a transport request.
Definition server_auth_provider.hpp:57
JWT verifier that fetches and caches JWKS through injected SDK boundaries.
Definition jwt.hpp:304
Owns static-JWKS JWT verification plus OpenSSL DPoP proof verification for server deployments.
Definition server_auth_provider.hpp:20
core::Result< server::AuthIdentity > authenticate(const server::AuthRequest &request) override
Authenticate a transport request.
Definition server_auth_provider.hpp:31
Abstract authentication provider used by server integrations.
Definition auth.hpp:117
OpenSSL-backed JWT verification over a trusted JWKS value.
OpenSSL-backed DPoP proof signing and verification helpers.
Shared result and error primitives used by the public cxxmcp SDK.
tl::expected< T, Error > Result
Alias for the SDK result type.
Definition result.hpp:64
Authentication extension points for server transports.
Optional bridge from auth verifiers to server AuthProvider.
core::Result< std::string > dpop_access_token_hash(std::string_view access_token)
Compute the RFC 9449 DPoP ath value for an access token.
Definition sha256.hpp:29
Options for DPoP-aware server authentication over verified tokens.
Definition server_auth_provider.hpp:79
JSON Web Key Set value model.
Definition jwks.hpp:40
Transport-neutral authentication input.
Definition auth.hpp:91