pub enum SecurityScheme {
OAuth2(OAuth2),
ApiKey(ApiKey),
Http(Http),
OpenIdConnect(OpenIdConnect),
MutualTls {
description: Option<String>,
},
}
Expand description
OpenAPI security scheme for path operations.
Examples
Create implicit oauth2 flow security schema for path operations.
SecurityScheme::OAuth2(
OAuth2::with_description([Flow::Implicit(
Implicit::new(
"https://localhost/auth/dialog",
Scopes::from_iter([
("edit:items", "edit my items"),
("read:items", "read my items")
]),
),
)], "my oauth2 flow")
);
Create JWT header authetication.
SecurityScheme::Http(
HttpBuilder::new().scheme(HttpAuthScheme::Bearer).bearer_format("JWT").build()
);
Variants
OAuth2(OAuth2)
Oauth flow authentication.
ApiKey(ApiKey)
Api key authentication sent in header
, cookie
or query
.
Http(Http)
Http authentication such as bearer
or basic
.
OpenIdConnect(OpenIdConnect)
Open id connect url to discover OAuth2 configuraiton values.
MutualTls
Authentication is done via client side cerfiticate.
OpenApi 3.1 type
Trait Implementations
sourceimpl Clone for SecurityScheme
impl Clone for SecurityScheme
sourcefn clone(&self) -> SecurityScheme
fn clone(&self) -> SecurityScheme
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'de> Deserialize<'de> for SecurityScheme
impl<'de> Deserialize<'de> for SecurityScheme
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Serialize for SecurityScheme
impl Serialize for SecurityScheme
Auto Trait Implementations
impl RefUnwindSafe for SecurityScheme
impl Send for SecurityScheme
impl Sync for SecurityScheme
impl Unpin for SecurityScheme
impl UnwindSafe for SecurityScheme
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more