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
target/*
app/target/*
model/target/*
auth/target/*
# Don't track the generated JS
app/pkg/*

2
.gitignore vendored
View file

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

6
Cargo.lock generated
View file

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

View file

@ -1,5 +1,5 @@
[workspace]
members = [".", "model", "app"]
members = [".", "auth", "app"]
[package]
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 = "*"
jwt = "0.13"
ldap3_server = "*"
lldap_model = { path = "model" }
lldap_auth = { path = "auth" }
log = "*"
orion = "0.16"
serde = "*"

View file

@ -49,13 +49,13 @@ Data storage:
### Code organization
* `model/`: Contains the shared data, the interface between front and back-end.
The data is transferred by being serialized to JSON, for compatibility with
other HTTP-based clients.
* `auth/`: Contains the shared structures needed for authentication, the
interface between front and back-end. In particular, it contains the OPAQUE
structures and the JWT format.
* `app/`: The frontend.
* `src/`: The backend.
* `domain/`: Domain-specific logic: users, groups, checking passwords...
* `infra/`: API, both HTTP and LDAP
* `infra/`: API, both GraphQL and LDAP
## 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.
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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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