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

Add a constructor for a basic AuthorizationRequest

This commit is contained in:
Kévin Commaille
2022-09-01 14:19:16 +02:00
committed by Quentin Gliech
parent 7a931925fa
commit bffbf63992

View File

@ -143,6 +143,36 @@ pub struct AuthorizationRequest {
pub registration: Option<String>, pub registration: Option<String>,
} }
impl AuthorizationRequest {
/// Creates a basic `AuthorizationRequest`.
#[must_use]
pub fn new(
response_type: OAuthAuthorizationEndpointResponseType,
client_id: String,
scope: Scope,
) -> Self {
Self {
response_type,
client_id,
redirect_uri: None,
scope,
state: None,
response_mode: None,
nonce: None,
display: None,
prompt: None,
max_age: None,
ui_locales: None,
id_token_hint: None,
login_hint: None,
acr_values: None,
request: None,
request_uri: None,
registration: None,
}
}
}
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Serialize, Deserialize, Default, Debug, Clone)] #[derive(Serialize, Deserialize, Default, Debug, Clone)]
pub struct AuthorizationResponse<R> { pub struct AuthorizationResponse<R> {