pub struct AuthorizationConfig {
pub required_roles: Vec<String>,
pub required_scopes: Vec<String>,
pub required_permissions: Vec<String>,
pub require_all: bool,
}Expand description
Per-route roles/scopes/permissions authorization requirement.
spikard_http::auth::Claims does not yet carry roles, scopes, or permissions, so nothing can
enforce this today. This type only defines the requirement shape; a later phase must extend
Claims (or an equivalent claims-decoding path) to populate them before enforcement is
possible. ~keep
Deserialization goes through [AuthorizationConfigRepr] rather than a derive so the fixture’s
singular {"required_role": "admin"} shape (fixtures/problem_details.json’s
problem_details_403_forbidden) populates required_roles instead of being silently dropped
as an unrecognized field — a config that parses to “no constraint” from real authorization
data is a vacuous-pass bug, not a compatibility shim. deny_unknown_fields on the repr means
any other unrecognized key is a loud deserialize error instead. ~keep
Fields§
§required_roles: Vec<String>Roles the authenticated caller must have
required_scopes: Vec<String>OAuth-style scopes the authenticated caller must have
required_permissions: Vec<String>Fine-grained permissions the authenticated caller must have
require_all: boolWhen true, the caller must satisfy every listed requirement (AND); when false, any single listed requirement is sufficient (OR)
Trait Implementations§
Source§impl Clone for AuthorizationConfig
impl Clone for AuthorizationConfig
Source§impl Debug for AuthorizationConfig
impl Debug for AuthorizationConfig
Source§impl Default for AuthorizationConfig
impl Default for AuthorizationConfig
Source§impl<'de> Deserialize<'de> for AuthorizationConfig
impl<'de> Deserialize<'de> for AuthorizationConfig
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl Eq for AuthorizationConfig
Source§impl PartialEq for AuthorizationConfig
impl PartialEq for AuthorizationConfig
Source§impl Serialize for AuthorizationConfig
impl Serialize for AuthorizationConfig
impl StructuralPartialEq for AuthorizationConfig
Auto Trait Implementations§
impl Freeze for AuthorizationConfig
impl RefUnwindSafe for AuthorizationConfig
impl Send for AuthorizationConfig
impl Sync for AuthorizationConfig
impl Unpin for AuthorizationConfig
impl UnsafeUnpin for AuthorizationConfig
impl UnwindSafe for AuthorizationConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.