You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-11-20 12:02:22 +03:00
Allow running the authentication service on a different base path
This commit is contained in:
@@ -16,6 +16,7 @@ use serde::{Deserialize, Serialize};
|
||||
use ulid::Ulid;
|
||||
|
||||
pub use crate::traits::*;
|
||||
use crate::UrlBuilder;
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone, Debug)]
|
||||
#[serde(rename_all = "snake_case", tag = "kind")]
|
||||
@@ -57,16 +58,19 @@ impl PostAuthAction {
|
||||
PostAuthAction::ManageAccount { action }
|
||||
}
|
||||
|
||||
pub fn go_next(&self) -> axum::response::Redirect {
|
||||
pub fn go_next(&self, url_builder: &UrlBuilder) -> axum::response::Redirect {
|
||||
match self {
|
||||
Self::ContinueAuthorizationGrant { id } => ContinueAuthorizationGrant(*id).go(),
|
||||
Self::ContinueCompatSsoLogin { id } => CompatLoginSsoComplete::new(*id, None).go(),
|
||||
Self::ChangePassword => AccountPassword.go(),
|
||||
Self::LinkUpstream { id } => UpstreamOAuth2Link::new(*id).go(),
|
||||
Self::ManageAccount { action } => Account {
|
||||
action: action.clone(),
|
||||
Self::ContinueAuthorizationGrant { id } => {
|
||||
url_builder.redirect(&ContinueAuthorizationGrant(*id))
|
||||
}
|
||||
.go(),
|
||||
Self::ContinueCompatSsoLogin { id } => {
|
||||
url_builder.redirect(&CompatLoginSsoComplete::new(*id, None))
|
||||
}
|
||||
Self::ChangePassword => url_builder.redirect(&AccountPassword),
|
||||
Self::LinkUpstream { id } => url_builder.redirect(&UpstreamOAuth2Link::new(*id)),
|
||||
Self::ManageAccount { action } => url_builder.redirect(&Account {
|
||||
action: action.clone(),
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -219,10 +223,10 @@ impl Login {
|
||||
self.post_auth_action.as_ref()
|
||||
}
|
||||
|
||||
pub fn go_next(&self) -> axum::response::Redirect {
|
||||
pub fn go_next(&self, url_builder: &UrlBuilder) -> axum::response::Redirect {
|
||||
match &self.post_auth_action {
|
||||
Some(action) => action.go_next(),
|
||||
None => Index.go(),
|
||||
Some(action) => action.go_next(url_builder),
|
||||
None => url_builder.redirect(&Index),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -268,10 +272,10 @@ impl Reauth {
|
||||
self.post_auth_action.as_ref()
|
||||
}
|
||||
|
||||
pub fn go_next(&self) -> axum::response::Redirect {
|
||||
pub fn go_next(&self, url_builder: &UrlBuilder) -> axum::response::Redirect {
|
||||
match &self.post_auth_action {
|
||||
Some(action) => action.go_next(),
|
||||
None => Index.go(),
|
||||
Some(action) => action.go_next(url_builder),
|
||||
None => url_builder.redirect(&Index),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -328,10 +332,10 @@ impl Register {
|
||||
self.post_auth_action.as_ref()
|
||||
}
|
||||
|
||||
pub fn go_next(&self) -> axum::response::Redirect {
|
||||
pub fn go_next(&self, url_builder: &UrlBuilder) -> axum::response::Redirect {
|
||||
match &self.post_auth_action {
|
||||
Some(action) => action.go_next(),
|
||||
None => Index.go(),
|
||||
Some(action) => action.go_next(url_builder),
|
||||
None => url_builder.redirect(&Index),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user