pub enum Location {
Bearer,
Query(&'static str),
Cookie(&'static str),
}Expand description
Where token_from looks for a token (Loco’s auth.jwt.location).
§Examples
use ocre::jwt::Location;
// Browsers keep the token in a cookie; API clients send a Bearer header.
let locations = [Location::Bearer, Location::Cookie("token")];
assert_eq!(locations[1], Location::Cookie("token"));Variants§
Bearer
Authorization: Bearer <token>, the default for API clients.
Query(&'static str)
A query parameter, e.g. Query("token") for ?token=.... URLs end up
in logs and Referer headers: use it only where a header is
impossible (an EventSource, a WebSocket from a browser, a download
link), with short-lived tokens.
Cookie(&'static str)
A cookie, e.g. Cookie("token"). Set it HttpOnly and SameSite:
cookies are sent automatically, so the CSRF check applies.
Trait Implementations§
impl Copy for Location
impl Eq for Location
impl StructuralPartialEq for Location
Auto Trait Implementations§
impl Freeze for Location
impl RefUnwindSafe for Location
impl Send for Location
impl Sync for Location
impl Unpin for Location
impl UnsafeUnpin for Location
impl UnwindSafe for Location
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
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.