1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-08-09 04:22:45 +03:00

Email management UI

Also simplify a bunch of query strings
This commit is contained in:
Quentin Gliech
2022-01-18 18:16:56 +01:00
parent 0c2950a160
commit 6e50921626
17 changed files with 544 additions and 129 deletions

View File

@@ -12,18 +12,22 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::fmt::Debug;
use serde::{de::DeserializeOwned, Serialize};
pub trait StorageBackendMarker: StorageBackend {}
pub trait StorageBackend {
type UserData: Clone + std::fmt::Debug + PartialEq;
type UserEmailData: Clone + std::fmt::Debug + PartialEq;
type AuthenticationData: Clone + std::fmt::Debug + PartialEq;
type BrowserSessionData: Clone + std::fmt::Debug + PartialEq;
type ClientData: Clone + std::fmt::Debug + PartialEq;
type SessionData: Clone + std::fmt::Debug + PartialEq;
type AuthorizationGrantData: Clone + std::fmt::Debug + PartialEq;
type AccessTokenData: Clone + std::fmt::Debug + PartialEq;
type RefreshTokenData: Clone + std::fmt::Debug + PartialEq;
type UserData: Clone + Debug + PartialEq + Serialize + DeserializeOwned + Default;
type UserEmailData: Clone + Debug + PartialEq + Serialize + DeserializeOwned + Default;
type AuthenticationData: Clone + Debug + PartialEq + Serialize + DeserializeOwned + Default;
type BrowserSessionData: Clone + Debug + PartialEq + Serialize + DeserializeOwned + Default;
type ClientData: Clone + Debug + PartialEq + Serialize + DeserializeOwned + Default;
type SessionData: Clone + Debug + PartialEq + Serialize + DeserializeOwned + Default;
type AuthorizationGrantData: Clone + Debug + PartialEq + Serialize + DeserializeOwned + Default;
type AccessTokenData: Clone + Debug + PartialEq + Serialize + DeserializeOwned + Default;
type RefreshTokenData: Clone + Debug + PartialEq + Serialize + DeserializeOwned + Default;
}
impl StorageBackend for () {

View File

@@ -20,7 +20,6 @@ use crate::traits::{StorageBackend, StorageBackendMarker};
#[derive(Debug, Clone, PartialEq, Serialize)]
#[serde(bound = "T: StorageBackend")]
pub struct User<T: StorageBackend> {
#[serde(skip_serializing)]
pub data: T::UserData,
pub username: String,
pub sub: String,
@@ -73,7 +72,6 @@ impl<S: StorageBackendMarker> From<Authentication<S>> for Authentication<()> {
#[derive(Debug, Clone, PartialEq, Serialize)]
#[serde(bound = "T: StorageBackend")]
pub struct BrowserSession<T: StorageBackend> {
#[serde(skip_serializing)]
pub data: T::BrowserSessionData,
pub user: User<T>,
pub created_at: DateTime<Utc>,
@@ -113,7 +111,6 @@ where
#[derive(Debug, Clone, PartialEq, Serialize)]
#[serde(bound = "T: StorageBackend")]
pub struct UserEmail<T: StorageBackend> {
#[serde(skip_serializing)]
pub data: T::UserEmailData,
pub email: String,
pub created_at: DateTime<Utc>,