Struct telescope::web::services::auth::identity::AuthenticationCookie [−][src]
pub struct AuthenticationCookie {
pub root: RootIdentity,
pub github: Option<GitHubIdentity>,
pub discord: Option<DiscordIdentity>,
}
Expand description
The top level object stored in the identity cookie.
Fields
root: RootIdentity
The root authenticated identity. This identity must always exist.
github: Option<GitHubIdentity>
An optional GitHub access token.
discord: Option<DiscordIdentity>
An optional Discord access and refresh token.
Implementations
If necessary, refresh an identity cookie. This could include getting a new access token from an OAuth API for example.
Get the RCOS user ID of an authenticated user. This is the same as just getting the RCOS user ID of the root identity.
Get the authenticated user’s RCOS user ID via the root identity or throw an internal server error.
Get discord credentials if authenticated.
Get the github credentials if authenticated.
Get the RCS ID of the authenticated user. Error if there is not an account
associated with this authentication cookie or if there is an issue communicating
with the RCOS API. Return Ok(None)
if there is an account but RPI CAS is not linked.
Try to replace the root identity with the secondary GitHub identity. Return true on success.
Try to replace the root identity with the discord token.
Return true on success.
See Self::replace_root_with_github
.
Try to get the user’s RCS id from the RCOS database and replace the root identity with it. Return true on success.
Try to remove the root identity from this authentication cookie
and replace it with one of the secondary ones. Return false
if
there is no secondary cookie to replace the root. This may try to access
the RCOS API to look for an RCS ID to replace the root.
If the root can successfully be replaced, return true
.
pub async fn remove_platform(
&mut self,
platform: UserAccountType
) -> Result<bool, TelescopeError>
pub async fn remove_platform(
&mut self,
platform: UserAccountType
) -> Result<bool, TelescopeError>
Try to remove a specific platform’s identity and authentication from this cookie.
This is similar to Self::remove_root
.
Trait Implementations
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
type Error = TelescopeError
type Error = TelescopeError
The associated error which can be returned.
type Future = LocalBoxFuture<'static, Result<Self, Self::Error>>
type Future = LocalBoxFuture<'static, Result<Self, Self::Error>>
Future that resolves to a Self
Convert request to a Self
Convert request to a Self Read more
Auto Trait Implementations
impl RefUnwindSafe for AuthenticationCookie
impl Send for AuthenticationCookie
impl Sync for AuthenticationCookie
impl Unpin for AuthenticationCookie
impl UnwindSafe for AuthenticationCookie
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more