You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/11/03 14:05:49 UTC

[GitHub] [apisix] fukiki opened a new pull request #2599: Optimize the document for hmac-auth

fukiki opened a new pull request #2599:
URL: https://github.com/apache/apisix/pull/2599


   ### What this PR does / why we need it:
   fix issue #2531 
   
   ### Pre-submission checklist:
   
   * [x] Did you explain what problem does this PR solve? Or what new features have been added?
   * [x] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [x] Is this PR backward compatible?
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] membphis commented on a change in pull request #2599: Plugins(Doc): Optimize the document for hmac-auth

Posted by GitBox <gi...@apache.org>.
membphis commented on a change in pull request #2599:
URL: https://github.com/apache/apisix/pull/2599#discussion_r516468684



##########
File path: doc/examples/plugins-hmac-auth-generate-signature.md
##########
@@ -0,0 +1,203 @@
+

Review comment:
       remove this useless line

##########
File path: doc/zh-cn/plugins/hmac-auth.md
##########
@@ -206,3 +209,21 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
     }
 }'
 ```
+
+## 签名生成示例
+
+以 HMAC SHA256 为例,介绍一下各种语言的签名生成示例。
+
+示例入参说明:
+Variable | Value
+---|---
+secret | this is secret key
+message | this is signature string
+
+示例出参说明:
+Type | Hash

Review comment:
       ditto

##########
File path: doc/zh-cn/plugins/hmac-auth.md
##########
@@ -206,3 +209,21 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
     }
 }'
 ```
+
+## 签名生成示例
+
+以 HMAC SHA256 为例,介绍一下各种语言的签名生成示例。
+
+示例入参说明:
+Variable | Value

Review comment:
       add a blank line before the table




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] fukiki commented on a change in pull request #2599: Plugins(Doc): Optimize the document for hmac-auth

Posted by GitBox <gi...@apache.org>.
fukiki commented on a change in pull request #2599:
URL: https://github.com/apache/apisix/pull/2599#discussion_r516384637



##########
File path: doc/plugins/hmac-auth.md
##########
@@ -205,3 +209,201 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
     }
 }'
 ```
+
+## Generate Signature Examples
+
+Take HMAC SHA256 as an example to introduce the signature generation examples in different languages.
+
+Example inputs:
+Variable | Value
+---|---
+secret | this is secret key
+message | this is signature string
+
+Example outputs:
+Type | Hash
+---|---
+hexit | ad1b76c7e5054009380edca35d3f36cc5b6f45c82ee02ea3af64197ebddb9345
+base64 | rRt2x+UFQAk4DtyjXT82zFtvRcgu4C6jr2QZfr3bk0U=
+
+### Python 3

Review comment:
       I considered it, but I did not find a suitable folder to put this file. 
   Do you have any good suggestions?
   Looking forward to your suggestions.

##########
File path: doc/plugins/hmac-auth.md
##########
@@ -205,3 +209,201 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
     }
 }'
 ```
+
+## Generate Signature Examples
+
+Take HMAC SHA256 as an example to introduce the signature generation examples in different languages.
+
+Example inputs:
+Variable | Value
+---|---
+secret | this is secret key
+message | this is signature string
+
+Example outputs:
+Type | Hash
+---|---
+hexit | ad1b76c7e5054009380edca35d3f36cc5b6f45c82ee02ea3af64197ebddb9345
+base64 | rRt2x+UFQAk4DtyjXT82zFtvRcgu4C6jr2QZfr3bk0U=
+
+### Python 3

Review comment:
       @Firstsawyou Although these code examples are more intuitive in this file, it's better to maintain in a separate file.
   @spacewander Thanks for your suggestion!
   I modified my PR

##########
File path: doc/examples/plugins-hmac-auth-generate-signature.md
##########
@@ -0,0 +1,184 @@
+

Review comment:
       Thanks, I will modify the PR

##########
File path: doc/plugins/hmac-auth.md
##########
@@ -127,7 +128,10 @@ x-custom-header:value
 ### Use the generated signature to try the request
 
 **Note: ACCESS_KEY, SIGNATURE, ALGORITHM, DATE, SIGNED_HEADERS respectively represent the corresponding variables**
-**Note: SIGNED_HEADERS is the headers specified by the client to join the encryption calculation**
+
+**Note: SIGNED_HEADERS is the headers specified by the client to join the encryption calculation. If there are multiple headers, they must be separated by ";": `x-custom-header-a;x-custom-header-b`**
+
+**Note: SIGNATURE needs to use base64 for encryption: `base64_encode(SIGNATURE)`**
 

Review comment:
       Thanks, I will modify the PR

##########
File path: doc/examples/plugins-hmac-auth-generate-signature.md
##########
@@ -0,0 +1,203 @@
+

Review comment:
       Resolve, thanks for your review!

##########
File path: doc/zh-cn/plugins/hmac-auth.md
##########
@@ -206,3 +209,21 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
     }
 }'
 ```
+
+## 签名生成示例
+
+以 HMAC SHA256 为例,介绍一下各种语言的签名生成示例。
+
+示例入参说明:
+Variable | Value

Review comment:
       Resolve, thanks for your review!

##########
File path: doc/zh-cn/plugins/hmac-auth.md
##########
@@ -206,3 +209,21 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
     }
 }'
 ```
+
+## 签名生成示例
+
+以 HMAC SHA256 为例,介绍一下各种语言的签名生成示例。
+
+示例入参说明:
+Variable | Value
+---|---
+secret | this is secret key
+message | this is signature string
+
+示例出参说明:
+Type | Hash

Review comment:
       Resolve, thanks for your review!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on a change in pull request #2599: Plugins(Doc): Optimize the document for hmac-auth

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #2599:
URL: https://github.com/apache/apisix/pull/2599#discussion_r515872733



##########
File path: doc/plugins/hmac-auth.md
##########
@@ -205,3 +209,201 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
     }
 }'
 ```
+
+## Generate Signature Examples
+
+Take HMAC SHA256 as an example to introduce the signature generation examples in different languages.
+
+Example inputs:
+Variable | Value
+---|---
+secret | this is secret key
+message | this is signature string
+
+Example outputs:
+Type | Hash
+---|---
+hexit | ad1b76c7e5054009380edca35d3f36cc5b6f45c82ee02ea3af64197ebddb9345
+base64 | rRt2x+UFQAk4DtyjXT82zFtvRcgu4C6jr2QZfr3bk0U=
+
+### Python 3

Review comment:
       Maybe we can move the code examples to a separate file since they are too big.

##########
File path: doc/plugins/hmac-auth.md
##########
@@ -205,3 +209,201 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
     }
 }'
 ```
+
+## Generate Signature Examples
+
+Take HMAC SHA256 as an example to introduce the signature generation examples in different languages.
+
+Example inputs:
+Variable | Value
+---|---
+secret | this is secret key
+message | this is signature string
+
+Example outputs:
+Type | Hash
+---|---
+hexit | ad1b76c7e5054009380edca35d3f36cc5b6f45c82ee02ea3af64197ebddb9345
+base64 | rRt2x+UFQAk4DtyjXT82zFtvRcgu4C6jr2QZfr3bk0U=
+
+### Python 3

Review comment:
       @fukiki 
   What about making a new directory `doc/examples`, put file there, and leave a link in this plugin's doc?

##########
File path: doc/examples/plugins-hmac-auth-generate-signature.md
##########
@@ -0,0 +1,184 @@
+

Review comment:
       Need to add LICENSE header: https://github.com/apache/apisix/runs/1345989159#step:11:136 to make the CI pass.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] membphis merged pull request #2599: Plugins(Doc): Optimize the document for hmac-auth

Posted by GitBox <gi...@apache.org>.
membphis merged pull request #2599:
URL: https://github.com/apache/apisix/pull/2599


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] liuxiran commented on a change in pull request #2599: Plugins(Doc): Optimize the document for hmac-auth

Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #2599:
URL: https://github.com/apache/apisix/pull/2599#discussion_r516448923



##########
File path: doc/plugins/hmac-auth.md
##########
@@ -127,7 +128,10 @@ x-custom-header:value
 ### Use the generated signature to try the request
 
 **Note: ACCESS_KEY, SIGNATURE, ALGORITHM, DATE, SIGNED_HEADERS respectively represent the corresponding variables**
-**Note: SIGNED_HEADERS is the headers specified by the client to join the encryption calculation**
+
+**Note: SIGNED_HEADERS is the headers specified by the client to join the encryption calculation. If there are multiple headers, they must be separated by ";": `x-custom-header-a;x-custom-header-b`**
+
+**Note: SIGNATURE needs to use base64 for encryption: `base64_encode(SIGNATURE)`**
 

Review comment:
       it would be better to use one `Note` here.
   e.g :
   Note:
   
   1. xxx
   
   1. xxx




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] Firstsawyou commented on a change in pull request #2599: Plugins(Doc): Optimize the document for hmac-auth

Posted by GitBox <gi...@apache.org>.
Firstsawyou commented on a change in pull request #2599:
URL: https://github.com/apache/apisix/pull/2599#discussion_r516384100



##########
File path: doc/plugins/hmac-auth.md
##########
@@ -205,3 +209,201 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f
     }
 }'
 ```
+
+## Generate Signature Examples
+
+Take HMAC SHA256 as an example to introduce the signature generation examples in different languages.
+
+Example inputs:
+Variable | Value
+---|---
+secret | this is secret key
+message | this is signature string
+
+Example outputs:
+Type | Hash
+---|---
+hexit | ad1b76c7e5054009380edca35d3f36cc5b6f45c82ee02ea3af64197ebddb9345
+base64 | rRt2x+UFQAk4DtyjXT82zFtvRcgu4C6jr2QZfr3bk0U=
+
+### Python 3

Review comment:
       I think these code examples are good in this file, so it is more intuitive. If the document is placed in a different location, it is easy for users to miss it.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org