@@ -133,7 +133,7 @@ repositories {
133133 mavenLocal()
134134}
135135dependencies {
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'
137137}
138138
139139```
@@ -148,7 +148,7 @@ Params:
148148* realm
149149* authPrefix - Authorization Header scheme prefix , i.e 'Apex_l2_eg'
150150* httpMethod
151- * urlPath
151+ * urlPath - Signing URL, remember to append << tenant >>.e.api.gov.sg or << tenant >>-pvt.i.api.gov.sg in << URL >>
152152* appId - App ID created in Gateway
153153* secret - set to null for REST L2 SHA256WITHRSA
154154* formList - to support parameter for form data if any
@@ -163,18 +163,33 @@ Params:
163163String realm = " <<your_client_host_url>>"
164164String authPrefix = " <<authPrefix>>
165165String 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";
167168String certFileName = " certificates/ssc.alpha.example.com.p12" ;
168169String password = " <<passphrase>>" ;
169170String alias = " alpha" ;
170171String appId = " <<appId>>" ;
171172String secret = null ;
173+ // only needed for Content-Type: application/x-www-form-urlencoded, else null
172174ApiList formList = null ;
173175String nonce = null ;
174176String timestamp = null ;
175177
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+
176191try {
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);
178193} catch (ApiUtilException e) {
179194 e. printStackTrace();
180195}
@@ -196,7 +211,7 @@ Params:
196211* timestamp - set to null for current timestamp
197212
198213``` java
199- String url = " https://<<Target_URL >>/api/v1/?param1=first¶m2=123" ;
214+ String signingUrl = " https://<<URL >>/api/v1/?param1=first¶m2=123" ;
200215
201216ApiList formList = new ApiList ();
202217formList. add(" param1" , " data1" );
@@ -208,7 +223,7 @@ baseString = ApiSigning.getBaseString(
208223 " <<authPrefix>>" ,
209224 " HMACSHA256" ,
210225 " <<appId>>" ,
211- url ,
226+ signingUrl ,
212227 " post" ,
213228 formList,
214229 " 6584351262900708156" ,
0 commit comments