@@ -133,7 +133,7 @@ repositories {
133
133
mavenLocal()
134
134
}
135
135
dependencies {
136
- compile group: 'com.api.util', name: 'ApiSecurity', version: '1.0-SNAPSHOT'
136
+ compile group: 'com.api.util', name: 'ApiSecurity', version: '1.3. 0-SNAPSHOT'
137
137
}
138
138
139
139
```
@@ -148,7 +148,7 @@ Params:
148
148
* realm
149
149
* authPrefix - Authorization Header scheme prefix , i.e 'Apex_l2_eg'
150
150
* httpMethod
151
- * urlPath
151
+ * urlPath - Signing URL, remember to append << tenant >>.e.api.gov.sg or << tenant >>-pvt.i.api.gov.sg in << URL >>
152
152
* appId - App ID created in Gateway
153
153
* secret - set to null for REST L2 SHA256WITHRSA
154
154
* formList - to support parameter for form data if any
@@ -163,18 +163,33 @@ Params:
163
163
String realm = " <<your_client_host_url>>"
164
164
String authPrefix = " <<authPrefix>>
165
165
String httpMethod = " get"
166
- String url = " https: // <<Target_URL>>/api/v1/?param1=first¶m2=123";
166
+ //Append the query param in the url or else add as ApiList
167
+ String signingUrl = " https: // <<URL>>/api/v1/?param1=first¶m2=123";
167
168
String certFileName = " certificates/ssc.alpha.example.com.p12" ;
168
169
String password = " <<passphrase>>" ;
169
170
String alias = " alpha" ;
170
171
String appId = " <<appId>>" ;
171
172
String secret = null ;
173
+ // only needed for Content-Type: application/x-www-form-urlencoded, else null
172
174
ApiList formList = null ;
173
175
String nonce = null ;
174
176
String timestamp = null ;
175
177
178
+
179
+ // optional for QueryParam - in-case not append the query parameters in the signingUrl
180
+ // Sring signingUrl = "https://<<tenant>>-pvt.i.api.gov.sg/api/v1"
181
+ ApiList queryParam = new ApiList ();
182
+ queryParam. add(" query1" ," value1" );
183
+
184
+ // optional for formList
185
+ ApiList formList = new ApiList ();
186
+ formList. add(" param1" , " data1" );
187
+
188
+ // If queryParam and formList are both available, combine the list before submitting
189
+ formList. addAll(queryParam);
190
+
176
191
try {
177
- String signature = ApiSigning . getSignatureToken(authPrefix, authPrefix, httpMethod, url , appId, secret, formList, password, alias, certFileName, nonce, timestamp);
192
+ String signature = ApiSigning . getSignatureToken(authPrefix, authPrefix, httpMethod, signingUrl , appId, secret, formList, password, alias, certFileName, nonce, timestamp);
178
193
} catch (ApiUtilException e) {
179
194
e. printStackTrace();
180
195
}
@@ -196,7 +211,7 @@ Params:
196
211
* timestamp - set to null for current timestamp
197
212
198
213
``` java
199
- String url = " https://<<Target_URL >>/api/v1/?param1=first¶m2=123" ;
214
+ String signingUrl = " https://<<URL >>/api/v1/?param1=first¶m2=123" ;
200
215
201
216
ApiList formList = new ApiList ();
202
217
formList. add(" param1" , " data1" );
@@ -208,7 +223,7 @@ baseString = ApiSigning.getBaseString(
208
223
" <<authPrefix>>" ,
209
224
" HMACSHA256" ,
210
225
" <<appId>>" ,
211
- url ,
226
+ signingUrl ,
212
227
" post" ,
213
228
formList,
214
229
" 6584351262900708156" ,
0 commit comments