|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
Mints signed bearer tokens from claims using a shared secret. More...
#include <session_auth.hpp>
Public Member Functions | |
| TokenIssuer (std::string secret, MacFunction mac=hmacSha256) | |
Constructs an issuer over secret using mac. | |
| std::string | issue (const SessionToken &claims) const |
Serialises claims and returns a signed token string. | |
Mints signed bearer tokens from claims using a shared secret.
Wire format: base64url(claimsJson) "." base64url(mac(secret, payload)).
Definition at line 379 of file session_auth.hpp.
|
inlineexplicit |
Constructs an issuer over secret using mac.
| secret | Shared secret (same value the verifier uses). |
| mac | MAC primitive; defaults to hmacSha256. Stored and invoked for this issuer's whole lifetime, so anything the callable refers to must outlive the issuer. |
Definition at line 401 of file session_auth.hpp.
|
inlinenodiscard |
Serialises claims and returns a signed token string.
Writes with detail::EscapingWriteOpts so a raw ASCII control byte in principal/roles round-trips through TokenVerifier::verify instead of producing invalid JSON (or, alongside an escaped \\endiskip/", silently corrupted JSON) — see that struct's doc comment.
| claims | Claims to embed and sign. |
| TokenIssuanceError | on encode failure (see detail::throwOnGlazeError for why this is not realistically reachable for SessionToken). |
Definition at line 415 of file session_auth.hpp.