Degraded API version to 1.0 & added OAuth2 client info tests

Change-Id: I674b15066a1c0038529b4488d843b527caf01fe3
diff --git a/full/Changes b/full/Changes
index e30c3c4..eee2da3 100644
--- a/full/Changes
+++ b/full/Changes
@@ -8,6 +8,9 @@
 09/01/2019
    - Added comments (margaretha)
    - Updated code structure (margaretha)
+11/01/2019
+   - Degraded API version to 1.0 (margaretha)
+   - Added OAuth2 client info tests (margaretha)
 
 # version 0.61.4
 14/11/2018
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
index 314c1a6..fbafcff 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
@@ -276,13 +276,6 @@
             @FormParam("memberUsername") String memberUsername,
             @FormParam("roleIds") List<Integer> roleIds,
             @PathParam("version") String version) {
-        double v = Double.valueOf(version.substring(1, version.length()));
-        if (v < 1.1) {
-            throw kustvaktResponseHandler.throwit(new KustvaktException(
-                    StatusCodes.UNSUPPORTED_API_VERSION,
-                    "Method is not supported in version " + version, version));
-        }
-
         TokenContext context =
                 (TokenContext) securityContext.getUserPrincipal();
         try {
diff --git a/full/src/main/resources/db/insert/V3.5__insert_oauth2_clients.sql b/full/src/main/resources/db/insert/V3.5__insert_oauth2_clients.sql
index e11625b..e6117a6 100644
--- a/full/src/main/resources/db/insert/V3.5__insert_oauth2_clients.sql
+++ b/full/src/main/resources/db/insert/V3.5__insert_oauth2_clients.sql
@@ -6,7 +6,7 @@
 -- plain secret value is "secret"
 INSERT INTO oauth2_client(id,name,secret,type,super,url_id,
   redirect_uri,registered_by, description) 
-VALUES ("fCBbQkAyYzI4NzUxMg","test confidential client",
+VALUES ("fCBbQkAyYzI4NzUxMg","super confidential client",
   "$2a$08$vi1FbuN3p6GcI1tSxMAoeuIYL8Yw3j6A8wJthaN8ZboVnrQaTwLPq",
   "CONFIDENTIAL", 1, 2087150261,
   "https://korap.ids-mannheim.de/confidential/redirect", "system",
@@ -19,7 +19,7 @@
 -- plain secret value is "secret"
 INSERT INTO oauth2_client(id,name,secret,type,super,url_id,
   redirect_uri,registered_by, description) 
-VALUES ("9aHsGW6QflV13ixNpez","test non super confidential client",
+VALUES ("9aHsGW6QflV13ixNpez","non super confidential client",
   "$2a$08$vi1FbuN3p6GcI1tSxMAoeuIYL8Yw3j6A8wJthaN8ZboVnrQaTwLPq",
   "CONFIDENTIAL", 0, 1712550103,
   "https://third.party.com/confidential/redirect", "system",
diff --git a/full/src/main/resources/kustvakt.conf b/full/src/main/resources/kustvakt.conf
index a36eef4..a26cb2d 100644
--- a/full/src/main/resources/kustvakt.conf
+++ b/full/src/main/resources/kustvakt.conf
@@ -12,9 +12,9 @@
 ldap.config = file-path-to-ldap-config
 
 # Kustvakt
-current.api.version = v1.1
+current.api.version = v1.0
 # multiple versions separated by space
-supported.api.version = v1.0
+# supported.api.version = v1.0
 
 ## server
 server.port=8089
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 bb57104..c0da3b3 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
@@ -92,6 +92,33 @@
     }
 
     @Test
+    public void testRetrieveClientInfo () throws KustvaktException {
+        // public client
+        JsonNode clientInfo = retrieveClientInfo(publicClientId, "system");
+        assertEquals(publicClientId, clientInfo.at("/id").asText());
+        assertEquals("third party client", clientInfo.at("/name").asText());
+        assertNotNull(clientInfo.at("/description"));
+        assertNotNull(clientInfo.at("/redirectURI"));
+        assertEquals("PUBLIC", clientInfo.at("/type").asText());
+
+        // confidential client
+        clientInfo = retrieveClientInfo(confidentialClientId, "system");
+        assertEquals(confidentialClientId, clientInfo.at("/id").asText());
+        assertEquals("non super confidential client", clientInfo.at("/name").asText());
+        assertNotNull(clientInfo.at("/redirectURI"));
+        assertEquals(false,clientInfo.at("/isSuper").asBoolean());
+        assertEquals("CONFIDENTIAL", clientInfo.at("/type").asText());
+        
+        // super client
+        clientInfo = retrieveClientInfo(superClientId, "system");
+        assertEquals(superClientId, clientInfo.at("/id").asText());
+        assertEquals("super confidential client", clientInfo.at("/name").asText());
+        assertNotNull(clientInfo.at("/redirectURI"));
+        assertEquals("CONFIDENTIAL", clientInfo.at("/type").asText());
+        assertTrue(clientInfo.at("/isSuper").asBoolean());
+    }
+    
+    @Test
     public void testRegisterConfidentialClient () throws KustvaktException {
         ClientResponse response = registerConfidentialClient();
         String entity = response.getEntity(String.class);