tuwunel_api/server/openid.rs
1use axum::extract::State;
2use ruma::api::federation::openid::get_openid_userinfo;
3use tuwunel_core::Result;
4
5use crate::Ruma;
6
7/// # `GET /_matrix/federation/v1/openid/userinfo`
8///
9/// Get information about the user that generated the OpenID token.
10pub(crate) async fn get_openid_userinfo_route(
11 State(services): State<crate::State>,
12 body: Ruma<get_openid_userinfo::v1::Request>,
13) -> Result<get_openid_userinfo::v1::Response> {
14 Ok(get_openid_userinfo::v1::Response::new(
15 services
16 .users
17 .find_from_openid_token(&body.access_token)
18 .await?,
19 ))
20}