1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-29 22:01:14 +03:00

Save the application_type and the contacts in the OAuth 2.0 clients

This also removes the dedicated "redirect_uris" table and makes it a field of the "oauth2_clients" table
This commit is contained in:
Quentin Gliech
2023-08-28 12:31:17 +02:00
parent f9dabf0bbc
commit 096386e9b9
22 changed files with 312 additions and 257 deletions

View File

@ -18,7 +18,7 @@ use mas_iana::{
oauth::{OAuthAuthorizationEndpointResponseType, OAuthClientAuthenticationMethod},
};
use mas_jose::jwk::PublicJsonWebKeySet;
use oauth2_types::requests::GrantType;
use oauth2_types::{oidc::ApplicationType, requests::GrantType};
use rand::RngCore;
use serde::Serialize;
use thiserror::Error;
@ -44,6 +44,8 @@ pub struct Client {
pub encrypted_client_secret: Option<String>,
pub application_type: Option<ApplicationType>,
/// Array of Redirection URI values used by the Client
pub redirect_uris: Vec<Url>,
@ -130,6 +132,7 @@ impl Client {
id: Ulid::from_datetime_with_source(now.into(), rng),
client_id: "client1".to_owned(),
encrypted_client_secret: None,
application_type: Some(ApplicationType::Web),
redirect_uris: vec![
Url::parse("https://client1.example.com/redirect").unwrap(),
Url::parse("https://client1.example.com/redirect2").unwrap(),
@ -156,6 +159,7 @@ impl Client {
id: Ulid::from_datetime_with_source(now.into(), rng),
client_id: "client2".to_owned(),
encrypted_client_secret: None,
application_type: Some(ApplicationType::Native),
redirect_uris: vec![Url::parse("https://client2.example.com/redirect").unwrap()],
response_types: vec![OAuthAuthorizationEndpointResponseType::Code],
grant_types: vec![GrantType::AuthorizationCode, GrantType::RefreshToken],