pub struct SecurityScheme { /* private fields */ }Expand description
A way for clients to authenticate, such as a bearer token or an API key.
Register it under a name with
OpenApi::security_scheme, then
require it with Operation::security:
use topcoat::openapi::{OpenApi, Operation, SecurityScheme};
let api = OpenApi::new("Acme API", "1.0.0")
.security_scheme("token", SecurityScheme::bearer().bearer_format("JWT"));
let operation = Operation::new().security("token");Implementations§
Source§impl SecurityScheme
impl SecurityScheme
Sourcepub fn basic() -> Self
pub fn basic() -> Self
Authenticates with a user name and password sent through HTTP basic authentication.
Sourcepub fn api_key_header(name: impl Into<Cow<'static, str>>) -> Self
pub fn api_key_header(name: impl Into<Cow<'static, str>>) -> Self
Authenticates with an API key sent in the request header name.
Sourcepub fn api_key_query(name: impl Into<Cow<'static, str>>) -> Self
pub fn api_key_query(name: impl Into<Cow<'static, str>>) -> Self
Authenticates with an API key sent as the query string key name.
Authenticates with an API key sent in the cookie name.
Sourcepub fn description(self, description: impl Into<Cow<'static, str>>) -> Self
pub fn description(self, description: impl Into<Cow<'static, str>>) -> Self
Explains how clients obtain and use the credentials.
Trait Implementations§
Source§impl Clone for SecurityScheme
impl Clone for SecurityScheme
Source§impl Debug for SecurityScheme
impl Debug for SecurityScheme
Auto Trait Implementations§
impl Forget for SecurityScheme
impl Freeze for SecurityScheme
impl RefUnwindSafe for SecurityScheme
impl Send for SecurityScheme
impl Sync for SecurityScheme
impl Unpin for SecurityScheme
impl UnsafeUnpin 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