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
WIP: Provider list on the login page
This commit is contained in:
@ -18,7 +18,9 @@ mod session;
|
||||
|
||||
pub use self::{
|
||||
link::{add_link, associate_link_to_user, lookup_link, lookup_link_by_subject},
|
||||
provider::{add_provider, get_paginated_providers, lookup_provider, ProviderLookupError},
|
||||
provider::{
|
||||
add_provider, get_paginated_providers, get_providers, lookup_provider, ProviderLookupError,
|
||||
},
|
||||
session::{
|
||||
add_session, complete_session, consume_session, lookup_session, lookup_session_on_link,
|
||||
SessionLookupError,
|
||||
|
@ -219,3 +219,29 @@ pub async fn get_paginated_providers(
|
||||
let page: Result<Vec<_>, _> = page.into_iter().map(TryInto::try_into).collect();
|
||||
Ok((has_previous_page, has_next_page, page?))
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all, err)]
|
||||
pub async fn get_providers(
|
||||
executor: impl PgExecutor<'_>,
|
||||
) -> Result<Vec<UpstreamOAuthProvider>, anyhow::Error> {
|
||||
let res = sqlx::query_as!(
|
||||
ProviderLookup,
|
||||
r#"
|
||||
SELECT
|
||||
upstream_oauth_provider_id,
|
||||
issuer,
|
||||
scope,
|
||||
client_id,
|
||||
encrypted_client_secret,
|
||||
token_endpoint_signing_alg,
|
||||
token_endpoint_auth_method,
|
||||
created_at
|
||||
FROM upstream_oauth_providers
|
||||
"#,
|
||||
)
|
||||
.fetch_all(executor)
|
||||
.await?;
|
||||
|
||||
let res: Result<Vec<_>, _> = res.into_iter().map(TryInto::try_into).collect();
|
||||
Ok(res?)
|
||||
}
|
||||
|
Reference in New Issue
Block a user