Can disable auth
This commit is contained in:
@ -124,7 +124,7 @@ struct CurrentUser {
|
||||
/// Get current authenticated user
|
||||
pub async fn current_user(auth: AuthExtractor) -> impl Responder {
|
||||
HttpResponse::Ok().json(CurrentUser {
|
||||
id: auth.id().unwrap(),
|
||||
id: auth.id().unwrap_or_else(|| "Anonymous".to_string()),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ pub async fn root_index() -> impl Responder {
|
||||
|
||||
#[derive(serde::Serialize)]
|
||||
struct StaticConfig {
|
||||
auth_disabled: bool,
|
||||
local_auth_enabled: bool,
|
||||
oidc_auth_enabled: bool,
|
||||
iso_mimetypes: &'static [&'static str],
|
||||
@ -19,6 +20,7 @@ struct StaticConfig {
|
||||
|
||||
pub async fn static_config(local_auth: LocalAuthEnabled) -> impl Responder {
|
||||
HttpResponse::Ok().json(StaticConfig {
|
||||
auth_disabled: AppConfig::get().unsecure_disable_auth,
|
||||
local_auth_enabled: *local_auth,
|
||||
oidc_auth_enabled: !AppConfig::get().disable_oidc,
|
||||
iso_mimetypes: &constants::ALLOWED_ISO_MIME_TYPES,
|
||||
|
Reference in New Issue
Block a user