Enum utoipa::openapi::security::SecurityScheme
source · 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 authentication.
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 configuration values.
MutualTls
Authentication is done via client side certificate.
OpenApi 3.1 type
Trait Implementations§
source§impl Clone for SecurityScheme
impl Clone for SecurityScheme
source§fn clone(&self) -> SecurityScheme
fn clone(&self) -> SecurityScheme
Returns a copy 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 moresource§impl<'de> Deserialize<'de> for SecurityScheme
impl<'de> Deserialize<'de> for SecurityScheme
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<SecurityScheme> for SecurityScheme
impl PartialEq<SecurityScheme> for SecurityScheme
source§fn eq(&self, other: &SecurityScheme) -> bool
fn eq(&self, other: &SecurityScheme) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for SecurityScheme
impl Serialize for SecurityScheme
impl Eq for SecurityScheme
impl StructuralEq for SecurityScheme
impl StructuralPartialEq 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§
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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.