pub struct SecurityContribution {
pub scheme: String,
pub scopes: Vec<String>,
}Expand description
One security requirement entry the layer enforces. References a
scheme that has been registered with
crate::ApiDocBuilder::bearer_security or
crate::ApiDocBuilder::security_scheme — a dangling reference
produces an invalid spec, so make sure the scheme name matches.
Fields§
§scheme: StringName of the security scheme as registered on the
crate::ApiDocBuilder.
scopes: Vec<String>Required scopes. Empty for non-OAuth schemes.
Implementations§
Source§impl SecurityContribution
impl SecurityContribution
Sourcepub fn new(scheme: impl Into<String>) -> Self
pub fn new(scheme: impl Into<String>) -> Self
Build a security contribution naming the scheme to enforce.
No scopes by default — use SecurityContribution::with_scopes
for OAuth flows.
Sourcepub fn with_scopes(self, scopes: impl IntoIterator<Item = String>) -> Self
pub fn with_scopes(self, scopes: impl IntoIterator<Item = String>) -> Self
Set the OAuth scopes required by this requirement.
Trait Implementations§
Source§impl Clone for SecurityContribution
impl Clone for SecurityContribution
Source§fn clone(&self) -> SecurityContribution
fn clone(&self) -> SecurityContribution
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SecurityContribution
impl RefUnwindSafe for SecurityContribution
impl Send for SecurityContribution
impl Sync for SecurityContribution
impl Unpin for SecurityContribution
impl UnsafeUnpin for SecurityContribution
impl UnwindSafe for SecurityContribution
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
Mutably borrows from an owned value. Read more