Added redirect_uri to client info API.

Change-Id: I8a2b343174fc4dab9192c796ef537ddd1ba6112f
diff --git a/full/Changes b/full/Changes
index a354503..f10e02c 100644
--- a/full/Changes
+++ b/full/Changes
@@ -1,6 +1,9 @@
 # version 0.66
 
+2022-03-31
  - Updated query and user-group name pattern.
+ 2022-04-08
+ - Added redirect_uri to client info API.
 
 # version 0.65.2
 
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2ClientInfoDto.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2ClientInfoDto.java
index fed37cd..3f22288 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2ClientInfoDto.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2ClientInfoDto.java
@@ -21,6 +21,7 @@
     @JsonProperty("is_super")
     private String isSuper;
     private String url;
+    private String redirect_uri;
     @JsonProperty("registered_by")
     private String registeredBy;
     private OAuth2ClientType type;
@@ -32,6 +33,7 @@
         this.setType(client.getType());
         this.url = client.getUrl();
         this.registeredBy = client.getRegisteredBy();
+        this.redirect_uri = client.getRedirectURI();
 
         if (client.isSuper()) {
             this.isSuper = "true";
@@ -94,4 +96,12 @@
         this.type = type;
     }
 
+    public String getRedirect_uri () {
+        return redirect_uri;
+    }
+
+    public void setRedirect_uri (String redirect_uri) {
+        this.redirect_uri = redirect_uri;
+    }
+
 }
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ClientControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ClientControllerTest.java
index 1e73773..a9f1095 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ClientControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ClientControllerTest.java
@@ -93,6 +93,7 @@
         assertEquals("non super confidential client",
                 clientInfo.at("/name").asText());
         assertNotNull(clientInfo.at("/url"));
+        assertNotNull(clientInfo.at("/redirect_uri"));
         assertEquals(false, clientInfo.at("/is_super").asBoolean());
         assertEquals("CONFIDENTIAL", clientInfo.at("/type").asText());
 
@@ -102,6 +103,7 @@
         assertEquals("super confidential client",
                 clientInfo.at("/name").asText());
         assertNotNull(clientInfo.at("/url"));
+        assertNotNull(clientInfo.at("/redirect_uri"));
         assertEquals("CONFIDENTIAL", clientInfo.at("/type").asText());
         assertTrue(clientInfo.at("/is_super").asBoolean());
     }
@@ -118,7 +120,8 @@
         assertNotNull(clientSecret);
 
         assertFalse(clientId.contains("a"));
-
+        
+        testConfidentialClientInfo(clientId, username);
         testResetConfidentialClientSecret(clientId, clientSecret);
         deregisterConfidentialClient(username, clientId);
     }
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2TestBase.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2TestBase.java
index 9cf2e75..9eb287d 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2TestBase.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2TestBase.java
@@ -1,6 +1,7 @@
 package de.ids_mannheim.korap.web.controller;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
 import java.net.URI;
 
@@ -50,6 +51,9 @@
 
     public static String ACCESS_TOKEN_TYPE = "access_token";
     public static String REFRESH_TOKEN_TYPE = "refresh_token";
+    
+    private String clientURL = "http://example.client.com";
+    private String clientRedirectUri = "https://example.client.com/redirect";
 
     protected ClientResponse requestAuthorizationCode (
             MultivaluedMap<String, String> form, String authHeader)
@@ -237,13 +241,27 @@
         OAuth2ClientJson json = new OAuth2ClientJson();
         json.setName("OAuth2ClientTest");
         json.setType(OAuth2ClientType.CONFIDENTIAL);
-        json.setUrl("http://example.client.com");
-        json.setRedirectURI("https://example.client.com/redirect");
+        json.setUrl(clientURL);
+        json.setRedirectURI(clientRedirectUri);
         json.setDescription("This is a confidential test client.");
 
         return registerClient(username, json);
     }
     
+    protected void testConfidentialClientInfo (String clientId, String username)
+            throws UniformInterfaceException, ClientHandlerException,
+            KustvaktException {
+        JsonNode clientInfo = retrieveClientInfo(clientId, username);
+        assertEquals(clientId, clientInfo.at("/id").asText());
+        assertEquals("OAuth2ClientTest", clientInfo.at("/name").asText());
+        assertEquals(OAuth2ClientType.CONFIDENTIAL.name(),
+                clientInfo.at("/type").asText());
+        assertEquals(username, clientInfo.at("/registered_by").asText());
+        assertEquals(clientURL, clientInfo.at("/url").asText());
+        assertEquals(clientRedirectUri, clientInfo.at("/redirect_uri").asText());
+        assertNotNull(clientInfo.at("/description"));
+    }
+    
     protected void deregisterConfidentialClient (String username, String clientId)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {