mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 04:27:02 +01:00
Add /.well-known/change-password endpoint (#3382)
* feat: Add /.well-known/change-password endpoint * fix: make the https view constants available inside the crate --------- Co-authored-by: James Hodgkinson <james@terminaloutcomes.com>
This commit is contained in:
parent
351fdcdef0
commit
f93d07b6cc
|
@ -1,10 +1,11 @@
|
|||
use axum::extract::State;
|
||||
use axum::http::header::CONTENT_TYPE;
|
||||
use axum::response::IntoResponse;
|
||||
use axum::response::{IntoResponse, Redirect};
|
||||
use axum::{Extension, Json};
|
||||
use kanidmd_lib::status::StatusRequestEvent;
|
||||
|
||||
use super::middleware::KOpId;
|
||||
use super::views::constants::Urls;
|
||||
use super::ServerState;
|
||||
|
||||
#[utoipa::path(
|
||||
|
@ -50,3 +51,15 @@ pub async fn robots_txt() -> impl IntoResponse {
|
|||
),
|
||||
)
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = Urls::WellKnownChangePassword.as_ref(),
|
||||
responses(
|
||||
(status = 303, description = "See other"),
|
||||
),
|
||||
tag = "ui",
|
||||
)]
|
||||
pub async fn redirect_to_update_credentials() -> impl IntoResponse {
|
||||
Redirect::to(Urls::UpdateCredentials.as_ref())
|
||||
}
|
||||
|
|
|
@ -251,7 +251,11 @@ pub async fn create_https_server(
|
|||
.merge(oauth2::route_setup(state.clone()))
|
||||
.merge(v1_scim::route_setup())
|
||||
.merge(v1::route_setup(state.clone()))
|
||||
.route("/robots.txt", get(generic::robots_txt));
|
||||
.route("/robots.txt", get(generic::robots_txt))
|
||||
.route(
|
||||
views::constants::Urls::WellKnownChangePassword.as_ref(),
|
||||
get(generic::redirect_to_update_credentials),
|
||||
);
|
||||
|
||||
let app = match config.role {
|
||||
ServerRole::WriteReplicaNoUI => app,
|
||||
|
|
|
@ -21,17 +21,16 @@ impl std::fmt::Display for UiMessage {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) enum Urls {
|
||||
Apps,
|
||||
CredReset,
|
||||
CredResetError,
|
||||
EnrolDevice,
|
||||
Profile,
|
||||
UpdateCredentials,
|
||||
Oauth2Resume,
|
||||
Login,
|
||||
Ui,
|
||||
WellKnownChangePassword,
|
||||
}
|
||||
|
||||
impl AsRef<str> for Urls {
|
||||
|
@ -39,13 +38,13 @@ impl AsRef<str> for Urls {
|
|||
match self {
|
||||
Self::Apps => "/ui/apps",
|
||||
Self::CredReset => "/ui/reset",
|
||||
Self::CredResetError => "/ui/reset/err",
|
||||
Self::EnrolDevice => "/ui/enrol",
|
||||
Self::Profile => "/ui/profile",
|
||||
Self::UpdateCredentials => "/ui/update_credentials",
|
||||
Self::Oauth2Resume => "/ui/oauth2/resume",
|
||||
Self::Login => "/ui/login",
|
||||
Self::Ui => "/ui",
|
||||
Self::WellKnownChangePassword => "/.well-known/change-password",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ use kanidmd_lib::{
|
|||
use crate::https::ServerState;
|
||||
|
||||
mod apps;
|
||||
mod constants;
|
||||
pub(crate) mod constants;
|
||||
mod cookies;
|
||||
mod enrol;
|
||||
mod errors;
|
||||
|
|
Loading…
Reference in a new issue