Skip to content

Commit 8066543

Browse files
committed
Incorporate Feedback
1 parent 45874d1 commit 8066543

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

‎server/src/main/java/org/cloudfoundry/identity/uaa/oauth/jwt/UaaMacSigner.java‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,13 @@ public static JWTClaimsSet verify(String jwToken, JWKSet jwkSet) {
8686
JWK jwKey = jwkSet.getKeys().stream().filter(e -> kid.equals(e.getKeyID())).findFirst().orElseThrow();
8787
UaaMacSigner internal = new UaaMacSigner((String) jwKey.toJSONObject().get(JWKParameterNames.OCT_KEY_VALUE));
8888
// symmetric signature check: create internal signature and compare if matches the signature from token, using a constant-time comparison
89-
Base64URL expectedSignature = internal.sign(header, token.getSigningInput());
90-
if (MessageDigest.isEqual(token.getSignature().decode(), expectedSignature.decode()) && SUPPORTED_ALGORITHMS.contains(header.getAlgorithm())) {
91-
return token.getJWTClaimsSet();
89+
if (SUPPORTED_ALGORITHMS.contains(header.getAlgorithm())) {
90+
Base64URL expectedSignature = internal.sign(header, token.getSigningInput());
91+
if (MessageDigest.isEqual(token.getSignature().decode(), expectedSignature.decode())) {
92+
return token.getJWTClaimsSet();
93+
}
9294
}
93-
throw new InvalidSignatureException("HMAC not mached");
95+
throw new InvalidSignatureException("HMAC not matched");
9496
} catch (ParseException | JOSEException e) {
9597
throw new InvalidSignatureException("Invalid signed token", e);
9698
}

‎server/src/main/java/org/cloudfoundry/identity/uaa/provider/ldap/PasswordComparisonAuthenticator.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import javax.naming.directory.Attribute;
3636
import javax.naming.directory.Attributes;
3737
import java.security.MessageDigest;
38-
import java.util.Arrays;
3938
import java.util.function.Supplier;
4039

4140
/**

0 commit comments

Comments
 (0)