[][src]Enum actix_web::cookie::SameSite

pub enum SameSite {
    Strict,
    Lax,
    None,
}

The SameSite cookie attribute.

A cookie with a SameSite attribute is imposed restrictions on when it is sent to the origin server in a cross-site request. If the SameSite attribute is "Strict", then the cookie is never sent in cross-site requests. If the SameSite attribute is "Lax", the cookie is only sent in cross-site requests with "safe" HTTP methods, i.e, GET, HEAD, OPTIONS, TRACE. If the SameSite attribute is not present then the cookie will be sent as normal. In some browsers, this will implicitly handle the cookie as if "Lax" and in others, "None". It's best to explicitly set the SameSite attribute to avoid inconsistent behavior.

Note: Depending on browser, the Secure attribute may be required for SameSite "None" cookies to be accepted.

Note: This cookie attribute is an HTTP draft! Its meaning and definition are subject to change.

More info about these draft changes can be found in the draft spec:

  • https://tools.ietf.org/html/draft-west-cookie-incrementalism-00

Variants

Strict

The "Strict" SameSite attribute.

Lax

The "Lax" SameSite attribute.

None

The "None" SameSite attribute.

Methods

impl SameSite[src]

pub fn is_strict(self) -> bool[src]

Returns true if self is SameSite::Strict and false otherwise.

Example

use actix_http::cookie::SameSite;

let strict = SameSite::Strict;
assert!(strict.is_strict());
assert!(!strict.is_lax());
assert!(!strict.is_none());

pub fn is_lax(self) -> bool[src]

Returns true if self is SameSite::Lax and false otherwise.

Example

use actix_http::cookie::SameSite;

let lax = SameSite::Lax;
assert!(lax.is_lax());
assert!(!lax.is_strict());
assert!(!lax.is_none());

pub fn is_none(self) -> bool[src]

Returns true if self is SameSite::None and false otherwise.

Example

use actix_http::cookie::SameSite;

let none = SameSite::None;
assert!(none.is_none());
assert!(!none.is_lax());
assert!(!none.is_strict());

Trait Implementations

impl Clone for SameSite[src]

impl Copy for SameSite[src]

impl Debug for SameSite[src]

impl Display for SameSite[src]

impl Eq for SameSite[src]

impl Hash for SameSite[src]

impl PartialEq<SameSite> for SameSite[src]

impl StructuralEq for SameSite[src]

impl StructuralPartialEq for SameSite[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Sealed<T> for T where
    T: ?Sized

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,