blog_login_enum/
lib.rs

1//! Representations of auth transfer between the [`blog_client`](../blog_client) and [`server`](../server).
2
3use serde::{Deserialize, Serialize};
4
5/// Password authentication data. Separated from AuthenticationData to allow for impl blocks. Will
6/// go away once enum variants become types.
7#[derive(Serialize, Deserialize)]
8pub struct Password {
9    pub user_name: String,
10    pub password: String,
11}
12
13/// Actual data that needs to be verified before someone can log in.
14/// Currently only allows for passwords, but planning to support SSO and FIDO.
15#[derive(Serialize, Deserialize)]
16pub enum Authentication {
17    /// Data needed to fully specify a password credential from the request.
18    Password(Password),
19}
20
21/// Password authentication data. Separated from AuthenticationData to allow for impl blocks. Will
22/// go away once enum variants become types.
23#[derive(Serialize, Deserialize)]
24pub struct CreatePassword {
25    pub user_id: uuid::Uuid,
26    pub password: String,
27}
28
29/// Information for creating a credential.
30/// Currently only allows for passwords, but planning to support SSO and FIDO.
31#[derive(Serialize, Deserialize)]
32pub enum Create {
33    /// Data needed to fully specify a password credential from the request.
34    Password(CreatePassword),
35}