You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-07-29 22:01:14 +03:00
storage: OAuth2 client repository
This commit is contained in:
@ -31,6 +31,7 @@ use async_graphql::{
|
||||
Context, Description, EmptyMutation, EmptySubscription, ID,
|
||||
};
|
||||
use mas_storage::{
|
||||
oauth2::client::OAuth2ClientRepository,
|
||||
upstream_oauth2::UpstreamOAuthProviderRepository,
|
||||
user::{BrowserSessionRepository, UserEmailRepository},
|
||||
Repository, UpstreamOAuthLinkRepository,
|
||||
@ -95,7 +96,7 @@ impl RootQuery {
|
||||
let database = ctx.data::<PgPool>()?;
|
||||
let mut conn = database.acquire().await?;
|
||||
|
||||
let client = mas_storage::oauth2::client::lookup_client(&mut conn, id).await?;
|
||||
let client = conn.oauth2_client().lookup(id).await?;
|
||||
|
||||
Ok(client.map(OAuth2Client))
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
use anyhow::Context as _;
|
||||
use async_graphql::{Context, Description, Object, ID};
|
||||
use mas_storage::oauth2::client::lookup_client;
|
||||
use mas_storage::{oauth2::client::OAuth2ClientRepository, Repository};
|
||||
use oauth2_types::scope::Scope;
|
||||
use sqlx::PgPool;
|
||||
use ulid::Ulid;
|
||||
@ -115,7 +115,9 @@ impl OAuth2Consent {
|
||||
/// OAuth 2.0 client for which the user granted access.
|
||||
pub async fn client(&self, ctx: &Context<'_>) -> Result<OAuth2Client, async_graphql::Error> {
|
||||
let mut conn = ctx.data::<PgPool>()?.acquire().await?;
|
||||
let client = lookup_client(&mut conn, self.client_id)
|
||||
let client = conn
|
||||
.oauth2_client()
|
||||
.lookup(self.client_id)
|
||||
.await?
|
||||
.context("Could not load client")?;
|
||||
Ok(OAuth2Client(client))
|
||||
|
Reference in New Issue
Block a user