pub struct Authentication {
backends: CheapVec<Arc<dyn AnyAuthenticationMethod>, 0>,
session: Arc<dyn AnySessionMethod>,
role: Option<Arc<dyn AnyRoleMethod>>,
default_role: Option<CompactString>,
session_cookie: bool,
allow_signup: bool,
}Expand description
Defines how the server executor can handle authentication
Fields§
§backends: CheapVec<Arc<dyn AnyAuthenticationMethod>, 0>All the available methods to authenticate.
session: Arc<dyn AnySessionMethod>The method for manage sessions.
role: Option<Arc<dyn AnyRoleMethod>>The method for manage roles.
default_role: Option<CompactString>Default role when users sign up.
Whether to read the session token from the cookie header. NOTE: if set, the session token will be read from the Authorization header and will fallback to the cookie header.
allow_signup: boolWhether to allow user signup.
Implementations§
Source§impl Authentication
impl Authentication
pub const fn new( backends: CheapVec<Arc<dyn AnyAuthenticationMethod>, 0>, session: Arc<dyn AnySessionMethod>, role: Option<Arc<dyn AnyRoleMethod>>, default_role: Option<CompactString>, session_cookie: bool, allow_signup: bool, ) -> Authentication
Source§impl Authentication
impl Authentication
Sourcepub fn backends(&self) -> &CheapVec<Arc<dyn AnyAuthenticationMethod>, 0>
pub fn backends(&self) -> &CheapVec<Arc<dyn AnyAuthenticationMethod>, 0>
All the available methods to authenticate.
Sourcepub fn session(&self) -> &Arc<dyn AnySessionMethod>
pub fn session(&self) -> &Arc<dyn AnySessionMethod>
The method for manage sessions.
Sourcepub fn role(&self) -> &Option<Arc<dyn AnyRoleMethod>>
pub fn role(&self) -> &Option<Arc<dyn AnyRoleMethod>>
The method for manage roles.
Sourcepub fn default_role(&self) -> &Option<CompactString>
pub fn default_role(&self) -> &Option<CompactString>
Default role when users sign up.
Whether to read the session token from the cookie header. NOTE: if set, the session token will be read from the Authorization header and will fallback to the cookie header.
Sourcepub fn allow_signup(&self) -> &bool
pub fn allow_signup(&self) -> &bool
Whether to allow user signup.
Source§impl Authentication
impl Authentication
Sourcepub fn backends_mut(
&mut self,
) -> &mut CheapVec<Arc<dyn AnyAuthenticationMethod>, 0>
pub fn backends_mut( &mut self, ) -> &mut CheapVec<Arc<dyn AnyAuthenticationMethod>, 0>
All the available methods to authenticate.
Sourcepub fn session_mut(&mut self) -> &mut Arc<dyn AnySessionMethod>
pub fn session_mut(&mut self) -> &mut Arc<dyn AnySessionMethod>
The method for manage sessions.
Sourcepub fn role_mut(&mut self) -> &mut Option<Arc<dyn AnyRoleMethod>>
pub fn role_mut(&mut self) -> &mut Option<Arc<dyn AnyRoleMethod>>
The method for manage roles.
Sourcepub fn default_role_mut(&mut self) -> &mut Option<CompactString>
pub fn default_role_mut(&mut self) -> &mut Option<CompactString>
Default role when users sign up.
Whether to read the session token from the cookie header. NOTE: if set, the session token will be read from the Authorization header and will fallback to the cookie header.
Sourcepub fn allow_signup_mut(&mut self) -> &mut bool
pub fn allow_signup_mut(&mut self) -> &mut bool
Whether to allow user signup.
Trait Implementations§
Source§impl Clone for Authentication
impl Clone for Authentication
Source§fn clone(&self) -> Authentication
fn clone(&self) -> Authentication
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Authentication
impl Debug for Authentication
Source§impl<'de> Deserialize<'de> for Authentication
impl<'de> Deserialize<'de> for Authentication
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 Authentication
impl PartialEq for Authentication
Auto Trait Implementations§
impl !RefUnwindSafe for Authentication
impl !UnwindSafe for Authentication
impl Freeze for Authentication
impl Send for Authentication
impl Sync for Authentication
impl Unpin for Authentication
impl UnsafeUnpin for Authentication
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,
§impl<T> Decode for T
impl<T> Decode for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Encode for T
impl<T> Encode for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more