model: rename to auth

Since the "model" doesn't contain any message from the API anymore, and
instead contains only the structures needed for authentication, it was
renamed as such.
This commit is contained in:
Valentin Tolmer 2021-08-31 16:29:49 +02:00 committed by nitnelave
parent 9dd579e32e
commit 3eb53ba5bf
18 changed files with 24 additions and 24 deletions

View File

@ -4,7 +4,7 @@
# Don't track cargo generated files # Don't track cargo generated files
target/* target/*
app/target/* app/target/*
model/target/* auth/target/*
# Don't track the generated JS # Don't track the generated JS
app/pkg/* app/pkg/*

2
.gitignore vendored
View File

@ -3,7 +3,7 @@
/target/ /target/
/app/target /app/target
/app/pkg /app/pkg
/model/target /auth/target
# These are backup files generated by rustfmt # These are backup files generated by rustfmt
**/*.rs.bk **/*.rs.bk

6
Cargo.lock generated
View File

@ -1721,7 +1721,7 @@ dependencies = [
"juniper_actix", "juniper_actix",
"jwt", "jwt",
"ldap3_server", "ldap3_server",
"lldap_model", "lldap_auth",
"log", "log",
"mockall", "mockall",
"opaque-ke", "opaque-ke",
@ -1752,7 +1752,7 @@ dependencies = [
"graphql_client", "graphql_client",
"http", "http",
"jwt", "jwt",
"lldap_model", "lldap_auth",
"rand 0.8.3", "rand 0.8.3",
"serde", "serde",
"serde_json", "serde_json",
@ -1763,7 +1763,7 @@ dependencies = [
] ]
[[package]] [[package]]
name = "lldap_model" name = "lldap_auth"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"chrono", "chrono",

View File

@ -1,5 +1,5 @@
[workspace] [workspace]
members = [".", "model", "app"] members = [".", "auth", "app"]
[package] [package]
authors = ["Valentin Tolmer <valentin@tolmer.fr>", "Steve Barrau <steve.barrau@gmail.com>", "Thomas Wickham <mackwic@gmail.com>"] authors = ["Valentin Tolmer <valentin@tolmer.fr>", "Steve Barrau <steve.barrau@gmail.com>", "Thomas Wickham <mackwic@gmail.com>"]
@ -30,7 +30,7 @@ hmac = "0.10"
http = "*" http = "*"
jwt = "0.13" jwt = "0.13"
ldap3_server = "*" ldap3_server = "*"
lldap_model = { path = "model" } lldap_auth = { path = "auth" }
log = "*" log = "*"
orion = "0.16" orion = "0.16"
serde = "*" serde = "*"

View File

@ -49,13 +49,13 @@ Data storage:
### Code organization ### Code organization
* `model/`: Contains the shared data, the interface between front and back-end. * `auth/`: Contains the shared structures needed for authentication, the
The data is transferred by being serialized to JSON, for compatibility with interface between front and back-end. In particular, it contains the OPAQUE
other HTTP-based clients. structures and the JWT format.
* `app/`: The frontend. * `app/`: The frontend.
* `src/`: The backend. * `src/`: The backend.
* `domain/`: Domain-specific logic: users, groups, checking passwords... * `domain/`: Domain-specific logic: users, groups, checking passwords...
* `infra/`: API, both HTTP and LDAP * `infra/`: API, both GraphQL and LDAP
## Authentication ## Authentication
@ -99,7 +99,7 @@ We don't have a code of conduct, just be respectful and remember that it's just
normal people doing this for free on their free time. normal people doing this for free on their free time.
Make sure that you run `cargo fmt` in each crate that you modified (top-level, Make sure that you run `cargo fmt` in each crate that you modified (top-level,
`app/` and `model/`) before creating the PR. `app/` and `auth/`) before creating the PR.
### Setup ### Setup

View File

@ -31,8 +31,8 @@ features = [
"wasmbind" "wasmbind"
] ]
[dependencies.lldap_model] [dependencies.lldap_auth]
path = "../model" path = "../auth"
features = [ "opaque_client" ] features = [ "opaque_client" ]
[lib] [lib]

View File

@ -1,7 +1,7 @@
use crate::cookies::set_cookie; use crate::cookies::set_cookie;
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use graphql_client::GraphQLQuery; use graphql_client::GraphQLQuery;
use lldap_model::{login, registration, JWTClaims}; use lldap_auth::{login, registration, JWTClaims};
use yew::callback::Callback; use yew::callback::Callback;
use yew::format::Json; use yew::format::Json;

View File

@ -1,7 +1,7 @@
use crate::api::HostService; use crate::api::HostService;
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use graphql_client::GraphQLQuery; use graphql_client::GraphQLQuery;
use lldap_model::{opaque, registration}; use lldap_auth::{opaque, registration};
use yew::prelude::*; use yew::prelude::*;
use yew::services::{fetch::FetchTask, ConsoleService}; use yew::services::{fetch::FetchTask, ConsoleService};
use yew_router::{ use yew_router::{

View File

@ -1,6 +1,6 @@
use crate::api::HostService; use crate::api::HostService;
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use lldap_model::*; use lldap_auth::*;
use wasm_bindgen::JsCast; use wasm_bindgen::JsCast;
use yew::prelude::*; use yew::prelude::*;
use yew::services::{fetch::FetchTask, ConsoleService}; use yew::services::{fetch::FetchTask, ConsoleService};

View File

@ -1,5 +1,5 @@
[package] [package]
name = "lldap_model" name = "lldap_auth"
version = "0.1.0" version = "0.1.0"
authors = ["Valentin Tolmer <valentin@tolmer.fr>", "Steve Barrau <steve.barrau@gmail.com>", "Thomas Wickham <mackwic@gmail.com>"] authors = ["Valentin Tolmer <valentin@tolmer.fr>", "Steve Barrau <steve.barrau@gmail.com>", "Thomas Wickham <mackwic@gmail.com>"]
edition = "2018" edition = "2018"

View File

@ -8,7 +8,7 @@ pub enum DomainError {
#[error("Database error: `{0}`")] #[error("Database error: `{0}`")]
DatabaseError(#[from] sqlx::Error), DatabaseError(#[from] sqlx::Error),
#[error("Authentication protocol error for `{0}`")] #[error("Authentication protocol error for `{0}`")]
AuthenticationProtocolError(#[from] lldap_model::opaque::AuthenticationError), AuthenticationProtocolError(#[from] lldap_auth::opaque::AuthenticationError),
#[error("Unknown crypto error: `{0}`")] #[error("Unknown crypto error: `{0}`")]
UnknownCryptoError(#[from] orion::errors::UnknownCryptoError), UnknownCryptoError(#[from] orion::errors::UnknownCryptoError),
#[error("Binary serialization error: `{0}`")] #[error("Binary serialization error: `{0}`")]

View File

@ -1,7 +1,7 @@
use super::error::*; use super::error::*;
use async_trait::async_trait; use async_trait::async_trait;
pub use lldap_model::{login, registration}; pub use lldap_auth::{login, registration};
#[async_trait] #[async_trait]
pub trait OpaqueHandler: Clone + Send { pub trait OpaqueHandler: Clone + Send {

View File

@ -234,7 +234,7 @@ mod tests {
use super::*; use super::*;
use crate::domain::sql_tables::init_table; use crate::domain::sql_tables::init_table;
use crate::infra::configuration::ConfigurationBuilder; use crate::infra::configuration::ConfigurationBuilder;
use lldap_model::{opaque, registration}; use lldap_auth::{opaque, registration};
fn get_default_config() -> Configuration { fn get_default_config() -> Configuration {
ConfigurationBuilder::default() ConfigurationBuilder::default()

View File

@ -6,7 +6,7 @@ use super::{
sql_tables::*, sql_tables::*,
}; };
use async_trait::async_trait; use async_trait::async_trait;
use lldap_model::opaque; use lldap_auth::opaque;
use log::*; use log::*;
use sea_query::{Expr, Iden, Query}; use sea_query::{Expr, Iden, Query};
use sqlx::Row; use sqlx::Row;

View File

@ -21,7 +21,7 @@ use futures::future::{ok, Ready};
use futures_util::{FutureExt, TryFutureExt}; use futures_util::{FutureExt, TryFutureExt};
use hmac::Hmac; use hmac::Hmac;
use jwt::{SignWithKey, VerifyWithKey}; use jwt::{SignWithKey, VerifyWithKey};
use lldap_model::{login, registration, JWTClaims}; use lldap_auth::{login, registration, JWTClaims};
use sha2::Sha512; use sha2::Sha512;
use std::collections::{hash_map::DefaultHasher, HashSet}; use std::collections::{hash_map::DefaultHasher, HashSet};
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};

View File

@ -3,7 +3,7 @@ use figment::{
providers::{Env, Format, Serialized, Toml}, providers::{Env, Format, Serialized, Toml},
Figment, Figment,
}; };
use lldap_model::opaque::{server::ServerSetup, KeyPair}; use lldap_auth::opaque::{server::ServerSetup, KeyPair};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::infra::cli::RunOpts; use crate::infra::cli::RunOpts;