add /openid/request_token and /openid/userinfo routes

heavily changed and improved by me

Co-authored-by: mikoto <avdb@keemail.me>
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-07-02 21:51:11 -04:00
parent 5edd391e83
commit 1a64e42cfe
11 changed files with 151 additions and 7 deletions

16
src/api/server/openid.rs Normal file
View file

@ -0,0 +1,16 @@
use ruma::api::federation::openid::get_openid_userinfo;
use crate::{services, Result, Ruma};
/// # `GET /_matrix/federation/v1/openid/userinfo`
///
/// Get information about the user that generated the OpenID token.
pub(crate) async fn get_openid_userinfo_route(
body: Ruma<get_openid_userinfo::v1::Request>,
) -> Result<get_openid_userinfo::v1::Response> {
Ok(get_openid_userinfo::v1::Response::new(
services()
.users
.find_from_openid_token(&body.access_token)?,
))
}