MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / validate

Method validate

crates/openshell-server/src/auth/authz.rs:45–56  ·  view source on GitHub ↗

Validate the policy configuration. Returns an error if only one of admin/user role is set — either both must be set (RBAC mode) or both empty (auth-only mode).

(&self)

Source from the content-addressed store, hash-verified

43 /// Returns an error if only one of admin/user role is set — either
44 /// both must be set (RBAC mode) or both empty (auth-only mode).
45 pub fn validate(&self) -> Result<(), String> {
46 let admin_set = !self.admin_role.is_empty();
47 let user_set = !self.user_role.is_empty();
48 if admin_set != user_set {
49 return Err(format!(
50 "OIDC RBAC misconfiguration: admin_role={:?}, user_role={:?}. \
51 Either set both roles (RBAC mode) or leave both empty (authentication-only mode).",
52 self.admin_role, self.user_role,
53 ));
54 }
55 Ok(())
56 }
57}
58
59impl AuthzPolicy {

Callers 2

run_serverFunction · 0.45
parse_mcp_callFunction · 0.45

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected