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

Function trust_identity

nodedb/src/control/server/session_auth/identity.rs:126–141  ·  view source on GitHub ↗

Build a default trust-mode identity for a given username. Used by both explicit auth requests and auto-auth on first frame.

(state: &SharedState, username: &str)

Source from the content-addressed store, hash-verified

124///
125/// Used by both explicit auth requests and auto-auth on first frame.
126pub fn trust_identity(state: &SharedState, username: &str) -> AuthenticatedIdentity {
127 if let Some(id) = state.credentials.to_identity(username, AuthMethod::Trust) {
128 id
129 } else {
130 AuthenticatedIdentity {
131 user_id: 0,
132 username: username.to_string(),
133 tenant_id: TenantId::new(1),
134 auth_method: AuthMethod::Trust,
135 roles: vec![Role::Superuser],
136 is_superuser: true,
137 default_database: None,
138 accessible_databases: DatabaseSet::All,
139 }
140 }
141}

Callers 4

handle_frameMethod · 0.85
resolve_identityFunction · 0.85
authenticateFunction · 0.85
handle_requestMethod · 0.85

Calls 2

to_stringMethod · 0.80
to_identityMethod · 0.45

Tested by

no test coverage detected