Make URL mandatory for plugin registration (Close #573)

Change-Id: I7477eda28559274a4ee923cae092e7b5e380460e
diff --git a/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ClientService.java b/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ClientService.java
index ed68d5d..6d01bf2 100644
--- a/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ClientService.java
+++ b/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ClientService.java
@@ -13,6 +13,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import com.fasterxml.jackson.databind.JsonNode;
 import com.nimbusds.oauth2.sdk.OAuth2Error;
 
 import de.ids_mannheim.korap.config.FullConfiguration;
@@ -97,7 +98,7 @@
                     "client_name");
             ParameterChecker.checkObjectValue(clientJson.getType(),
                     "client_type");
-            ParameterChecker.checkStringValue(clientJson.getName(),
+            ParameterChecker.checkStringValue(clientJson.getDescription(),
                     "client_description");
         }
         catch (KustvaktException e) {
@@ -105,6 +106,7 @@
                     OAuth2Error.INVALID_REQUEST);
         }
 
+        JsonNode source = clientJson.getSource();
         String url = clientJson.getUrl();
         if (url != null && !url.isEmpty()) {
             if (!urlValidator.isValid(url)) {
@@ -112,6 +114,12 @@
                         "Invalid URL", OAuth2Error.INVALID_REQUEST);
             }
         }
+        // url is obligatory for plugins 
+        else if (source != null && !source.isNull()) {
+            throw new KustvaktException(StatusCodes.MISSING_PARAMETER,
+                    "URL is required for plugins.", "url");
+        }
+            
 
         String redirectURI = clientJson.getRedirectURI();
         if (redirectURI != null && !redirectURI.isEmpty()