[][src]Struct firestore_db_and_auth::sessions::user::Session

pub struct Session {
    pub userid: String,
    pub refresh_token: Option<String>,
    pub api_key: String,
    pub bearer: String,
    pub projectid: String,
}

An impersonated session. If you access FireStore with such a session, FireStore rules might restrict access to data.

Fields

userid: Stringrefresh_token: Option<String>api_key: Stringbearer: Stringprojectid: String

Methods

impl Session[src]

pub fn by_refresh_token(
    credentials: &Credentials,
    refresh_token: &str
) -> Result<Session>
[src]

Create a new firestore user session via a valid refresh_token

pub fn by_user_id(credentials: &Credentials, user_id: &str) -> Result<Session>[src]

Create a new firestore user session with a fresh access token and new refresh token

pub fn new(
    credentials: &Credentials,
    user_id: Option<&str>,
    firebase_tokenid: Option<&str>,
    refresh_token: Option<&str>
) -> Result<Session>
[src]

Create an impersonated session

If the optionally provided access token is still valid, it will be used. If the access token is not valid anymore, but the given refresh token is, it will be used to retrieve a new access token.

If neither refresh token nor access token work are provided or valid, the service account credentials will be used to generate a new impersonated refresh and access token for the given user.

If none of the parameters are given, the function will error out.

See:

  • https://firebase.google.com/docs/reference/rest/auth#section-refresh-token
  • https://firebase.google.com/docs/auth/admin/create-custom-tokens#create_custom_tokens_using_a_third-party_jwt_library

pub fn by_access_token(
    credentials: &Credentials,
    firebase_tokenid: &str
) -> Result<Session>
[src]

Trait Implementations

impl<'a> FirebaseAuthBearer<'a> for Session[src]

impl Debug for Session[src]

impl Serialize for Session[src]

impl<'de> Deserialize<'de> for Session[src]

Auto Trait Implementations

impl Send for Session

impl Unpin for Session

impl Sync for Session

impl UnwindSafe for Session

impl RefUnwindSafe for Session

Blanket Implementations

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Erased for T

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.

impl<T> IntoCollection<T> for T

impl<T, I> AsResult<T, I> for T where
    I: Input,