Updated parameters in the error responses of OAuth2 APIs for coherence

Change-Id: I686373ea3fbf09e7306b3f88f47d2e812fad1f00
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AccessTokenDao.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AccessTokenDao.java
index f3cc60a..6684a53 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AccessTokenDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AccessTokenDao.java
@@ -56,7 +56,7 @@
     public void storeAccessToken (String token, RefreshToken refreshToken,
             Set<AccessScope> scopes, String userId, String clientId,
             ZonedDateTime authenticationTime) throws KustvaktException {
-        ParameterChecker.checkStringValue(token, "access token");
+        ParameterChecker.checkStringValue(token, "access_token");
 //        ParameterChecker.checkObjectValue(refreshToken, "refresh token");
         ParameterChecker.checkObjectValue(scopes, "scopes");
         // ParameterChecker.checkStringValue(userId, "username");
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AuthorizationDaoImpl.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AuthorizationDaoImpl.java
index 2cc570b..8de2a42 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AuthorizationDaoImpl.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AuthorizationDaoImpl.java
@@ -48,11 +48,11 @@
             ZonedDateTime authenticationTime, String nonce)
             throws KustvaktException {
         ParameterChecker.checkStringValue(clientId, "client_id");
-        ParameterChecker.checkStringValue(userId, "userId");
-        ParameterChecker.checkStringValue(code, "authorization code");
+        ParameterChecker.checkStringValue(userId, "user_id");
+        ParameterChecker.checkStringValue(code, "authorization_code");
         ParameterChecker.checkCollection(scopes, "scopes");
         ParameterChecker.checkObjectValue(authenticationTime,
-                "user authentication time");
+                "user_authentication_time");
 
         Authorization authorization = new Authorization();
         authorization.setCode(code);
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/CachedAuthorizationDaoImpl.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/CachedAuthorizationDaoImpl.java
index 9c807c2..5f74aed 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/CachedAuthorizationDaoImpl.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/CachedAuthorizationDaoImpl.java
@@ -43,11 +43,11 @@
             ZonedDateTime authenticationTime, String nonce)
             throws KustvaktException {
         ParameterChecker.checkStringValue(clientId, "client_id");
-        ParameterChecker.checkStringValue(userId, "userId");
-        ParameterChecker.checkStringValue(code, "authorization code");
+        ParameterChecker.checkStringValue(userId, "user_id");
+        ParameterChecker.checkStringValue(code, "authorization_code");
         ParameterChecker.checkCollection(scopes, "scopes");
         ParameterChecker.checkObjectValue(authenticationTime,
-                "user authentication time");
+                "user_authentication_time");
 
         Authorization authorization = new Authorization();
         authorization.setCode(code);
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/OAuth2ClientDao.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/OAuth2ClientDao.java
index 19aec7c..dff99d6 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/OAuth2ClientDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/OAuth2ClientDao.java
@@ -46,14 +46,14 @@
     public void registerClient (String id, String secretHashcode, String name,
             OAuth2ClientType type, String url, String redirectURI,
             String registeredBy, String description) throws KustvaktException {
-        ParameterChecker.checkStringValue(id, "client id");
-        ParameterChecker.checkStringValue(name, "client name");
-        ParameterChecker.checkObjectValue(type, "client type");
-        ParameterChecker.checkStringValue(description, "client description");
+        ParameterChecker.checkStringValue(id, "client_id");
+        ParameterChecker.checkStringValue(name, "client_name");
+        ParameterChecker.checkObjectValue(type, "client_type");
+        ParameterChecker.checkStringValue(description, "client_description");
         // ParameterChecker.checkStringValue(url, "client url");
         // ParameterChecker.checkStringValue(redirectURI, "client
         // redirect uri");
-        ParameterChecker.checkStringValue(registeredBy, "registeredBy");
+        ParameterChecker.checkStringValue(registeredBy, "registered_by");
 
         OAuth2Client client = new OAuth2Client();
         client.setId(id);
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/RefreshTokenDao.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/RefreshTokenDao.java
index 585d8b6..2367fe3 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/RefreshTokenDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/RefreshTokenDao.java
@@ -48,7 +48,7 @@
     public RefreshToken storeRefreshToken (String refreshToken, String userId,
             ZonedDateTime userAuthenticationTime, String clientId,
             Set<AccessScope> scopes) throws KustvaktException {
-        ParameterChecker.checkStringValue(refreshToken, "refresh token");
+        ParameterChecker.checkStringValue(refreshToken, "refresh_token");
         // ParameterChecker.checkStringValue(userId, "username");
         ParameterChecker.checkStringValue(clientId, "client_id");
         ParameterChecker.checkObjectValue(scopes, "scopes");
@@ -80,7 +80,7 @@
 
     public RefreshToken retrieveRefreshToken (String token)
             throws KustvaktException {
-        ParameterChecker.checkStringValue(token, "refresh token");
+        ParameterChecker.checkStringValue(token, "refresh_token");
 
         CriteriaBuilder builder = entityManager.getCriteriaBuilder();
         CriteriaQuery<RefreshToken> query =
@@ -97,7 +97,7 @@
     public RefreshToken retrieveRefreshToken (String token, String username)
             throws KustvaktException {
 
-        ParameterChecker.checkStringValue(token, "refresh token");
+        ParameterChecker.checkStringValue(token, "refresh_token");
         ParameterChecker.checkStringValue(username, "username");
 
         CriteriaBuilder builder = entityManager.getCriteriaBuilder();
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ClientService.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ClientService.java
index 770c01a..7328c81 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ClientService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ClientService.java
@@ -82,7 +82,7 @@
     public OAuth2ClientDto registerClient (OAuth2ClientJson clientJson,
             String registeredBy) throws KustvaktException {
         try {
-            ParameterChecker.checkNameValue(clientJson.getName(), "clientName");
+            ParameterChecker.checkNameValue(clientJson.getName(), "client_name");
         }
         catch (KustvaktException e) {
             throw new KustvaktException(e.getStatusCode(), e.getMessage(),
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 e44c725..ac94979 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
@@ -154,7 +154,7 @@
         ClientResponse response = registerClient(username, json);
         String entity = response.getEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
-        assertEquals("clientName must contain at least 3 characters",
+        assertEquals("client_name must contain at least 3 characters",
                 node.at("/error_description").asText());
         assertEquals("invalid_request",
                 node.at("/error").asText());
@@ -172,7 +172,7 @@
         ClientResponse response = registerClient(username, json);
         String entity = response.getEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
-        assertEquals("client description is null",
+        assertEquals("client_description is null",
                 node.at("/error_description").asText());
         assertEquals("invalid_request",
                 node.at("/error").asText());
diff --git a/full/src/test/resources/log4j2-test.properties b/full/src/test/resources/log4j2-test.properties
index f961961..477f8a5 100644
--- a/full/src/test/resources/log4j2-test.properties
+++ b/full/src/test/resources/log4j2-test.properties
@@ -26,4 +26,11 @@
 #logger.file.level = info
 #logger.file.appenderRefs = file
 #logger.file.appenderRef.file.ref = ERRORLOG
-#logger.file.additivity=false
\ No newline at end of file
+#logger.file.additivity=false
+
+loggers=console
+logger.console.name=org.hibernate
+logger.console.level = fatal
+logger.console.appenderRefs = stdout
+logger.console.appenderRef.file.ref = STDOUT
+logger.console.additivity=false
\ No newline at end of file