1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-23 11:02:35 +03:00

Handle auth errors on the userinfo endpoint

This commit is contained in:
Quentin Gliech
2021-09-17 16:20:10 +02:00
parent 463184bbb1
commit 59df55c2f9
5 changed files with 140 additions and 23 deletions

View File

@@ -17,7 +17,8 @@ use sqlx::PgPool;
use warp::{Filter, Rejection, Reply};
use crate::{
config::OAuth2Config, filters::authenticate::with_authentication,
config::OAuth2Config,
filters::authenticate::{recover_unauthorized, with_authentication},
storage::oauth2::access_token::OAuth2AccessTokenLookup,
};
@@ -34,6 +35,7 @@ pub(super) fn filter(
.and(warp::get().or(warp::post()).unify())
.and(with_authentication(pool))
.and_then(userinfo)
.recover(recover_unauthorized)
}
async fn userinfo(token: OAuth2AccessTokenLookup) -> Result<impl Reply, Rejection> {