Skip to content

Commit 46b89c6

Browse files
committed
Update ApiSigning class to support not standard port
1 parent ec94593 commit 46b89c6

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@
4545
</execution>
4646
</executions>
4747
</plugin>
48+
<plugin>
49+
<groupId>org.apache.maven.plugins</groupId>
50+
<artifactId>maven-scm-plugin</artifactId>
51+
<version>1.8.1</version>
52+
<configuration>
53+
<connectionType>developerConnection</connectionType>
54+
<scmVersion>master</scmVersion>
55+
<scmVersionType>branch</scmVersionType>
56+
</configuration>
57+
</plugin>
4858
</plugins>
4959
</build>
5060
<dependencies>

src/main/java/com/api/util/ApiSecurity/ApiSigning.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,15 @@ public static String getBaseString(String authPrefix
453453
if (!siteUri.getScheme().equals("http") && !siteUri.getScheme().equals("https")) {
454454
throw new ApiUtilException("Support http and https protocol only.");
455455
}
456-
456+
457+
String url = null;
457458
// make sure that the port no and querystring are remove from url
458-
String url = String.format("%s://%s%s", siteUri.getScheme(), siteUri.getHost(), siteUri.getPath());
459+
if(siteUri.getPort()==-1 || siteUri.getPort()==80 || siteUri.getPort()==443){
460+
url = String.format("%s://%s%s", siteUri.getScheme(), siteUri.getHost(), siteUri.getPath());
461+
}else{
462+
url = String.format("%s://%s:%s%s", siteUri.getScheme(), siteUri.getHost(), siteUri.getPort(), siteUri.getPath());
463+
}
464+
459465
log.debug("url:: {}", url);
460466

461467
// helper calss that handle parameters and form fields

0 commit comments

Comments
 (0)