Change assert to require hmac

This commit is contained in:
Aaron Davidson 2016-03-26 12:17:26 -07:00
parent 5385e0d7d3
commit 707f7bc046
1 changed files with 2 additions and 5 deletions

View File

@ -309,11 +309,8 @@ public class DefaultJwtParser implements JwtParser {
if (!Objects.isEmpty(keyBytes)) {
Assert.isTrue(!algorithm.isRsa(),
"Key bytes cannot be specified for RSA signatures. Please specify a PublicKey or PrivateKey instance.");
Assert.isTrue(!algorithm.isEllipticCurve(),
"Key bytes cannot be specified for ECDSA signatures. Please specify a PublicKey instance.");
Assert.isTrue(algorithm.isHmac(),
"Key bytes can only be specified for HMAC signatures. Please specify a PublicKey or PrivateKey instance.");
key = new SecretKeySpec(keyBytes, algorithm.getJcaName());
}