Minor exception messages improvements.
Signed-off-by: Max Lambrecht <maxlambrecht@gmail.com>
This commit is contained in:
parent
f8970af7f4
commit
de82ebf916
|
|
@ -97,7 +97,7 @@ public enum JwtSignatureAlgorithm {
|
||||||
} else if (s.equals(EC.getName())) {
|
} else if (s.equals(EC.getName())) {
|
||||||
family = EC;
|
family = EC;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Unsupported JWT token family algorithm: " + s);
|
throw new IllegalArgumentException("Unsupported JWT family algorithm: " + s);
|
||||||
}
|
}
|
||||||
return family;
|
return family;
|
||||||
}
|
}
|
||||||
|
|
@ -124,7 +124,7 @@ public enum JwtSignatureAlgorithm {
|
||||||
} else if (s.equals(PS512.getName())) {
|
} else if (s.equals(PS512.getName())) {
|
||||||
algorithm = PS512;
|
algorithm = PS512;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Unsupported JWT token algorithm: " + s);
|
throw new IllegalArgumentException("Unsupported JWT algorithm: " + s);
|
||||||
}
|
}
|
||||||
return algorithm;
|
return algorithm;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ class JwtBundleTest {
|
||||||
JwtBundle.load(trustDomain, path);
|
JwtBundle.load(trustDomain, path);
|
||||||
fail("should have thrown exception");
|
fail("should have thrown exception");
|
||||||
} catch (JwtBundleException e) {
|
} catch (JwtBundleException e) {
|
||||||
assertEquals("Unsupported JWT token family algorithm: OKP", e.getCause().getMessage());
|
assertEquals("Unsupported JWT family algorithm: OKP", e.getCause().getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ class JwtSignatureAlgorithmTest {
|
||||||
JwtSignatureAlgorithm.Family.parse("unknown family");
|
JwtSignatureAlgorithm.Family.parse("unknown family");
|
||||||
fail();
|
fail();
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
assertEquals("Unsupported JWT token family algorithm: unknown family", e.getMessage());
|
assertEquals("Unsupported JWT family algorithm: unknown family", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@ class JwtSignatureAlgorithmTest {
|
||||||
JwtSignatureAlgorithm.parse("HS256");
|
JwtSignatureAlgorithm.parse("HS256");
|
||||||
fail();
|
fail();
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
assertEquals("Unsupported JWT token algorithm: HS256", e.getMessage());
|
assertEquals("Unsupported JWT algorithm: HS256", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -154,7 +154,7 @@ class JwtSvidParseAndValidateTest {
|
||||||
.jwtBundle(jwtBundle)
|
.jwtBundle(jwtBundle)
|
||||||
.expectedAudience(Collections.singleton("audience"))
|
.expectedAudience(Collections.singleton("audience"))
|
||||||
.generateToken(() -> HS256TOKEN)
|
.generateToken(() -> HS256TOKEN)
|
||||||
.expectedException(new JwtSvidException("Unsupported JWT token algorithm: HS256"))
|
.expectedException(new JwtSvidException("Unsupported JWT algorithm: HS256"))
|
||||||
.build()),
|
.build()),
|
||||||
Arguments.of(TestCase.builder()
|
Arguments.of(TestCase.builder()
|
||||||
.name("5. missing subject")
|
.name("5. missing subject")
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ class JwtSvidParseInsecureTest {
|
||||||
.name("unsupported algorithm")
|
.name("unsupported algorithm")
|
||||||
.expectedAudience(Collections.singleton("audience"))
|
.expectedAudience(Collections.singleton("audience"))
|
||||||
.generateToken(() -> HS256TOKEN)
|
.generateToken(() -> HS256TOKEN)
|
||||||
.expectedException(new JwtSvidException("Unsupported JWT token algorithm: HS256"))
|
.expectedException(new JwtSvidException("Unsupported JWT algorithm: HS256"))
|
||||||
.build())
|
.build())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue