feat: Allow configuring the OAuth compatibility mode

This commit is contained in:
Ginger committed 2026-06-29 09:35:48 -04:00
1 parent 7b98ae54b5
commit e60310eacc
12 files changed
+122 -25

No files matched your search

+5 -1
View File
@@ -1,5 +1,5 @@
use axum::extract::State;
use conduwuit::Result;
use conduwuit::{Err, Result};
use ruma::{
api::client::discovery::get_authorization_server_metadata::{
self, v1::AccountManagementAction,
@@ -21,6 +21,10 @@ pub(crate) async fn get_authorization_server_metadata_route(
State(services): State<crate::State>,
_body: Ruma<get_authorization_server_metadata::v1::Request>,
) -> Result<get_authorization_server_metadata::v1::Response> {
if !services.config.oauth.compatibility_mode.oauth_available() {
return Err!(Request(Unrecognized("OAuth is unavailable on this server")));
}
let metadata = Raw::new(&authorization_server_metadata(&services).await).unwrap();
Ok(get_authorization_server_metadata::v1::Response::new(metadata.cast_unchecked()))