pub enum OAuth2Scope {
OpenId,
Email,
Profile,
OfflineAccess,
Custom(String),
}Expand description
An OAuth 2.0 scope value.
Scopes are passed to crate::CliTokenClientBuilder::add_scopes to request
specific permissions from the authorization server.
§Example
use loopauth::OAuth2Scope;
// Display produces the wire-format string
assert_eq!(OAuth2Scope::OpenId.to_string(), "openid");
assert_eq!(OAuth2Scope::Custom("read:data".to_string()).to_string(), "read:data");
// Serde round-trip
let json = serde_json::to_string(&OAuth2Scope::OpenId).unwrap();
assert_eq!(json, r#""openid""#);
let roundtrip: OAuth2Scope = serde_json::from_str(&json).unwrap();
assert_eq!(roundtrip, OAuth2Scope::OpenId);Variants§
OpenId
The openid scope, required for OIDC ID token issuance.
The email scope, requests the user’s email address claim.
Profile
The profile scope, requests basic profile claims (name, picture, etc.).
OfflineAccess
The offline_access scope, requests a refresh token.
Custom(String)
A custom or provider-specific scope value.
Trait Implementations§
Source§impl Clone for OAuth2Scope
impl Clone for OAuth2Scope
Source§fn clone(&self) -> OAuth2Scope
fn clone(&self) -> OAuth2Scope
Returns a duplicate 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 Debug for OAuth2Scope
impl Debug for OAuth2Scope
Source§impl<'de> Deserialize<'de> for OAuth2Scope
impl<'de> Deserialize<'de> for OAuth2Scope
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 Display for OAuth2Scope
impl Display for OAuth2Scope
Source§impl From<&str> for OAuth2Scope
impl From<&str> for OAuth2Scope
Source§impl From<RequestScope> for OAuth2Scope
impl From<RequestScope> for OAuth2Scope
Source§fn from(s: RequestScope) -> Self
fn from(s: RequestScope) -> Self
Converts to this type from the input type.
Source§impl FromStr for OAuth2Scope
impl FromStr for OAuth2Scope
Source§impl Hash for OAuth2Scope
impl Hash for OAuth2Scope
Source§impl Ord for OAuth2Scope
impl Ord for OAuth2Scope
Source§fn cmp(&self, other: &OAuth2Scope) -> Ordering
fn cmp(&self, other: &OAuth2Scope) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for OAuth2Scope
impl PartialEq for OAuth2Scope
Source§impl PartialOrd for OAuth2Scope
impl PartialOrd for OAuth2Scope
Source§impl Serialize for OAuth2Scope
impl Serialize for OAuth2Scope
impl Eq for OAuth2Scope
impl StructuralPartialEq for OAuth2Scope
Auto Trait Implementations§
impl Freeze for OAuth2Scope
impl RefUnwindSafe for OAuth2Scope
impl Send for OAuth2Scope
impl Sync for OAuth2Scope
impl Unpin for OAuth2Scope
impl UnsafeUnpin for OAuth2Scope
impl UnwindSafe for OAuth2Scope
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,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.