Package uk.co.spudsoft.jwtvalidatorvertx
Class JdkTokenValidatorStaticTest
java.lang.Object
uk.co.spudsoft.jwtvalidatorvertx.JdkTokenValidatorStaticTest
@TestInstance(PER_CLASS)
@TestMethodOrder(org.junit.jupiter.api.MethodOrderer.OrderAnnotation.class)
@ExtendWith(io.vertx.junit5.VertxExtension.class)
public class JdkTokenValidatorStaticTest
extends Object
Required tests:
- Invalid structure (not three dots)
- Invalid structure (first part not base64)
- Invalid structure (second part not base64)
- Invalid structure (third part not base64)
- Invalid structure (first part not JSON)
- Invalid structure (second part not JSON)
- Algorithm none
- Algorithm not in acceptable list (RS256, RS384, RS512) but token otherwise valid
- Signature invalid
- Key not in jwks output
- Token exp value in the past - measure acceptable leeway over < 1 hour
- Token nbf claim in the future - measure acceptable leeway over < 1 hour
- Token bad iss accepted - not matching preconfigured values
- Token bad aud accepted
- Token aud not accepted when single value despite being the aud for the service
- Token aud not accepted when single element array despite being the aud for the service
- Token aud not accepted when first element of array despite being the aud for the service
- Token aud not accepted when last element of array despite being the aud for the service
- Token sub not present
- Author:
- jtalbut
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
init()
void
shutdown()
void
testAlgorithmNone
(io.vertx.junit5.VertxTestContext testContext) void
testAlgorithmNotPermitted
(io.vertx.junit5.VertxTestContext testContext) void
testAudAcceptedAsFirstElementOfArray
(io.vertx.junit5.VertxTestContext testContext) void
testAudAcceptedAsLastElementOfArray
(io.vertx.junit5.VertxTestContext testContext) void
testAudAcceptedAsSingleElementArray
(io.vertx.junit5.VertxTestContext testContext) void
testAudAcceptedAsSingleValue
(io.vertx.junit5.VertxTestContext testContext) void
testBadAudRejected
(io.vertx.junit5.VertxTestContext testContext) void
testBadIssRejected
(io.vertx.junit5.VertxTestContext testContext) void
void
testInvalidSignature
(io.vertx.junit5.VertxTestContext testContext) void
testInvalidStructureFirstPartNotBase64
(io.vertx.junit5.VertxTestContext testContext) void
testInvalidStructureFirstPartNotJson
(io.vertx.junit5.VertxTestContext testContext) void
testInvalidStructureNotThreeParts
(io.vertx.junit5.VertxTestContext testContext) void
testInvalidStructureSecondPartNotBase64
(io.vertx.junit5.VertxTestContext testContext) void
testInvalidStructureSecondPartNotJson
(io.vertx.junit5.VertxTestContext testContext) void
testInvalidStructureThirdPartNotBase64
(io.vertx.junit5.VertxTestContext testContext) void
testKeyNotInJwksOutput
(io.vertx.junit5.VertxTestContext testContext) void
testMismatchedIssRejected
(io.vertx.junit5.VertxTestContext testContext) void
void
testNoAudInToken
(io.vertx.junit5.VertxTestContext testContext) void
testNoAudsRequiredError
(io.vertx.junit5.VertxTestContext testContext) void
testNoExpPermitted
(io.vertx.junit5.VertxTestContext testContext) void
testNoExpRejected
(io.vertx.junit5.VertxTestContext testContext) void
testNoIssRejected
(io.vertx.junit5.VertxTestContext testContext) void
testNoNbfPermitted
(io.vertx.junit5.VertxTestContext testContext) void
testNoNbfRejected
(io.vertx.junit5.VertxTestContext testContext) void
testNoSubAccepted
(io.vertx.junit5.VertxTestContext testContext) void
testValid
(io.vertx.junit5.VertxTestContext testContext)
-
Constructor Details
-
JdkTokenValidatorStaticTest
public JdkTokenValidatorStaticTest()
-
-
Method Details
-
init
- Throws:
IOException
-
shutdown
- Throws:
IOException
-
testValid
@Test @Order(1) public void testValid(io.vertx.junit5.VertxTestContext testContext) throws Throwable - Throws:
Throwable
-
testInvalidStructureNotThreeParts
@Test @Order(2) public void testInvalidStructureNotThreeParts(io.vertx.junit5.VertxTestContext testContext) -
testInvalidStructureFirstPartNotBase64
@Test @Order(3) public void testInvalidStructureFirstPartNotBase64(io.vertx.junit5.VertxTestContext testContext) throws Exception - Throws:
Exception
-
testInvalidStructureSecondPartNotBase64
@Test @Order(4) public void testInvalidStructureSecondPartNotBase64(io.vertx.junit5.VertxTestContext testContext) throws Exception - Throws:
Exception
-
testInvalidStructureThirdPartNotBase64
@Test @Order(5) public void testInvalidStructureThirdPartNotBase64(io.vertx.junit5.VertxTestContext testContext) throws Exception - Throws:
Exception
-
testInvalidStructureFirstPartNotJson
@Test @Order(6) public void testInvalidStructureFirstPartNotJson(io.vertx.junit5.VertxTestContext testContext) throws Exception - Throws:
Exception
-
testInvalidStructureSecondPartNotJson
@Test @Order(7) public void testInvalidStructureSecondPartNotJson(io.vertx.junit5.VertxTestContext testContext) throws Exception - Throws:
Exception
-
testAlgorithmNone
@Test @Order(8) public void testAlgorithmNone(io.vertx.junit5.VertxTestContext testContext) throws Exception - Throws:
Exception
-
testAlgorithmNotPermitted
@Test @Order(9) public void testAlgorithmNotPermitted(io.vertx.junit5.VertxTestContext testContext) throws Exception - Throws:
Exception
-
testInvalidSignature
@Test @Order(10) public void testInvalidSignature(io.vertx.junit5.VertxTestContext testContext) throws Exception - Throws:
Exception
-
testKeyNotInJwksOutput
@Test @Order(11) public void testKeyNotInJwksOutput(io.vertx.junit5.VertxTestContext testContext) throws Exception - Throws:
Exception
-
testNoExpPermitted
@Test @Order(13) public void testNoExpPermitted(io.vertx.junit5.VertxTestContext testContext) throws Exception - Throws:
Exception
-
testNoExpRejected
@Test @Order(14) public void testNoExpRejected(io.vertx.junit5.VertxTestContext testContext) throws Exception - Throws:
Exception
-
testExpInThePast
- Throws:
Throwable
-
testNoNbfPermitted
@Test @Order(13) public void testNoNbfPermitted(io.vertx.junit5.VertxTestContext testContext) throws Throwable - Throws:
Throwable
-
testNoNbfRejected
@Test @Order(14) public void testNoNbfRejected(io.vertx.junit5.VertxTestContext testContext) throws Throwable - Throws:
Throwable
-
testNbfInTheFuture
- Throws:
Throwable
-
testBadIssRejected
@Test @Order(14) public void testBadIssRejected(io.vertx.junit5.VertxTestContext testContext) throws Throwable - Throws:
Throwable
-
testNoIssRejected
@Test @Order(14) public void testNoIssRejected(io.vertx.junit5.VertxTestContext testContext) throws Throwable - Throws:
Throwable
-
testMismatchedIssRejected
@Test @Order(14) public void testMismatchedIssRejected(io.vertx.junit5.VertxTestContext testContext) throws Throwable - Throws:
Throwable
-
testBadAudRejected
@Test @Order(15) public void testBadAudRejected(io.vertx.junit5.VertxTestContext testContext) throws Exception - Throws:
Exception
-
testNoAudsRequiredError
@Test @Order(15) public void testNoAudsRequiredError(io.vertx.junit5.VertxTestContext testContext) throws Exception - Throws:
Exception
-
testNoAudInToken
@Test @Order(15) public void testNoAudInToken(io.vertx.junit5.VertxTestContext testContext) throws Exception - Throws:
Exception
-
testAudAcceptedAsSingleElementArray
@Test @Order(16) public void testAudAcceptedAsSingleElementArray(io.vertx.junit5.VertxTestContext testContext) throws Throwable - Throws:
Throwable
-
testAudAcceptedAsSingleValue
@Test @Order(17) public void testAudAcceptedAsSingleValue(io.vertx.junit5.VertxTestContext testContext) throws Throwable - Throws:
Throwable
-
testAudAcceptedAsFirstElementOfArray
@Test @Order(18) public void testAudAcceptedAsFirstElementOfArray(io.vertx.junit5.VertxTestContext testContext) throws Throwable - Throws:
Throwable
-
testAudAcceptedAsLastElementOfArray
@Test @Order(19) public void testAudAcceptedAsLastElementOfArray(io.vertx.junit5.VertxTestContext testContext) throws Throwable - Throws:
Throwable
-
testNoSubAccepted
@Test @Order(20) public void testNoSubAccepted(io.vertx.junit5.VertxTestContext testContext) throws Throwable - Throws:
Throwable
-