Skip to content

Commit fe76cf7

Browse files
authored
Merge pull request #36 from fastly/dora-issuer-claim
Do not verify non-standard issuer from JWK metadata by default
2 parents df2cb6e + 85aa4ad commit fe76cf7

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/config.rs

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ pub struct JsonWebKey<'a> {
4646
pub exponent: &'a str,
4747
#[serde(rename = "n")]
4848
pub modulus: &'a str,
49+
#[serde(default)]
4950
pub issuer: &'a str,
5051
}
5152

src/jwt.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ pub fn validate_token_rs256<CustomClaims: Serialize + DeserializeOwned>(
4242
// Custom claims are also supported – see https://docs.rs/jwt-simple/0.9.3/jwt_simple/index.html#custom-claims
4343
let verification_options = VerificationOptions {
4444
allowed_issuers: Some(HashSet::from_strings(&[
45-
key_metadata.issuer,
45+
// Some IdPs (e.g. Azure, when MS Live sign-in support is enabled) provide tenant-specific and public keys in the same JWKSet,
46+
// and will therefore include the non-standard "issuer" property in JWK metadata.
47+
// Uncomment the line below to include the issuer property from the key metadata during verification:
48+
// key_metadata.issuer,
4649
settings.openid_configuration.issuer,
4750
])),
4851
allowed_audiences: Some(HashSet::from_strings(&[settings.config.client_id])),

0 commit comments

Comments
 (0)