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

storage: OAuth2 client repository

This commit is contained in:
Quentin Gliech
2023-01-04 14:48:29 +01:00
parent caf7770921
commit 09a567ab17
15 changed files with 833 additions and 639 deletions

View File

@@ -25,8 +25,9 @@ use mas_data_model::{AuthorizationCode, Pkce};
use mas_keystore::Encrypter;
use mas_policy::PolicyFactory;
use mas_router::{PostAuthAction, Route};
use mas_storage::oauth2::{
authorization_grant::new_authorization_grant, client::lookup_client_by_client_id,
use mas_storage::{
oauth2::{authorization_grant::new_authorization_grant, client::OAuth2ClientRepository},
Repository,
};
use mas_templates::Templates;
use oauth2_types::{
@@ -141,7 +142,9 @@ pub(crate) async fn get(
let mut txn = pool.begin().await?;
// First, figure out what client it is
let client = lookup_client_by_client_id(&mut txn, &params.auth.client_id)
let client = txn
.oauth2_client()
.find_by_client_id(&params.auth.client_id)
.await?
.ok_or(RouteError::ClientNotFound)?;