You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by GitBox <gi...@apache.org> on 2019/11/06 18:49:09 UTC

[GitHub] [knox] smolnar82 commented on a change in pull request #178: KNOX-2071 - Configurable maximum token lifetime for TokenStateService

smolnar82 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_r343264638
 
 

 ##########
 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:
   Do we need the underscores in the method name (see in another new method above too)?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services