pub struct AuthRequest {
pub method: HttpMethod,
pub path: String,
pub headers: HashMap<String, String>,
pub body: Option<Vec<u8>>,
pub query: HashMap<String, String>,
/* private fields */
}Expand description
Authentication request wrapper
Fields§
§method: HttpMethod§path: String§headers: HashMap<String, String>§body: Option<Vec<u8>>§query: HashMap<String, String>Implementations§
Source§impl AuthRequest
impl AuthRequest
pub fn new(method: HttpMethod, path: impl Into<String>) -> AuthRequest
Sourcepub fn from_parts(
method: HttpMethod,
path: String,
headers: HashMap<String, String>,
body: Option<Vec<u8>>,
query: HashMap<String, String>,
) -> AuthRequest
pub fn from_parts( method: HttpMethod, path: String, headers: HashMap<String, String>, body: Option<Vec<u8>>, query: HashMap<String, String>, ) -> AuthRequest
Construct a request from all public parts.
Prefer AuthRequest::new when you only need method + path.
pub fn method(&self) -> &HttpMethod
pub fn path(&self) -> &str
pub fn header(&self, name: &str) -> Option<&String>
Sourcepub fn virtual_user_id(&self) -> Option<&str>
pub fn virtual_user_id(&self) -> Option<&str>
Returns the virtual user ID injected by a before_request hook, if any.
Sourcepub fn set_virtual_user_id(&mut self, user_id: String)
pub fn set_virtual_user_id(&mut self, user_id: String)
Set the virtual user ID on this request.
§Safety contract
This must only be called from the internal request pipeline
(i.e. handle_request_inner) after a plugin’s before_request hook
returns BeforeRequestAction::InjectSession. Calling it from
application code would bypass normal authentication.
pub fn body_as_json<T>(&self) -> Result<T, Error>where
T: for<'de> Deserialize<'de>,
Trait Implementations§
Source§impl Clone for AuthRequest
impl Clone for AuthRequest
Source§fn clone(&self) -> AuthRequest
fn clone(&self) -> AuthRequest
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 moreAuto Trait Implementations§
impl Freeze for AuthRequest
impl RefUnwindSafe for AuthRequest
impl Send for AuthRequest
impl Sync for AuthRequest
impl Unpin for AuthRequest
impl UnsafeUnpin for AuthRequest
impl UnwindSafe for AuthRequest
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