#[non_exhaustive]pub struct Oauth2 { /* private fields */ }
Expand description
OAuth2 Flow
configuration for SecuritySchema
.
Implementations
sourceimpl Oauth2
impl Oauth2
sourcepub fn new<I: IntoIterator<Item = Flow>>(flows: I) -> Self
pub fn new<I: IntoIterator<Item = Flow>>(flows: I) -> Self
Construct a new Oauth2 security schema configuration object.
Oauth flow accepts slice of Flow
configuration objects and can be optionally provided with description.
Examples
Create new OAuth2 flow with multiple authentication flows.
Oauth2::new([Flow::Password(
Password::new(
"http://localhost/oauth/token",
HashMap::from([
("edit:items".to_string(), "edit my items".to_string()),
("read:items".to_string(), "read my items".to_string()
)]),
).with_refresh_url("http://localhost/refresh/token")),
Flow::AuthorizationCode(
AuthorizationCode::new(
"http://localhost/authorization/token",
"http://localhost/token/url",
HashMap::from([
("edit:items".to_string(), "edit my items".to_string()),
("read:items".to_string(), "read my items".to_string()
)])),
),
]).with_description("my oauth2 flow");
sourcepub fn with_description<S: Into<String>>(self, description: S) -> Self
pub fn with_description<S: Into<String>>(self, description: S) -> Self
Optional description supporting markdown syntax.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Oauth2
impl<'de> Deserialize<'de> for Oauth2
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
Auto Trait Implementations
impl RefUnwindSafe for Oauth2
impl Send for Oauth2
impl Sync for Oauth2
impl Unpin for Oauth2
impl UnwindSafe for Oauth2
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more