[ 
https://issues.apache.org/jira/browse/KNOX-2126?focusedWorklogId=344552&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-344552
 ]

ASF GitHub Bot logged work on KNOX-2126:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 15/Nov/19 20:28
            Start Date: 15/Nov/19 20:28
    Worklog Time Spent: 10m 
      Work Description: pzampino commented on pull request #195: KNOX-2126. Add 
an API to retrieve the public key used for Knox JWT verification.
URL: https://github.com/apache/knox/pull/195#discussion_r346995661
 
 

 ##########
 File path: 
gateway-service-knoxtoken/src/test/java/org/apache/knox/gateway/service/knoxtoken/TokenServiceResourceTest.java
 ##########
 @@ -778,6 +785,32 @@ public void 
testTokenRevocation_Enabled_WithRenewersWithValidSubject() throws Ex
     validateSuccessfulRevocationResponse(renewalResponse);
   }
 
+  @Test
+  public void testGetPublicKey() throws Exception {
+    TokenResource tr = createTokenResourceForPublicKeyTests(false);
+
+    Response response = tr.publicKey();
+    assertEquals("Unexpected response code", Status.OK.getStatusCode(), 
response.getStatus());
+    String retString = response.getEntity().toString();
+    Map<String, String> responseMap = parseJSONResponse(retString);
+    assertNotNull("PublicKey is null", 
responseMap.get(TokenResource.PUBLIC_KEY));
+    assertNotNull("Algorithm is null", 
responseMap.get(TokenResource.ALGORITHM));
+    assertEquals("Mismatched algorithm", 
responseMap.get(TokenResource.ALGORITHM),
+        publicKey.getAlgorithm());
+    assertArrayEquals("Mismatched public key",
+        Base64.decodeBase64(responseMap.get(TokenResource.PUBLIC_KEY)), 
publicKey.getEncoded());
+
+  }
+
+  @Test
+  public void testGetPublicKey_error() throws Exception {
+    TokenResource tr = createTokenResourceForPublicKeyTests(true);
+
+    Response response = tr.publicKey();
+    assertEquals("Unexpoected response code", 
Status.INTERNAL_SERVER_ERROR.getStatusCode(),
 
 Review comment:
   Typo: Unexpoected
 
----------------------------------------------------------------
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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 344552)
    Time Spent: 50m  (was: 40m)

> Add an API to retrieve the public key used for Knox JWT verification
> --------------------------------------------------------------------
>
>                 Key: KNOX-2126
>                 URL: https://issues.apache.org/jira/browse/KNOX-2126
>             Project: Apache Knox
>          Issue Type: New Feature
>            Reporter: Siddharth Seth
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> It can be useful to get access to the PublicKey used by Knox to verify the 
> tokens that it generates outside of Knox.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to