You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-08-09 04:22:45 +03:00
Do not expose error type from mas-keystore in mas-oidc-client
The mas-keystore crate is an optional dependency so setting "default-features" to false results in a compilation error. Since the enum is exhaustive, the corresponding error variant cannot be behind a cargo feature. Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
committed by
Quentin Gliech
parent
5d85d0fb65
commit
39a6132ea8
@@ -24,7 +24,6 @@ use mas_jose::{
|
||||
jwa::InvalidAlgorithm,
|
||||
jwt::{JwtDecodeError, JwtSignatureError, NoKeyWorked},
|
||||
};
|
||||
use mas_keystore::WrongAlgorithmError;
|
||||
use oauth2_types::{
|
||||
errors::ClientErrorCode, oidc::ProviderMetadataVerificationError, pkce::CodeChallengeError,
|
||||
};
|
||||
@@ -693,8 +692,8 @@ pub enum CredentialsError {
|
||||
JwtClaims(#[from] ClaimError),
|
||||
|
||||
/// The key found cannot be used with the algorithm.
|
||||
#[error(transparent)]
|
||||
JwtWrongAlgorithm(#[from] WrongAlgorithmError),
|
||||
#[error("Wrong algorithm for key")]
|
||||
JwtWrongAlgorithm,
|
||||
|
||||
/// An error occurred when signing the JWT.
|
||||
#[error(transparent)]
|
||||
|
@@ -340,7 +340,10 @@ impl RequestClientCredentials {
|
||||
let key = keystore
|
||||
.signing_key_for_algorithm(&signing_algorithm)
|
||||
.ok_or(CredentialsError::NoPrivateKeyFound)?;
|
||||
let signer = key.params().signing_key_for_alg(&signing_algorithm)?;
|
||||
let signer = key
|
||||
.params()
|
||||
.signing_key_for_alg(&signing_algorithm)
|
||||
.map_err(|_| CredentialsError::JwtWrongAlgorithm)?;
|
||||
let mut header = JsonWebSignatureHeader::new(signing_algorithm);
|
||||
|
||||
if let Some(kid) = key.kid() {
|
||||
|
Reference in New Issue
Block a user