Skip to content

Commit

Permalink
fix: authentication strategy comparison now uses equals function fo…
Browse files Browse the repository at this point in the history
…r strings correctly (#23)

## Summary

### Bug Fixes
 - Fixed few instances of faulty string comparisons in `ApiClient.java` (fixes #22)
  • Loading branch information
altJake committed Jun 25, 2021
1 parent 712502a commit 494f52c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Add this dependency to your project's POM:
<dependency>
<groupId>one.talon</groupId>
<artifactId>talon-one-client</artifactId>
<version>4.4.0</version>
<version>4.4.1</version>
<scope>compile</scope>
</dependency>
```
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'eclipse'
apply plugin: 'java'

group = 'one.talon'
version = '4.4.0'
version = '4.4.1'

buildscript {
repositories {
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>talon-one-client</artifactId>
<packaging>jar</packaging>
<name>talon-one-client</name>
<version>4.4.0</version>
<version>4.4.1</version>
<url>https://github.com/talon-one/maven-artefacts</url>
<description>Talon.One unified JAVA SDK. It allows for programmatic access to the integration and management API with their respective authentication strategies</description>
<scm>
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/one/talon/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}
Expand Down Expand Up @@ -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<String, Authentication>();
}
Expand Down Expand Up @@ -1252,7 +1252,7 @@ public void updateParamsForAuth(String[] authNames, List<Pair> 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");
Expand Down

0 comments on commit 494f52c

Please sign in to comment.