pub struct RequestIdentity {
pub id: String,
pub identity_type: String,
pub roles: Vec<String>,
pub attrs: HashMap<String, Value>,
}Expand description
Identity information stored in Axum request extensions.
Middleware (e.g., JWT auth) should insert this into request extensions before handlers run:
ⓘ
use axum_apcore::RequestIdentity;
req.extensions_mut().insert(RequestIdentity {
id: "user-123".into(),
identity_type: "user".into(),
roles: vec!["admin".into()],
attrs: Default::default(),
});Fields§
§id: String§identity_type: String§roles: Vec<String>§attrs: HashMap<String, Value>Trait Implementations§
Source§impl Clone for RequestIdentity
impl Clone for RequestIdentity
Source§fn clone(&self) -> RequestIdentity
fn clone(&self) -> RequestIdentity
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 RequestIdentity
impl Debug for RequestIdentity
Source§impl<'de> Deserialize<'de> for RequestIdentity
impl<'de> Deserialize<'de> for RequestIdentity
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 From<RequestIdentity> for Identity
impl From<RequestIdentity> for Identity
Source§fn from(ri: RequestIdentity) -> Self
fn from(ri: RequestIdentity) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for RequestIdentity
impl RefUnwindSafe for RequestIdentity
impl Send for RequestIdentity
impl Sync for RequestIdentity
impl Unpin for RequestIdentity
impl UnsafeUnpin for RequestIdentity
impl UnwindSafe for RequestIdentity
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