pzampino commented on a change in pull request #178: KNOX-2071 - Configurable
maximum token lifetime for TokenStateService
URL: https://github.com/apache/knox/pull/178#discussion_r343284982
##########
File path:
gateway-service-knoxtoken/src/test/java/org/apache/knox/gateway/service/knoxtoken/TokenServiceResourceTest.java
##########
@@ -679,6 +680,40 @@ public void
testTokenRenewal_Enabled_WithRenewersWithValidSubject() throws Excep
validateSuccessfulRenewalResponse(renewalResponse);
}
+ @Test
+ public void testTokenRenewal_Enabled_WithDefaultMaxTokenLifetime() throws
Exception {
+ final String caller = "yarn";
+
+ // Max lifetime duration is 10ms
+ Pair<TestTokenStateService, Response> testResult =
+ doTestTokenRenewal(true, caller, null,
createTestSubject(caller));
+
+ TestTokenStateService tss = testResult.getLeft();
+ assertEquals(1, tss.issueTimes.size());
+ String token = tss.issueTimes.keySet().iterator().next();
+
+ // Verify that the configured max lifetime was honored
+ assertEquals(tss.getDefaultMaxLifetimeDuration(),
tss.getMaxLifetime(token) - tss.getIssueTime(token));
+ }
+
+
+ @Test
+ public void testTokenRenewal_Enabled_WithConfigurableMaxTokenLifetime()
throws Exception {
Review comment:
It's test code, and it helps me to quickly distinguish test methods that
vary only slightly in name. So, are the needed? No. Does it matter? It's test
code.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services