camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [camel] 01/02: CAMEL-13045 - Camel-Slack: The verifier must be able to validate webhook and token at the same time
Date Thu, 10 Jan 2019 07:21:47 GMT
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit c5df0a51c1b60fe7092000818ac83d318ef30594
Author: Andrea Cosentino <ancosen@gmail.com>
AuthorDate: Thu Jan 10 08:17:19 2019 +0100

    CAMEL-13045 - Camel-Slack: The verifier must be able to validate webhook and token at
the same time
---
 .../camel/component/slack/SlackComponentVerifierExtension.java       | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponentVerifierExtension.java
b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponentVerifierExtension.java
index b8c10fc..1960b8d 100644
--- a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponentVerifierExtension.java
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponentVerifierExtension.java
@@ -34,6 +34,7 @@ import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.HttpClientBuilder;
 import org.apache.http.message.BasicNameValuePair;
 import org.json.simple.JSONObject;
+import org.json.simple.JsonObject;
 import org.json.simple.Jsoner;
 
 import static org.apache.camel.component.slack.utils.SlackUtils.readResponse;
@@ -106,7 +107,7 @@ public class SlackComponentVerifierExtension extends DefaultComponentVerifierExt
             } catch (Exception e) {
                 builder.error(ResultErrorBuilder.withCodeAndDescription(VerificationError.StandardCode.AUTHENTICATION,
"Invalid webhookUrl").parameterKey("webhookUrl").build());
             }
-        } else if (ObjectHelper.isNotEmpty((String)parameters.get("token"))) {
+        } if (ObjectHelper.isNotEmpty((String)parameters.get("token"))) {
             String token = (String)parameters.get("token");
 
             try {
@@ -123,7 +124,7 @@ public class SlackComponentVerifierExtension extends DefaultComponentVerifierExt
                 if (response.getStatusLine().getStatusCode() < 200 || response.getStatusLine().getStatusCode()
> 299) {
                     builder.error(ResultErrorBuilder.withCodeAndDescription(VerificationError.StandardCode.AUTHENTICATION,
"Invalid token").parameterKey("token").build());
                 }
-                JSONObject obj = (JSONObject) Jsoner.deserialize(jsonString);
+                JsonObject obj = (JsonObject) Jsoner.deserialize(jsonString);
                 if (obj.get("ok") != null && obj.get("ok").equals(false)) {
                     builder.error(ResultErrorBuilder.withCodeAndDescription(VerificationError.StandardCode.AUTHENTICATION,
"Invalid token").parameterKey("token").build());
                 }


Mime
View raw message