pub struct Authenticated<U>(pub U);Expand description
The logged-in user, for handlers that only logged-in users should reach. Authenticated
dereferences to the user.
A guest gets the same response that Authenticate gives one. A browser
is redirected to the login page, and the session remembers the page it
asked for so that Redirect::intended can return to it. A
request that expects JSON, or any request in an application without a login page, gets a 401.
The extractor rejects a guest with a laravel::Error that renders as that response,
so your own extractors can build on it with ?.
use laravel::auth::Authenticated;
async fn dashboard(user: Authenticated<User>) -> String {
format!("Hello, {}!", user.name)
}Tuple Fields§
§0: UTrait Implementations§
Source§impl<U> Clone for Authenticated<U>where
U: Clone,
impl<U> Clone for Authenticated<U>where
U: Clone,
Source§fn clone(&self) -> Authenticated<U>
fn clone(&self) -> Authenticated<U>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<U> Debug for Authenticated<U>where
U: Debug,
impl<U> Debug for Authenticated<U>where
U: Debug,
Source§impl<U> Deref for Authenticated<U>
impl<U> Deref for Authenticated<U>
Source§impl<U, S> FromRequestParts<S> for Authenticated<U>
impl<U, S> FromRequestParts<S> for Authenticated<U>
Source§impl<'a, N> Notifiables<'a, N> for &'a Authenticated<N>
Converts an Authenticated user into notifiables through the inner user, so that a handler
can write notification::to(&user).
impl<'a, N> Notifiables<'a, N> for &'a Authenticated<N>
Converts an Authenticated user into notifiables through the inner user, so that a handler
can write notification::to(&user).
Source§fn into_notifiables(self) -> Vec<&'a N>
fn into_notifiables(self) -> Vec<&'a N>
Source§impl<'a, U> Recipients for &'a Authenticated<U>
Converts an Authenticated user into mail recipients through the user type’s own
conversion, so that a handler can write mail::to(&user).
impl<'a, U> Recipients for &'a Authenticated<U>
Converts an Authenticated user into mail recipients through the user type’s own
conversion, so that a handler can write mail::to(&user).
Source§fn into_addresses(self) -> Vec<Address>
fn into_addresses(self) -> Vec<Address>
Auto Trait Implementations§
impl<U> Forget for Authenticated<U>
impl<U> Freeze for Authenticated<U>where
U: Freeze,
impl<U> Move for Authenticated<U>
impl<U> RefUnwindSafe for Authenticated<U>where
U: RefUnwindSafe,
impl<U> Send for Authenticated<U>where
U: Send,
impl<U> Sync for Authenticated<U>where
U: Sync,
impl<U> Unpin for Authenticated<U>where
U: Unpin,
impl<U> UnsafeUnpin for Authenticated<U>where
U: UnsafeUnpin,
impl<U> UnwindSafe for Authenticated<U>where
U: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, A> DynAccess<T> for A
impl<T, A> DynAccess<T> for A
Source§fn load(&self) -> DynGuard<T>
fn load(&self) -> DynGuard<T>
Access::load.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<K> ForeignKey<K> for K
impl<K> ForeignKey<K> for K
impl<T> Formattable for T
Source§impl<S, T> FromRequest<S, ViaParts> for T
impl<S, T> FromRequest<S, ViaParts> for T
Source§type Rejection = <T as FromRequestParts<S>>::Rejection
type Rejection = <T as FromRequestParts<S>>::Rejection
Source§fn from_request(
req: Request<Body>,
state: &S,
) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
fn from_request( req: Request<Body>, state: &S, ) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> 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