Expand description
JWT decode helpers (relocated to manta_shared::common::jwt_ops).
This module is a thin re-export so server-side call sites that
reach crate::server::common::jwt_ops::* continue to resolve
without churn. New code should prefer the canonical path
manta_shared::common::jwt_ops.
Constants§
- READ_
ONLY_ ROLE - Realm role string that puts the server into read-only mode for this
caller. A token carrying this role is refused (
403 Forbidden) on every mutating endpoint under/api/v1/*by the server’sauth_middleware::read_only_guard.
Statics§
- PA_
ADMIN - Keycloak role name that grants full admin access. Owned here so
every workspace crate that decodes JWTs can read it without
pulling
manta-serveras a dependency.
Functions§
- get_
name - Extract the
nameclaim from a JWT token. - get_
preferred_ username - Extract the
preferred_usernameclaim from a JWT token. - get_
roles - Extract the
realm_access.rolesclaim from a JWT token. - has_
role - Returns
truewhen the token’srealm_access.rolesclaim containsrole. Any JWT-decode failure or missing claim returnsfalse— callers want a yes/no answer, and downstreamBearerTokenextraction is the auth boundary that surfaces the underlying 401. - is_
user_ admin - Returns
truewhen the token’srealm_access.rolesclaim contains thePA_ADMINrole. Errors decoding the JWT are swallowed and treated as “not admin”.