@@ -140,13 +140,53 @@ dependencies {
140140
141141### Development
142142
143- #### Constructing Signature BaseString
143+ #### Preparing HTTP Signature Token
144+
145+ Append this signature token into the Authorization header of the HTTP request
146+
147+ Params:
148+ * realm
149+ * authPrefix - Authorization Header scheme prefix , i.e 'Apex_l2_eg'
150+ * httpMethod
151+ * urlPath
152+ * appId - App ID created in Gateway
153+ * secret - set to null for REST L2 SHA256WITHRSA
154+ * formList - to support parameter for form data if any
155+ * password
156+ * alias
157+ * fileName
158+ * nonce - set to null for random generated number
159+ * timestamp - set to null for current timestamp
160+
161+
162+ ``` java
163+ String realm = " <<your_client_host_url>>"
164+ String authPrefix = " <<authPrefix>>
165+ String httpMethod = " get"
166+ String url = " https: // <<Target_URL>>/api/v1/?param1=first¶m2=123";
167+ String certFileName = " certificates/ssc.alpha.example.com.p12" ;
168+ String password = " <<passphrase>>" ;
169+ String alias = " alpha" ;
170+ String appId = " <<appId>>" ;
171+ String secret = null ;
172+ ApiList formList = null ;
173+ String nonce = null ;
174+ String timestamp = null ;
175+
176+ try {
177+ String signature = ApiSigning . getSignatureToken(authPrefix, authPrefix, httpMethod, url, appId, secret, formList, password, alias, certFileName, nonce, timestamp);
178+ } catch (ApiUtilException e) {
179+ e. printStackTrace();
180+ }
181+ ```
182+
183+ #### Constructing Signature BaseString (for reference only)
144184
145185Method:
146186* getBaseString
147187
148188Params:
149- * authPrefix - Authorization Header scheme prefix , i.e 'prefix_appId '
189+ * authPrefix - Authorization Header scheme prefix , i.e 'Apex_l2_eg '
150190* signatureMethod
151191* appId - App ID created in Gateway
152192* urlPath
@@ -156,7 +196,7 @@ Params:
156196* timestamp - set to null for current timestamp
157197
158198``` java
159- String url = " https://<<URL >>/api/v1/?param1=first&ab- param2=123" ;
199+ String url = " https://<<Target_URL >>/api/v1/?param1=first¶m2=123" ;
160200
161201ApiList formList = new ApiList ();
162202formList. add(" param1" , " data1" );
@@ -183,7 +223,7 @@ System.out.println(baseString);
183223
184224```
185225
186- #### Constructing HMAC256 L1 Header
226+ #### Constructing HMAC256 L1 Header (for reference only)
187227
188228Method:
189229* getHMACSignature
@@ -207,7 +247,7 @@ try {
207247
208248```
209249
210- #### Constructing RSA256 L2 Header
250+ #### Constructing RSA256 L2 Header (for reference only)
211251
212252Method:
213253* getRSASignature
@@ -217,7 +257,7 @@ Params:
217257* privateKey
218258
219259``` java
220- String baseString = " GET&https://<<URL>/api/v1/&ap=裕廊坊 心邻坊&<<authPrefix>>_app_id=<<appId>>&<<authPrefix>>_nonce=7231415196459608363&<<authPrefix>>_signature_method=SHA256withRSA&<<authPrefix>>_timestamp=1502164219425&<<authPrefix>>_version=1.0&oq=c# nunit mac &q=c# nunit mac " ;
260+ String baseString = " GET&https://<<URL>/api/v1/&ap=裕廊坊 心邻坊&<<authPrefix>>_app_id=<<appId>>&<<authPrefix>>_nonce=7231415196459608363&<<authPrefix>>_signature_method=SHA256withRSA&<<authPrefix>>_timestamp=1502164219425&<<authPrefix>>_version=1.0&oq=123 &q=abc " ;
221261String alias = " alpha" ;
222262String password = " <<passphrase>>" ;
223263String keyStoreFileName = " certificates/ssc.alpha.example.com.p12" ;
@@ -240,43 +280,6 @@ try {
240280
241281```
242282
243- #### Preparing HTTP Signature Token
244-
245- Append this signature token into the Authorization header of the HTTP request
246-
247- Params:
248- * realm
249- * authPrefix - Authorization Header scheme prefix , i.e 'prefix_appId'
250- * httpMethod
251- * urlPath
252- * appId - App ID created in Gateway
253- * secret - set to null for REST L2 SHA256WITHRSA
254- * formList
255- * password
256- * alias
257- * fileName
258- * nonce - set to null for random generated number
259- * timestamp - set to null for current timestamp
260-
261-
262- ``` java
263- String url = " https://<<URL>>/api/v1/?ap=裕廊坊%20心邻坊" ;
264- String certFileName = " certificates/ssc.alpha.example.com.p12" ;
265- String password = " <<passphrase>>" ;
266- String alias = " alpha" ;
267- String appId = " <<appId>>" ;
268- String secret = null ;
269- ApiList formList = null ;
270- String nonce = null ;
271- String timestamp = null ;
272-
273- try {
274- String signature = ApiSigning . getSignatureToken(" http://api.test.io/l2" , " <<authPrefix>>" , " get" , url, appId, null , null , password, alias, certFileName, nonce, timestamp);
275- } catch (ApiUtilException e) {
276- e. printStackTrace();
277- }
278- ```
279-
280283## Contributing
281284For more information about contributing PRs and issues, see [ CONTRIBUTING.md] ( .github/CONTRIBUTING.md ) .
282285
0 commit comments