You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-07-31 09:24:31 +03:00
Save the post auth action during upstream OAuth login
This commit is contained in:
@ -532,17 +532,27 @@ impl Route for CompatLoginSsoComplete {
|
||||
/// `GET /upstream/authorize/:id`
|
||||
pub struct UpstreamOAuth2Authorize {
|
||||
id: Ulid,
|
||||
post_auth_action: Option<PostAuthAction>,
|
||||
}
|
||||
|
||||
impl UpstreamOAuth2Authorize {
|
||||
#[must_use]
|
||||
pub const fn new(id: Ulid) -> Self {
|
||||
Self { id }
|
||||
Self {
|
||||
id,
|
||||
post_auth_action: None,
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn and_then(mut self, action: PostAuthAction) -> Self {
|
||||
self.post_auth_action = Some(action);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl Route for UpstreamOAuth2Authorize {
|
||||
type Query = ();
|
||||
type Query = PostAuthAction;
|
||||
fn route() -> &'static str {
|
||||
"/upstream/authorize/:provider_id"
|
||||
}
|
||||
@ -550,6 +560,10 @@ impl Route for UpstreamOAuth2Authorize {
|
||||
fn path(&self) -> std::borrow::Cow<'static, str> {
|
||||
format!("/upstream/authorize/{}", self.id).into()
|
||||
}
|
||||
|
||||
fn query(&self) -> Option<&Self::Query> {
|
||||
self.post_auth_action.as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
/// `GET /upstream/callback/:id`
|
||||
|
Reference in New Issue
Block a user