pub struct AuthServer {
pub client_id: String,
pub issuer: String,
pub scopes: Option<Vec<String>>,
}Expand description
OAuth 2.0 authorization server.
Fields§
§client_id: StringOAuth 2.0 client id.
issuer: StringOAuth 2.0 issuer URL.
This is the base URL of the identity provider.
For Okta, this usually looks like https://example.okta.com/oauth2/default.
For Cognito, it might look like https://cognito-idp.us-west-2.amazonaws.com/us-west-2_example.
Note that this is technically distinct from the issuer field in [OidcDiscovery],
which is the canonical URI that the identity provider uses to sign and validate tokens,
but the OpenID specification requires that they match exactly,
and that they match the iss claim in Tokens issued by this identity provider.
scopes: Option<Vec<String>>OAuth 2.0 scopes to request during authorization requests.
If not specified, supported_scopes from the discovery document hosted at issuer will be used.
The scope openid is always requested, even if not present in this list.
Implementations§
Source§impl AuthServer
impl AuthServer
Sourcepub fn get_client_id(&self) -> &str
pub fn get_client_id(&self) -> &str
Get the configured OAuth OIDC client id.
Sourcepub fn py_set_client_id(&mut self, client_id: String)
pub fn py_set_client_id(&mut self, client_id: String)
Set an OAuth OIDC client id.
Sourcepub fn get_issuer(&self) -> &str
pub fn get_issuer(&self) -> &str
Get the OAuth OIDC issuer URL.
Sourcepub fn py_set_issuer(&mut self, issuer: String)
pub fn py_set_issuer(&mut self, issuer: String)
Set an OAuth OIDC issuer URL.
Source§impl AuthServer
impl AuthServer
Sourcepub const fn new(
client_id: String,
issuer: String,
scopes: Option<Vec<String>>,
) -> Self
pub const fn new( client_id: String, issuer: String, scopes: Option<Vec<String>>, ) -> Self
Create a new AuthServer with a client_id and issuer and an optional list of scopes.
If scopes is None, all scopes_supported from the issuer’s discovery document will be used when requesting authorization tokens.
Note that the required scope openid is always requested, even if scopes is provided but does not contain it.
Sourcepub async fn new_with_discovery_supported_scopes(
client_id: String,
issuer: String,
) -> Result<Self, DiscoveryError>
pub async fn new_with_discovery_supported_scopes( client_id: String, issuer: String, ) -> Result<Self, DiscoveryError>
Create a new AuthServer with the specified client_id and issuer, populating scopes with all scopes_supported fetched from the issuer’s discovery document.
§Errors
Returns an error if the discovery document cannot be fetched or parsed.
Trait Implementations§
Source§impl Clone for AuthServer
impl Clone for AuthServer
Source§fn clone(&self) -> AuthServer
fn clone(&self) -> AuthServer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AuthServer
impl Debug for AuthServer
Source§impl Default for AuthServer
impl Default for AuthServer
Source§impl<'de> Deserialize<'de> for AuthServer
impl<'de> Deserialize<'de> for AuthServer
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>,
Source§impl PartialEq for AuthServer
impl PartialEq for AuthServer
Source§impl PyClass for AuthServer
impl PyClass for AuthServer
Source§impl PyClassImpl for AuthServer
impl PyClassImpl for AuthServer
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§type ThreadChecker = SendablePyClass<AuthServer>
type ThreadChecker = SendablePyClass<AuthServer>
type Inventory = Pyo3MethodsInventoryForAuthServer
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyClassNewTextSignature<AuthServer> for PyClassImplCollector<AuthServer>
impl PyClassNewTextSignature<AuthServer> for PyClassImplCollector<AuthServer>
fn new_text_signature(self) -> Option<&'static str>
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a AuthServer
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a AuthServer
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut AuthServer
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut AuthServer
Source§impl PyTypeInfo for AuthServer
impl PyTypeInfo for AuthServer
Source§type AsRefTarget = PyCell<AuthServer>
type AsRefTarget = PyCell<AuthServer>
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Source§fn type_object(py: Python<'_>) -> &PyType
fn type_object(py: Python<'_>) -> &PyType
Source§fn is_type_of(object: &PyAny) -> bool
fn is_type_of(object: &PyAny) -> bool
object is an instance of this type or a subclass of this type.Source§fn is_exact_type_of(object: &PyAny) -> bool
fn is_exact_type_of(object: &PyAny) -> bool
object is an instance of this type.Source§impl Serialize for AuthServer
impl Serialize for AuthServer
impl Eq for AuthServer
impl StructuralPartialEq for AuthServer
Auto Trait Implementations§
impl Freeze for AuthServer
impl RefUnwindSafe for AuthServer
impl Send for AuthServer
impl Sync for AuthServer
impl Unpin for AuthServer
impl UnwindSafe for AuthServer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
key and return true if they are equal.Source§impl<'a, T> FromPyObject<'a> for T
impl<'a, T> FromPyObject<'a> for T
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> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);