icarus_envy -> sienvy
This commit is contained in:
Generated
+15
-15
@@ -781,20 +781,6 @@ dependencies = [
|
|||||||
"tower-service",
|
"tower-service",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "icarus_models"
|
|
||||||
version = "0.11.3"
|
|
||||||
source = "git+ssh://git@git.kundeng.us/phoenix/icarus_models.git?tag=v0.11.3#859b0fb1b377370d8171e22e59893d86e41b258b"
|
|
||||||
dependencies = [
|
|
||||||
"josekit",
|
|
||||||
"rand",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"time",
|
|
||||||
"utoipa",
|
|
||||||
"uuid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "icu_collections"
|
name = "icu_collections"
|
||||||
version = "2.2.0"
|
version = "2.2.0"
|
||||||
@@ -1564,6 +1550,20 @@ version = "0.3.9"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214"
|
checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "simodels"
|
||||||
|
version = "0.11.3"
|
||||||
|
source = "git+ssh://git@git.kundeng.us/phoenix/simodels.git?tag=v0.11.3-main-fe9d101bd0-111#fe9d101bd019f91fe8c99c29721ccb0e6e90c92c"
|
||||||
|
dependencies = [
|
||||||
|
"josekit",
|
||||||
|
"rand",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"time",
|
||||||
|
"utoipa",
|
||||||
|
"uuid",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slab"
|
name = "slab"
|
||||||
version = "0.4.12"
|
version = "0.4.12"
|
||||||
@@ -1586,12 +1586,12 @@ dependencies = [
|
|||||||
"argon2",
|
"argon2",
|
||||||
"axum",
|
"axum",
|
||||||
"http-body-util",
|
"http-body-util",
|
||||||
"icarus_models",
|
|
||||||
"josekit",
|
"josekit",
|
||||||
"openssl",
|
"openssl",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sienvy",
|
"sienvy",
|
||||||
|
"simodels",
|
||||||
"sqlx",
|
"sqlx",
|
||||||
"time",
|
"time",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ time = { version = "0.3.53", features = ["macros", "serde"] }
|
|||||||
josekit = { version = "0.10.3" }
|
josekit = { version = "0.10.3" }
|
||||||
utoipa = { version = "5.5.0", features = ["axum_extras"] }
|
utoipa = { version = "5.5.0", features = ["axum_extras"] }
|
||||||
utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] }
|
utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] }
|
||||||
icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.11.3" }
|
simodels = { git = "ssh://git@git.kundeng.us/phoenix/simodels.git", tag = "v0.11.3-main-fe9d101bd0-111" }
|
||||||
sienvy = { git = "ssh://git@git.kundeng.us/phoenix/sienvy.git", tag = "v0.8.0-main-d06c8fdf49-006" }
|
sienvy = { git = "ssh://git@git.kundeng.us/phoenix/sienvy.git", tag = "v0.8.0-main-d06c8fdf49-006" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ pub mod response {
|
|||||||
#[derive(Default, Deserialize, Serialize, utoipa::ToSchema)]
|
#[derive(Default, Deserialize, Serialize, utoipa::ToSchema)]
|
||||||
pub struct Response {
|
pub struct Response {
|
||||||
pub message: String,
|
pub message: String,
|
||||||
pub data: Vec<icarus_models::login_result::LoginResult>,
|
pub data: Vec<simodels::login_result::LoginResult>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod service_login {
|
pub mod service_login {
|
||||||
#[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
|
#[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
|
||||||
pub struct Response {
|
pub struct Response {
|
||||||
pub message: String,
|
pub message: String,
|
||||||
pub data: Vec<icarus_models::login_result::LoginResult>,
|
pub data: Vec<simodels::login_result::LoginResult>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ pub mod response {
|
|||||||
#[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
|
#[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
|
||||||
pub struct Response {
|
pub struct Response {
|
||||||
pub message: String,
|
pub message: String,
|
||||||
pub data: Vec<icarus_models::login_result::LoginResult>,
|
pub data: Vec<simodels::login_result::LoginResult>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,11 +104,11 @@ pub mod endpoint {
|
|||||||
StatusCode::OK,
|
StatusCode::OK,
|
||||||
Json(response::Response {
|
Json(response::Response {
|
||||||
message: String::from("Successful"),
|
message: String::from("Successful"),
|
||||||
data: vec![icarus_models::login_result::LoginResult {
|
data: vec![simodels::login_result::LoginResult {
|
||||||
id: user.id,
|
id: user.id,
|
||||||
username: user.username.clone(),
|
username: user.username.clone(),
|
||||||
token: token_literal,
|
token: token_literal,
|
||||||
token_type: String::from(icarus_models::token::TOKEN_TYPE),
|
token_type: String::from(simodels::token::TOKEN_TYPE),
|
||||||
expiration: duration,
|
expiration: duration,
|
||||||
}],
|
}],
|
||||||
}),
|
}),
|
||||||
@@ -156,11 +156,11 @@ pub mod endpoint {
|
|||||||
token_stuff::create_service_token(&key, &id).unwrap();
|
token_stuff::create_service_token(&key, &id).unwrap();
|
||||||
|
|
||||||
if token_stuff::verify_token(&key, &token_literal) {
|
if token_stuff::verify_token(&key, &token_literal) {
|
||||||
let login_result = icarus_models::login_result::LoginResult {
|
let login_result = simodels::login_result::LoginResult {
|
||||||
id,
|
id,
|
||||||
username,
|
username,
|
||||||
token: token_literal,
|
token: token_literal,
|
||||||
token_type: String::from(icarus_models::token::TOKEN_TYPE),
|
token_type: String::from(simodels::token::TOKEN_TYPE),
|
||||||
expiration: duration,
|
expiration: duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -215,11 +215,11 @@ pub mod endpoint {
|
|||||||
Ok((username, _, _)) => {
|
Ok((username, _, _)) => {
|
||||||
match token_stuff::create_service_refresh_token(&key, &id) {
|
match token_stuff::create_service_refresh_token(&key, &id) {
|
||||||
Ok((access_token, exp_dur)) => {
|
Ok((access_token, exp_dur)) => {
|
||||||
let login_result = icarus_models::login_result::LoginResult {
|
let login_result = simodels::login_result::LoginResult {
|
||||||
id,
|
id,
|
||||||
token: access_token,
|
token: access_token,
|
||||||
expiration: exp_dur,
|
expiration: exp_dur,
|
||||||
token_type: String::from(icarus_models::token::TOKEN_TYPE),
|
token_type: String::from(simodels::token::TOKEN_TYPE),
|
||||||
username,
|
username,
|
||||||
};
|
};
|
||||||
response.message = String::from("Successful");
|
response.message = String::from("Successful");
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ pub mod response {
|
|||||||
#[derive(Deserialize, Serialize, utoipa::ToSchema)]
|
#[derive(Deserialize, Serialize, utoipa::ToSchema)]
|
||||||
pub struct Response {
|
pub struct Response {
|
||||||
pub message: String,
|
pub message: String,
|
||||||
pub data: Vec<icarus_models::user::User>,
|
pub data: Vec<simodels::user::User>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ pub async fn register_user(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if registration_enabled {
|
if registration_enabled {
|
||||||
let mut user = icarus_models::user::User {
|
let mut user = simodels::user::User {
|
||||||
username: payload.username.clone(),
|
username: payload.username.clone(),
|
||||||
password: payload.password.clone(),
|
password: payload.password.clone(),
|
||||||
email: payload.email.clone(),
|
email: payload.email.clone(),
|
||||||
@@ -91,7 +91,7 @@ pub async fn register_user(
|
|||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
let salt_string = hashing::generate_salt().unwrap();
|
let salt_string = hashing::generate_salt().unwrap();
|
||||||
let mut salt = icarus_models::user::salt::Salt::default();
|
let mut salt = simodels::user::salt::Salt::default();
|
||||||
let generated_salt = salt_string;
|
let generated_salt = salt_string;
|
||||||
salt.salt = generated_salt.to_string();
|
salt.salt = generated_salt.to_string();
|
||||||
salt.id = repo::salt::insert(&pool, &salt).await.unwrap();
|
salt.id = repo::salt::insert(&pool, &salt).await.unwrap();
|
||||||
|
|||||||
+7
-7
@@ -12,7 +12,7 @@ pub mod user {
|
|||||||
pub async fn get(
|
pub async fn get(
|
||||||
pool: &sqlx::PgPool,
|
pool: &sqlx::PgPool,
|
||||||
username: &String,
|
username: &String,
|
||||||
) -> Result<icarus_models::user::User, sqlx::Error> {
|
) -> Result<simodels::user::User, sqlx::Error> {
|
||||||
let result = sqlx::query(
|
let result = sqlx::query(
|
||||||
r#"
|
r#"
|
||||||
SELECT * FROM "user" WHERE username = $1
|
SELECT * FROM "user" WHERE username = $1
|
||||||
@@ -24,7 +24,7 @@ pub mod user {
|
|||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(r) => match r {
|
Ok(r) => match r {
|
||||||
Some(r) => Ok(icarus_models::user::User {
|
Some(r) => Ok(simodels::user::User {
|
||||||
id: r.try_get("id")?,
|
id: r.try_get("id")?,
|
||||||
username: r.try_get("username")?,
|
username: r.try_get("username")?,
|
||||||
password: r.try_get("password")?,
|
password: r.try_get("password")?,
|
||||||
@@ -46,7 +46,7 @@ pub mod user {
|
|||||||
|
|
||||||
pub async fn update_last_login(
|
pub async fn update_last_login(
|
||||||
pool: &sqlx::PgPool,
|
pool: &sqlx::PgPool,
|
||||||
user: &icarus_models::user::User,
|
user: &simodels::user::User,
|
||||||
time: &time::OffsetDateTime,
|
time: &time::OffsetDateTime,
|
||||||
) -> Result<time::OffsetDateTime, sqlx::Error> {
|
) -> Result<time::OffsetDateTime, sqlx::Error> {
|
||||||
let result = sqlx::query(
|
let result = sqlx::query(
|
||||||
@@ -95,7 +95,7 @@ pub mod user {
|
|||||||
|
|
||||||
pub async fn insert(
|
pub async fn insert(
|
||||||
pool: &sqlx::PgPool,
|
pool: &sqlx::PgPool,
|
||||||
user: &icarus_models::user::User,
|
user: &simodels::user::User,
|
||||||
) -> Result<(uuid::Uuid, std::option::Option<time::OffsetDateTime>), sqlx::Error> {
|
) -> Result<(uuid::Uuid, std::option::Option<time::OffsetDateTime>), sqlx::Error> {
|
||||||
let row = sqlx::query(
|
let row = sqlx::query(
|
||||||
r#"
|
r#"
|
||||||
@@ -145,7 +145,7 @@ pub mod salt {
|
|||||||
pub async fn get(
|
pub async fn get(
|
||||||
pool: &sqlx::PgPool,
|
pool: &sqlx::PgPool,
|
||||||
id: &uuid::Uuid,
|
id: &uuid::Uuid,
|
||||||
) -> Result<icarus_models::user::salt::Salt, sqlx::Error> {
|
) -> Result<simodels::user::salt::Salt, sqlx::Error> {
|
||||||
let result = sqlx::query(
|
let result = sqlx::query(
|
||||||
r#"
|
r#"
|
||||||
SELECT * FROM "salt" WHERE id = $1
|
SELECT * FROM "salt" WHERE id = $1
|
||||||
@@ -157,7 +157,7 @@ pub mod salt {
|
|||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(r) => match r {
|
Ok(r) => match r {
|
||||||
Some(r) => Ok(icarus_models::user::salt::Salt {
|
Some(r) => Ok(simodels::user::salt::Salt {
|
||||||
id: r.try_get("id")?,
|
id: r.try_get("id")?,
|
||||||
salt: r.try_get("salt")?,
|
salt: r.try_get("salt")?,
|
||||||
}),
|
}),
|
||||||
@@ -169,7 +169,7 @@ pub mod salt {
|
|||||||
|
|
||||||
pub async fn insert(
|
pub async fn insert(
|
||||||
pool: &sqlx::PgPool,
|
pool: &sqlx::PgPool,
|
||||||
salt: &icarus_models::user::salt::Salt,
|
salt: &simodels::user::salt::Salt,
|
||||||
) -> Result<uuid::Uuid, sqlx::Error> {
|
) -> Result<uuid::Uuid, sqlx::Error> {
|
||||||
let row = sqlx::query(
|
let row = sqlx::query(
|
||||||
r#"
|
r#"
|
||||||
|
|||||||
@@ -24,39 +24,39 @@ pub fn create_token(
|
|||||||
provided_key: &String,
|
provided_key: &String,
|
||||||
id: &uuid::Uuid,
|
id: &uuid::Uuid,
|
||||||
) -> Result<(String, i64), josekit::JoseError> {
|
) -> Result<(String, i64), josekit::JoseError> {
|
||||||
let resource = icarus_models::token::TokenResource {
|
let resource = simodels::token::TokenResource {
|
||||||
message: String::from(MESSAGE),
|
message: String::from(MESSAGE),
|
||||||
issuer: String::from(ISSUER),
|
issuer: String::from(ISSUER),
|
||||||
audiences: vec![String::from(AUDIENCE)],
|
audiences: vec![String::from(AUDIENCE)],
|
||||||
id: *id,
|
id: *id,
|
||||||
};
|
};
|
||||||
icarus_models::token::create_token(provided_key, &resource, time::Duration::hours(4))
|
simodels::token::create_token(provided_key, &resource, time::Duration::hours(4))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_service_token(
|
pub fn create_service_token(
|
||||||
provided: &String,
|
provided: &String,
|
||||||
id: &uuid::Uuid,
|
id: &uuid::Uuid,
|
||||||
) -> Result<(String, i64), josekit::JoseError> {
|
) -> Result<(String, i64), josekit::JoseError> {
|
||||||
let resource = icarus_models::token::TokenResource {
|
let resource = simodels::token::TokenResource {
|
||||||
message: String::from(SERVICE_SUBJECT),
|
message: String::from(SERVICE_SUBJECT),
|
||||||
issuer: String::from(ISSUER),
|
issuer: String::from(ISSUER),
|
||||||
audiences: vec![String::from(AUDIENCE)],
|
audiences: vec![String::from(AUDIENCE)],
|
||||||
id: *id,
|
id: *id,
|
||||||
};
|
};
|
||||||
icarus_models::token::create_token(provided, &resource, time::Duration::hours(1))
|
simodels::token::create_token(provided, &resource, time::Duration::hours(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_service_refresh_token(
|
pub fn create_service_refresh_token(
|
||||||
key: &String,
|
key: &String,
|
||||||
id: &uuid::Uuid,
|
id: &uuid::Uuid,
|
||||||
) -> Result<(String, i64), josekit::JoseError> {
|
) -> Result<(String, i64), josekit::JoseError> {
|
||||||
let resource = icarus_models::token::TokenResource {
|
let resource = simodels::token::TokenResource {
|
||||||
message: String::from(SERVICE_SUBJECT),
|
message: String::from(SERVICE_SUBJECT),
|
||||||
issuer: String::from(ISSUER),
|
issuer: String::from(ISSUER),
|
||||||
audiences: vec![String::from(AUDIENCE)],
|
audiences: vec![String::from(AUDIENCE)],
|
||||||
id: *id,
|
id: *id,
|
||||||
};
|
};
|
||||||
icarus_models::token::create_token(key, &resource, time::Duration::hours(4))
|
simodels::token::create_token(key, &resource, time::Duration::hours(4))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn verify_token(key: &String, token: &String) -> bool {
|
pub fn verify_token(key: &String, token: &String) -> bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user