Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
Loading...
Searching...
No Matches
orbit::middleware::JwtOptions Struct Reference

Verification settings for jwt_auth(). Configure at least one key: secret, public_key_pem or jwks_url (several may be combined). More...

#include <JwtAuth.hpp>

Public Attributes

std::string secret
 
std::string public_key_pem
 
std::string jwks_url
 
std::chrono::seconds jwks_refresh {3600}
 Refetch the key set at least this often.
 
std::chrono::seconds jwks_min_refetch {30}
 Minimum gap between fetches (bounds load from bogus kids)
 
std::chrono::seconds jwks_timeout {5}
 Timeout for one JWKS request.
 
std::string issuer
 If set, the "iss" claim must equal it.
 
std::string audience
 If set, "aud" (string or array) must contain it.
 
bool require_exp = false
 Reject tokens without an "exp" claim.
 
std::chrono::seconds leeway {0}
 Clock skew tolerated for "exp" and "nbf".
 

Detailed Description

Verification settings for jwt_auth(). Configure at least one key: secret, public_key_pem or jwks_url (several may be combined).

Member Data Documentation

◆ audience

std::string orbit::middleware::JwtOptions::audience

If set, "aud" (string or array) must contain it.

◆ issuer

std::string orbit::middleware::JwtOptions::issuer

If set, the "iss" claim must equal it.

◆ jwks_min_refetch

std::chrono::seconds orbit::middleware::JwtOptions::jwks_min_refetch {30}

Minimum gap between fetches (bounds load from bogus kids)

◆ jwks_refresh

std::chrono::seconds orbit::middleware::JwtOptions::jwks_refresh {3600}

Refetch the key set at least this often.

◆ jwks_timeout

std::chrono::seconds orbit::middleware::JwtOptions::jwks_timeout {5}

Timeout for one JWKS request.

◆ jwks_url

std::string orbit::middleware::JwtOptions::jwks_url

RS256/ES256 keys published as a JSON Web Key Set, e.g. "https://issuer.example.com/.well-known/jwks.json". The token's "kid" selects the key; an unknown kid triggers a refetch (key rotation).

◆ leeway

std::chrono::seconds orbit::middleware::JwtOptions::leeway {0}

Clock skew tolerated for "exp" and "nbf".

◆ public_key_pem

std::string orbit::middleware::JwtOptions::public_key_pem

RS256 or ES256: a PEM public key ("-----BEGIN PUBLIC KEY-----"). The key type decides the algorithm: RSA (>= 2048 bits) means RS256, EC P-256 means ES256.

◆ require_exp

bool orbit::middleware::JwtOptions::require_exp = false

Reject tokens without an "exp" claim.

◆ secret

std::string orbit::middleware::JwtOptions::secret

HS256: HMAC-SHA256 key


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