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

data-model: have more structs use a state machine

This commit is contained in:
Quentin Gliech
2023-01-09 18:02:32 +01:00
parent 39cd9a2578
commit 35787aa072
21 changed files with 1148 additions and 621 deletions

View File

@@ -153,12 +153,12 @@ pub(crate) async fn get(
return Err(RouteError::ProviderMismatch);
}
if params.state != session.state {
if params.state != session.state_str {
// The state in the session cookie should match the one from the params
return Err(RouteError::StateMismatch);
}
if session.completed() {
if !session.is_pending() {
// The session was already completed
return Err(RouteError::AlreadyCompleted);
}
@@ -207,7 +207,7 @@ pub(crate) async fn get(
// TODO: all that should be borrowed
let validation_data = AuthorizationValidationData {
state: session.state.clone(),
state: session.state_str.clone(),
nonce: session.nonce.clone(),
code_challenge_verifier: session.code_challenge_verifier.clone(),
redirect_uri,