MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / build_auth_context

Function build_auth_context

nodedb/src/control/server/session_auth/context.rs:15–21  ·  view source on GitHub ↗

Build an `AuthContext` from an `AuthenticatedIdentity`. This is the centralized factory used by all auth flows (password, API key, certificate, trust). JWT flows can use `AuthContext::from_jwt()` directly when JWT claims are available for richer context.

(identity: &AuthenticatedIdentity)

Source from the content-addressed store, hash-verified

13/// API key, certificate, trust). JWT flows can use `AuthContext::from_jwt()`
14/// directly when JWT claims are available for richer context.
15pub fn build_auth_context(identity: &AuthenticatedIdentity) -> AuthContext {
16 let mut ctx = AuthContext::from_identity(identity, generate_session_id());
17 // Stamp the per-user default database so `$auth.database_id` is available
18 // for RLS predicates even before a `USE DATABASE` command.
19 ctx.database_id = identity.default_database;
20 ctx
21}
22
23/// Enrich AuthContext with scope status data from the scope grant store.
24///

Callers 10

explain_permissionFunction · 0.85
assert_visibleFunction · 0.85
handle_explainMethod · 0.85
resolve_authFunction · 0.85
queryFunction · 0.85
query_ndjsonFunction · 0.85
handle_requestMethod · 0.85
handle_authMethod · 0.85

Calls 1

generate_session_idFunction · 0.85

Tested by

no test coverage detected