Skip to content

Commit bf7150f

Browse files
committed
Minor refactoring on method names and docs
1 parent f25d466 commit bf7150f

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,10 @@ try {
213213

214214
```
215215

216-
##### Preparing Authorization Token :
216+
##### Preparing HTTP Signature Token :
217+
218+
Append this signature token into the Authorization header of the HTTP request
219+
217220
Params:
218221
* realm
219222
* authPrefix - Authorization Header scheme prefix , i.e 'prefix_appId'
@@ -241,7 +244,7 @@ String nonce = null;
241244
String timestamp = null;
242245

243246
try {
244-
String signature = ApiSigning.getToken("http://api.test.io/l2", "<<authPrefix>>", "get", url, appId, null, null, password, alias, certFileName, nonce, timestamp);
247+
String signature = ApiSigning.getSignatureToken("http://api.test.io/l2", "<<authPrefix>>", "get", url, appId, null, null, password, alias, certFileName, nonce, timestamp);
245248
} catch (ApiUtilException e) {
246249
e.printStackTrace();
247250
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ public static String getBaseString(String authPrefix
472472
* @return
473473
* @throws ApiUtilException
474474
*/
475-
public static String getToken(
475+
public static String getSignatureToken(
476476
String realm
477477
, String authPrefix
478478
, String httpMethod

src/test/java/AuthorizationTokenTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void Test_L1_Basic_Test() throws ApiUtilException
5555
{
5656
String expectedToken = "Apex_l1_ig realm=\"http://example.api.test/token\", apex_l1_ig_timestamp=\"1502199514462\", apex_l1_ig_nonce=\"-5816789581922453013\", apex_l1_ig_app_id=\"example-4Swyn7qwKeO32EXdH1dKTeIQ\", apex_l1_ig_signature_method=\"HMACSHA256\", apex_l1_ig_signature=\"DoARux+dvq/A2ioQfRybInAQ4Lt4DTAI6DrDJRx7zcs=\", apex_l1_ig_version=\"1.0\"";
5757

58-
String authorizationToken = ApiSigning.getToken(
58+
String authorizationToken = ApiSigning.getSignatureToken(
5959
realm
6060
, authPrefixL1
6161
, httpMethod
@@ -78,7 +78,7 @@ public void Test_L1_Basic_Test() throws ApiUtilException
7878
public void Test_L2_Basic_Test() throws ApiUtilException
7979
{
8080
String expectedToken = "Apex_l2_ig realm=\"http://example.api.test/token\", apex_l2_ig_timestamp=\"1502199514462\", apex_l2_ig_nonce=\"-5816789581922453013\", apex_l2_ig_app_id=\"example-4Swyn7qwKeO32EXdH1dKTeIQ\", apex_l2_ig_signature_method=\"SHA256withRSA\", apex_l2_ig_signature=\"Za7B8MaOlGZjc8DTEh9HwhcL+5DiiuTMy+s0bQ8/lajy1Ug64gPCyNEbcYkD/XBEHFyg6vlY9/J85Y+Ui6DeYbXmUFnQjDWdOKf13xJvpsnAQgOqWi+LSc0+gy3pvsQ50nyES3E04vb3RvGwd7UC6SyBhmQ5P8Mz0UUgWBX6L6N3n+xergTg3DKWEPyQih+dqN3DkOmNE8fstAp+HOqiVq2OBxNeg9x5Kp0tq2vka7cC86zdYSNhsQR+D7hC+S1NPninWvdxUF1EwrPrEZYSYXka0Md1XFVjaL6b0htcFo6LxwJ8X6wsOqS4g4qmrAadwm7fITZLxcI0Zdaz7dRw9UFUsGWEVPG8MQztVXleimDxYvorLKTD5bhWGHe+XNwyL+IdR7ErooOHP9pTslJ7yBEmsePTRIAL//h0AEXaBN4pCmBPJnVtYtUWdQsUq/iv/4FLtWvOK77EReAtq3uqndJfGInXUMESqS4PzGDajTZj+oDP7xektLh7umELQBnSKNuv3BR9H63sf+Z9mZQ1531LYEmQWR8p3LCP8E0DcROo0OP1gcE76N9Z1HKLtJjLYDRyQRUQMM2FlJRkb3sy2g60yNThkPprzohBvHowCRFs02tlkyBbOuKC2cV9hwSz8eMqhUTzNn/WMi2Dr2V7iTJtyJHT9kdebVY2Cvnlt5I=\", apex_l2_ig_version=\"1.0\"";
81-
String authorizationToken = ApiSigning.getToken(
81+
String authorizationToken = ApiSigning.getSignatureToken(
8282
realm
8383
, authPrefixL2
8484
, httpMethod
@@ -103,7 +103,7 @@ public void Test_L2_Wrong_Password_Test() throws ApiUtilException
103103
String expectedMessage = "keystore password was incorrect";
104104

105105
try {
106-
ApiSigning.getToken(
106+
ApiSigning.getSignatureToken(
107107
realm
108108
, authPrefixL2
109109
, httpMethod
@@ -133,7 +133,7 @@ public void Test_L2_Not_Supported_Cert_Test() throws ApiUtilException
133133

134134
try {
135135

136-
ApiSigning.getToken(
136+
ApiSigning.getSignatureToken(
137137
realm
138138
, authPrefixL2
139139
, httpMethod
@@ -163,7 +163,7 @@ public void Test_L2_Invalid_FileName_Test() throws ApiUtilException
163163

164164
try {
165165

166-
ApiSigning.getToken(
166+
ApiSigning.getSignatureToken(
167167
realm
168168
, authPrefixL2
169169
, httpMethod

0 commit comments

Comments
 (0)