You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-07-29 22:01:14 +03:00
Legacy login via m.login.sso
This commit is contained in:
@ -20,6 +20,7 @@ use rand::{
|
||||
};
|
||||
use serde::Serialize;
|
||||
use thiserror::Error;
|
||||
use url::Url;
|
||||
|
||||
use crate::{StorageBackend, StorageBackendMarker, User};
|
||||
|
||||
@ -114,3 +115,29 @@ impl<S: StorageBackendMarker> From<CompatAccessToken<S>> for CompatAccessToken<(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize)]
|
||||
#[serde(bound = "T: StorageBackend")]
|
||||
pub enum CompatSsoLoginState<T: StorageBackend> {
|
||||
Pending,
|
||||
Fullfilled {
|
||||
fullfilled_at: DateTime<Utc>,
|
||||
session: CompatSession<T>,
|
||||
},
|
||||
Exchanged {
|
||||
fullfilled_at: DateTime<Utc>,
|
||||
exchanged_at: DateTime<Utc>,
|
||||
session: CompatSession<T>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize)]
|
||||
#[serde(bound = "T: StorageBackend")]
|
||||
pub struct CompatSsoLogin<T: StorageBackend> {
|
||||
#[serde(skip_serializing)]
|
||||
pub data: T::CompatSsoLoginData,
|
||||
pub redirect_uri: Url,
|
||||
pub token: String,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub state: CompatSsoLoginState<T>,
|
||||
}
|
||||
|
@ -29,7 +29,10 @@ pub(crate) mod traits;
|
||||
pub(crate) mod users;
|
||||
|
||||
pub use self::{
|
||||
compat::{CompatAccessToken, CompatRefreshToken, CompatSession, Device},
|
||||
compat::{
|
||||
CompatAccessToken, CompatRefreshToken, CompatSession, CompatSsoLogin, CompatSsoLoginState,
|
||||
Device,
|
||||
},
|
||||
oauth2::{
|
||||
AuthorizationCode, AuthorizationGrant, AuthorizationGrantStage, Client,
|
||||
InvalidRedirectUriError, JwksOrJwksUri, Pkce, Session,
|
||||
|
@ -37,6 +37,7 @@ pub trait StorageBackend {
|
||||
type CompatAccessTokenData: Clone + Debug + PartialEq + Serialize + DeserializeOwned + Default;
|
||||
type CompatRefreshTokenData: Clone + Debug + PartialEq + Serialize + DeserializeOwned + Default;
|
||||
type CompatSessionData: Clone + Debug + PartialEq + Serialize + DeserializeOwned + Default;
|
||||
type CompatSsoLoginData: Clone + Debug + PartialEq + Serialize + DeserializeOwned + Default;
|
||||
}
|
||||
|
||||
impl StorageBackend for () {
|
||||
@ -48,6 +49,7 @@ impl StorageBackend for () {
|
||||
type CompatAccessTokenData = ();
|
||||
type CompatRefreshTokenData = ();
|
||||
type CompatSessionData = ();
|
||||
type CompatSsoLoginData = ();
|
||||
type RefreshTokenData = ();
|
||||
type SessionData = ();
|
||||
type UserData = ();
|
||||
|
Reference in New Issue
Block a user