You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-07-29 22:01:14 +03:00
WIP: upstream OIDC provider support
This commit is contained in:
@ -524,6 +524,52 @@ impl Route for CompatLoginSsoComplete {
|
||||
}
|
||||
}
|
||||
|
||||
/// `GET /upstream/authorize/:id`
|
||||
pub struct UpstreamOAuth2Authorize {
|
||||
id: Ulid,
|
||||
}
|
||||
|
||||
impl UpstreamOAuth2Authorize {
|
||||
#[must_use]
|
||||
pub const fn new(id: Ulid) -> Self {
|
||||
Self { id }
|
||||
}
|
||||
}
|
||||
|
||||
impl Route for UpstreamOAuth2Authorize {
|
||||
type Query = ();
|
||||
fn route() -> &'static str {
|
||||
"/upstream/authorize/:provider_id"
|
||||
}
|
||||
|
||||
fn path(&self) -> std::borrow::Cow<'static, str> {
|
||||
format!("/upstream/authorize/{}", self.id).into()
|
||||
}
|
||||
}
|
||||
|
||||
/// `GET /upstream/callback/:id`
|
||||
pub struct UpstreamOAuth2Callback {
|
||||
id: Ulid,
|
||||
}
|
||||
|
||||
impl UpstreamOAuth2Callback {
|
||||
#[must_use]
|
||||
pub const fn new(id: Ulid) -> Self {
|
||||
Self { id }
|
||||
}
|
||||
}
|
||||
|
||||
impl Route for UpstreamOAuth2Callback {
|
||||
type Query = ();
|
||||
fn route() -> &'static str {
|
||||
"/upstream/callback/:provider_id"
|
||||
}
|
||||
|
||||
fn path(&self) -> std::borrow::Cow<'static, str> {
|
||||
format!("/upstream/callback/{}", self.id).into()
|
||||
}
|
||||
}
|
||||
|
||||
/// `GET /assets`
|
||||
pub struct StaticAsset {
|
||||
path: String,
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
//! Utility to build URLs
|
||||
|
||||
use ulid::Ulid;
|
||||
use url::Url;
|
||||
|
||||
use crate::traits::Route;
|
||||
@ -97,4 +98,16 @@ impl UrlBuilder {
|
||||
pub fn static_asset(&self, path: String) -> Url {
|
||||
self.url_for(&crate::endpoints::StaticAsset::new(path))
|
||||
}
|
||||
|
||||
/// Upstream redirect URI
|
||||
#[must_use]
|
||||
pub fn upstream_oauth_callback(&self, id: Ulid) -> Url {
|
||||
self.url_for(&crate::endpoints::UpstreamOAuth2Callback::new(id))
|
||||
}
|
||||
|
||||
/// Upstream authorize URI
|
||||
#[must_use]
|
||||
pub fn upstream_oauth_authorize(&self, id: Ulid) -> Url {
|
||||
self.url_for(&crate::endpoints::UpstreamOAuth2Authorize::new(id))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user