Merge remote-tracking branch 'origin/6.5.x'

This commit is contained in:
Josh Cummings 2025-10-28 12:08:53 -06:00
commit 4daf089e46
2 changed files with 12 additions and 2 deletions

View File

@ -72,8 +72,10 @@ public final class JwtTypeValidator implements OAuth2TokenValidator<Jwt> {
if (this.allowEmpty && !StringUtils.hasText(typ)) { if (this.allowEmpty && !StringUtils.hasText(typ)) {
return OAuth2TokenValidatorResult.success(); return OAuth2TokenValidatorResult.success();
} }
if (this.validTypes.contains(typ)) { for (String validType : this.validTypes) {
return OAuth2TokenValidatorResult.success(); if (validType.equalsIgnoreCase(typ)) {
return OAuth2TokenValidatorResult.success();
}
} }
return OAuth2TokenValidatorResult.failure(new OAuth2Error(OAuth2ErrorCodes.INVALID_TOKEN, return OAuth2TokenValidatorResult.failure(new OAuth2Error(OAuth2ErrorCodes.INVALID_TOKEN,
"the given typ value needs to be one of " + this.validTypes, "the given typ value needs to be one of " + this.validTypes,

View File

@ -44,4 +44,12 @@ class JwtTypeValidatorTests {
assertThat(validator.validate(jwt.build()).hasErrors()).isFalse(); assertThat(validator.validate(jwt.build()).hasErrors()).isFalse();
} }
@Test
void validateWhenTypHeaderHasDifferentCaseThenSuccess() {
Jwt.Builder jwt = TestJwts.jwt();
JwtTypeValidator validator = new JwtTypeValidator("at+jwt");
jwt.header(JoseHeaderNames.TYP, "AT+JWT");
assertThat(validator.validate(jwt.build()).hasErrors()).isFalse();
}
} }