#[non_exhaustive]pub struct DeviceAuthorization {
pub device_authorization_url: String,
pub token_url: String,
pub refresh_url: Option<String>,
pub scopes: Scopes,
pub extensions: Option<Extensions>,
}Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.Device authorization endpoint URL for the flow.
token_url: StringToken URL for the flow.
refresh_url: Option<String>Optional refresh token URL for the flow.
scopes: ScopesScopes required by the flow.
extensions: Option<Extensions>Optional extensions “x-something”.
Implementations§
Source§impl DeviceAuthorization
impl DeviceAuthorization
Sourcepub fn new<D: Into<String>, T: Into<String>>(
device_authorization_url: D,
token_url: T,
scopes: Scopes,
) -> Self
pub fn new<D: Into<String>, T: Into<String>>( device_authorization_url: D, token_url: T, scopes: Scopes, ) -> Self
Construct a new device authorization OAuth2 flow.
First parameter is the device authorization endpoint URL where the client requests a device code, second parameter is the token URL used to poll for the access token, and the third parameter defines the scopes available for the flow.
§Examples
Create a device authorization flow and use it in an OAuth2 security scheme.
OAuth2::new([Flow::DeviceAuthorization(
DeviceAuthorization::new(
"https://localhost/oauth/device/code",
"https://localhost/oauth/token",
Scopes::from_iter([
("edit:items", "edit my items"),
("read:items", "read my items"),
]),
),
)]);Sourcepub fn with_refresh_url<S: Into<String>>(
device_authorization_url: S,
token_url: S,
scopes: Scopes,
refresh_url: S,
) -> Self
pub fn with_refresh_url<S: Into<String>>( device_authorization_url: S, token_url: S, scopes: Scopes, refresh_url: S, ) -> Self
Construct a new device authorization OAuth2 flow with additional refresh URL.
§Examples
Create a device authorization flow with a refresh token URL.
DeviceAuthorization::with_refresh_url(
"https://localhost/oauth/device/code",
"https://localhost/oauth/token",
Scopes::from_iter([("edit:items", "edit my items")]),
"https://localhost/oauth/refresh",
);Trait Implementations§
Source§impl Clone for DeviceAuthorization
impl Clone for DeviceAuthorization
Source§fn clone(&self) -> DeviceAuthorization
fn clone(&self) -> DeviceAuthorization
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 DeviceAuthorization
impl<'de> Deserialize<'de> for DeviceAuthorization
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
impl Eq for DeviceAuthorization
Source§impl PartialEq for DeviceAuthorization
impl PartialEq for DeviceAuthorization
Source§impl Serialize for DeviceAuthorization
impl Serialize for DeviceAuthorization
impl StructuralPartialEq for DeviceAuthorization
Auto Trait Implementations§
impl Freeze for DeviceAuthorization
impl RefUnwindSafe for DeviceAuthorization
impl Send for DeviceAuthorization
impl Sync for DeviceAuthorization
impl Unpin for DeviceAuthorization
impl UnsafeUnpin for DeviceAuthorization
impl UnwindSafe for DeviceAuthorization
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.