morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::session::Context Struct Reference

Per-call session context carried through the bridge to the model. More...

#include <session.hpp>

Public Attributes

std::string principal
 Auth principal (user id).
std::string token
 Bearer credential verified server-side (empty if unauthenticated).
std::string requestId
 Stable id used for distributed tracing / log correlation. Empty if unused.
std::string locale
 BCP-47 locale tag (e.g. en-US, fr-FR) for i18n. Empty for app default.
std::unordered_map< std::string, std::string > metadata
 Free-form bag of string→string metadata (feature flags, A/B buckets, …).

Detailed Description

Per-call session context carried through the bridge to the model.

Context is an open data bag: callers populate whichever fields make sense for the app (user identity, request tracing, locale, app-specific metadata). The framework only inspects principal and the action ids when consulting the configured IAuthorizer; everything else is passed through verbatim from caller to model.

On remote backends the Context is serialised into the wire envelope, so the server-side RemoteServer sees the same values the GUI sent. On the local backend it travels in-memory via the ActionCall.

Definition at line 26 of file session.hpp.

Member Data Documentation

◆ principal

std::string morph::session::Context::principal

Auth principal (user id).

On the client this is whatever the caller sets and is not trustworthy on its own — it is untrusted wire input. When a verifying authorizer (e.g. SigningAuthorizer, session_auth.hpp) is installed, RemoteServer overwrites this field with the principal extracted from a valid token before dispatch, so session::current()->principal read inside a model is the authenticated identity, not the client's claim.

Definition at line 35 of file session.hpp.

◆ token

std::string morph::session::Context::token

Bearer credential verified server-side (empty if unauthenticated).

Typically a signed token minted by a login action via session::TokenIssuer and attached to every call (see session_auth.hpp and docs/spec/security.md). Travels in the wire envelope's session.

Definition at line 42 of file session.hpp.

◆ requestId

std::string morph::session::Context::requestId

Stable id used for distributed tracing / log correlation. Empty if unused.

Definition at line 45 of file session.hpp.

◆ locale

std::string morph::session::Context::locale

BCP-47 locale tag (e.g. en-US, fr-FR) for i18n. Empty for app default.

Definition at line 48 of file session.hpp.

◆ metadata

std::unordered_map<std::string, std::string> morph::session::Context::metadata

Free-form bag of string→string metadata (feature flags, A/B buckets, …).

Definition at line 51 of file session.hpp.


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