Compare commits
1 Commits
23cfda38c6
...
9c54433ada
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c54433ada |
1159
matrixgw_backend/Cargo.lock
generated
1159
matrixgw_backend/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -4,26 +4,27 @@ version = "0.1.0"
|
|||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
env_logger = "0.11.9"
|
env_logger = "0.11.8"
|
||||||
log = "0.4.29"
|
log = "0.4.29"
|
||||||
clap = { version = "4.5.59", features = ["derive", "env"] }
|
clap = { version = "4.5.57", features = ["derive", "env"] }
|
||||||
|
lazy_static = "1.5.0"
|
||||||
anyhow = "1.0.101"
|
anyhow = "1.0.101"
|
||||||
serde = { version = "1.0.228", features = ["derive"] }
|
serde = { version = "1.0.228", features = ["derive"] }
|
||||||
tokio = { version = "1.49.0", features = ["full"] }
|
tokio = { version = "1.48.0", features = ["full"] }
|
||||||
actix-web = "4.13.0"
|
actix-web = "4.12.1"
|
||||||
actix-session = { version = "0.11.0", features = ["redis-session"] }
|
actix-session = { version = "0.11.0", features = ["redis-session"] }
|
||||||
actix-remote-ip = "0.1.0"
|
actix-remote-ip = "0.1.0"
|
||||||
actix-cors = "0.7.1"
|
actix-cors = "0.7.1"
|
||||||
light-openid = "1.1.0"
|
light-openid = "1.1.0"
|
||||||
bytes = "1.11.1"
|
bytes = "1.11.1"
|
||||||
sha2 = "0.11.0-rc.5"
|
sha2 = "0.10.9"
|
||||||
base16ct = { version = "1.0.0", features = ["alloc"] }
|
base16ct = { version = "0.3.0", features = ["alloc"] }
|
||||||
futures-util = "0.3.32"
|
futures-util = "0.3.31"
|
||||||
jwt-simple = { version = "0.12.14", default-features = false, features = ["pure-rust"] }
|
jwt-simple = { version = "0.12.14", default-features = false, features = ["pure-rust"] }
|
||||||
thiserror = "2.0.18"
|
thiserror = "2.0.18"
|
||||||
uuid = { version = "1.21.0", features = ["v4", "serde"] }
|
uuid = { version = "1.19.0", features = ["v4", "serde"] }
|
||||||
ipnet = { version = "2.11.0", features = ["serde"] }
|
ipnet = { version = "2.11.0", features = ["serde"] }
|
||||||
rand = "0.10.0"
|
rand = "0.9.2"
|
||||||
hex = "0.4.3"
|
hex = "0.4.3"
|
||||||
mailchecker = "6.0.19"
|
mailchecker = "6.0.19"
|
||||||
matrix-sdk = { version = "0.16.0", features = ["e2e-encryption"] }
|
matrix-sdk = { version = "0.16.0", features = ["e2e-encryption"] }
|
||||||
@@ -31,7 +32,7 @@ matrix-sdk-ui = "0.16.0"
|
|||||||
url = "2.5.8"
|
url = "2.5.8"
|
||||||
ractor = "0.15.10"
|
ractor = "0.15.10"
|
||||||
serde_json = "1.0.149"
|
serde_json = "1.0.149"
|
||||||
lazy-regex = "3.6.0"
|
lazy-regex = "3.5.1"
|
||||||
actix-ws = "0.3.1"
|
actix-ws = "0.3.1"
|
||||||
infer = "0.19.0"
|
infer = "0.19.0"
|
||||||
rust-embed = "8.11.0"
|
rust-embed = "8.11.0"
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ use matrix_sdk::authentication::oauth::registration::{
|
|||||||
ApplicationType, ClientMetadata, Localized, OAuthGrantType,
|
ApplicationType, ClientMetadata, Localized, OAuthGrantType,
|
||||||
};
|
};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::OnceLock;
|
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
/// Matrix gateway backend API
|
/// Matrix gateway backend API
|
||||||
@@ -90,12 +89,16 @@ pub struct AppConfig {
|
|||||||
storage_path: String,
|
storage_path: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
static ARGS: OnceLock<AppConfig> = OnceLock::new();
|
lazy_static::lazy_static! {
|
||||||
|
static ref ARGS: AppConfig = {
|
||||||
|
AppConfig::parse()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
impl AppConfig {
|
impl AppConfig {
|
||||||
/// Get parsed command line arguments
|
/// Get parsed command line arguments
|
||||||
pub fn get() -> &'static AppConfig {
|
pub fn get() -> &'static AppConfig {
|
||||||
ARGS.get_or_init(AppConfig::parse)
|
&ARGS
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get auto login email (if not empty)
|
/// Get auto login email (if not empty)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use crate::app_config::AppConfig;
|
use crate::app_config::AppConfig;
|
||||||
use crate::broadcast_messages::BroadcastSender;
|
use crate::broadcast_messages::BroadcastSender;
|
||||||
use crate::controllers::HttpResult;
|
use crate::controllers::{HttpFailure, HttpResult};
|
||||||
use crate::extractors::auth_extractor::{AuthExtractor, AuthenticatedMethod};
|
use crate::extractors::auth_extractor::{AuthExtractor, AuthenticatedMethod};
|
||||||
use crate::extractors::matrix_client_extractor::MatrixClientExtractor;
|
use crate::extractors::matrix_client_extractor::MatrixClientExtractor;
|
||||||
use crate::extractors::session_extractor::MatrixGWSession;
|
use crate::extractors::session_extractor::MatrixGWSession;
|
||||||
@@ -63,7 +63,9 @@ pub async fn finish_oidc(
|
|||||||
|
|
||||||
let prov = AppConfig::get().openid_provider();
|
let prov = AppConfig::get().openid_provider();
|
||||||
|
|
||||||
let conf = OpenIDConfig::load_from_url(prov.configuration_url).await?;
|
let conf = OpenIDConfig::load_from_url(prov.configuration_url)
|
||||||
|
.await
|
||||||
|
.map_err(HttpFailure::OpenID)?;
|
||||||
|
|
||||||
let (token, _) = conf
|
let (token, _) = conf
|
||||||
.request_token(
|
.request_token(
|
||||||
@@ -72,8 +74,12 @@ pub async fn finish_oidc(
|
|||||||
&req.code,
|
&req.code,
|
||||||
&AppConfig::get().openid_provider().redirect_url,
|
&AppConfig::get().openid_provider().redirect_url,
|
||||||
)
|
)
|
||||||
.await?;
|
.await
|
||||||
let (user_info, _) = conf.request_user_info(&token).await?;
|
.map_err(HttpFailure::OpenID)?;
|
||||||
|
let (user_info, _) = conf
|
||||||
|
.request_user_info(&token)
|
||||||
|
.await
|
||||||
|
.map_err(HttpFailure::OpenID)?;
|
||||||
|
|
||||||
if user_info.email_verified != Some(true) {
|
if user_info.email_verified != Some(true) {
|
||||||
log::error!("Email is not verified!");
|
log::error!("Email is not verified!");
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use actix_web::http::StatusCode;
|
use actix_web::http::StatusCode;
|
||||||
use actix_web::{HttpResponse, ResponseError};
|
use actix_web::{HttpResponse, ResponseError};
|
||||||
use light_openid::errors::OpenIdError;
|
use std::error::Error;
|
||||||
|
|
||||||
pub mod auth_controller;
|
pub mod auth_controller;
|
||||||
pub mod matrix;
|
pub mod matrix;
|
||||||
@@ -18,7 +18,7 @@ pub enum HttpFailure {
|
|||||||
#[error("this resource was not found")]
|
#[error("this resource was not found")]
|
||||||
NotFound,
|
NotFound,
|
||||||
#[error("an unspecified open id error occurred: {0}")]
|
#[error("an unspecified open id error occurred: {0}")]
|
||||||
OpenID(#[from] OpenIdError),
|
OpenID(Box<dyn Error>),
|
||||||
#[error("an unspecified internal error occurred: {0}")]
|
#[error("an unspecified internal error occurred: {0}")]
|
||||||
InternalError(#[from] anyhow::Error),
|
InternalError(#[from] anyhow::Error),
|
||||||
#[error("Actix web error: {0}")]
|
#[error("Actix web error: {0}")]
|
||||||
|
|||||||
Reference in New Issue
Block a user