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

Move the PKCE validation logic to oauth2-types

This commit is contained in:
Quentin Gliech
2022-08-03 10:37:08 +02:00
parent f7361f871e
commit 649e5cd645
5 changed files with 117 additions and 92 deletions

View File

@@ -22,7 +22,7 @@ use headers::{CacheControl, HeaderMap, HeaderMapExt, Pragma};
use hyper::StatusCode;
use mas_axum_utils::client_authorization::{ClientAuthorization, CredentialsVerificationError};
use mas_config::Encrypter;
use mas_data_model::{AuthorizationGrantStage, Client, PkceVerificationError, TokenType};
use mas_data_model::{AuthorizationGrantStage, Client, TokenType};
use mas_iana::jose::JsonWebSignatureAlg;
use mas_jose::{
claims::{self, ClaimError},
@@ -44,6 +44,7 @@ use mas_storage::{
};
use oauth2_types::{
errors::{INVALID_CLIENT, INVALID_GRANT, INVALID_REQUEST, SERVER_ERROR, UNAUTHORIZED_CLIENT},
pkce::CodeChallengeError,
requests::{
AccessTokenRequest, AccessTokenResponse, AuthorizationCodeGrant, RefreshTokenGrant,
},
@@ -87,7 +88,7 @@ pub(crate) enum RouteError {
BadRequest,
#[error("pkce verification failed")]
PkceVerification(#[from] PkceVerificationError),
PkceVerification(#[from] CodeChallengeError),
#[error("client not found")]
ClientNotFound,