From 494f52cd03f1a211f4762637b8b0ac4d51f59f49 Mon Sep 17 00:00:00 2001 From: "Jakob (Koby) Shimony" Date: Fri, 25 Jun 2021 13:08:01 +0200 Subject: [PATCH] fix: authentication strategy comparison now uses `equals` function for strings correctly (#23) ## Summary ### Bug Fixes - Fixed few instances of faulty string comparisons in `ApiClient.java` (fixes #22) --- README.md | 6 +++--- build.gradle | 2 +- build.sbt | 2 +- pom.xml | 2 +- src/main/java/one/talon/ApiClient.java | 10 +++++----- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 687f15df..02dc6360 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Add this dependency to your project's POM: one.talon talon-one-client - 4.4.0 + 4.4.1 compile ``` @@ -59,7 +59,7 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "one.talon:talon-one-client:4.4.0" +compile "one.talon:talon-one-client:4.4.1" ``` ### Others @@ -72,7 +72,7 @@ mvn clean package Then manually install the following JARs: -* `target/talon-one-client-4.4.0.jar` +* `target/talon-one-client-4.4.1.jar` * `target/lib/*.jar` ## Getting Started diff --git a/build.gradle b/build.gradle index caa98f3f..ee786e42 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ apply plugin: 'eclipse' apply plugin: 'java' group = 'one.talon' -version = '4.4.0' +version = '4.4.1' buildscript { repositories { diff --git a/build.sbt b/build.sbt index f18f7ba6..3cde900e 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "one.talon", name := "talon-one-client", - version := "4.4.0", + version := "4.4.1", scalaVersion := "2.11.4", scalacOptions ++= Seq("-feature"), javacOptions in compile ++= Seq("-Xlint:deprecation"), diff --git a/pom.xml b/pom.xml index cd93aac3..9b93e64e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ talon-one-client jar talon-one-client - 4.4.0 + 4.4.1 https://github.com/talon-one/maven-artefacts Talon.One unified JAVA SDK. It allows for programmatic access to the integration and management API with their respective authentication strategies diff --git a/src/main/java/one/talon/ApiClient.java b/src/main/java/one/talon/ApiClient.java index 04580652..02c03b5e 100644 --- a/src/main/java/one/talon/ApiClient.java +++ b/src/main/java/one/talon/ApiClient.java @@ -90,15 +90,15 @@ public class ApiClient { public ApiClient(String authenticationStrategy) { init(); - if (authenticationStrategy == "manager_auth") { + if (authenticationStrategy.equals("manager_auth")) { authentications.put("manager_auth", new ApiKeyAuth("header", "Authorization")); } - if (authenticationStrategy == "api_key_v1") { + if (authenticationStrategy.equals("api_key_v1")) { authentications.put("api_key_v1", new ApiKeyAuth("header", "Authorization")); } - if (authenticationStrategy == "integration_auth") { + if (authenticationStrategy.equals("integration_auth")) { authentications.put("integration_auth", new ApiKeyAuth("header", "Content-Signature")); } } @@ -128,7 +128,7 @@ private void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/4.4.0/java"); + setUserAgent("OpenAPI-Generator/4.4.1/java"); authentications = new HashMap(); } @@ -1252,7 +1252,7 @@ public void updateParamsForAuth(String[] authNames, List queryParams, Map< Authentication auth = authentications.get(authName); if (auth != null) { foundAuth = true; - if (authName == "integration_auth") { + if (authName.equals("integration_auth")) { try { if (body == null) { throw new RuntimeException("No body provided to sign with HMAC");