lawliet89/biscuit

decode_with_jwks failing when alg missing

ccakes opened this issue · 1 comments

The published MSFT JWKs don't include the alg value which according to the RFC is optional. This causes token.decode_with_jwks(&jwkset) to always fail here:

biscuit/src/jws.rs

Lines 164 to 167 in 2cbe6ed

let algorithm = match jwk.common.algorithm {
Some(Algorithm::Signature(algorithm)) => algorithm,
_ => Err(ValidationError::UnsupportedKeyAlgorithm)?,
};

Since the field is optional, something like this works to check it if the value is present.

If you'd accept this as a PR let me know

Sure. Please submit a PR.