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/10/16 13:08:56 UTC

[GitHub] [apisix] liuxiran opened a new issue #2441: plugin(hmac-auth): update the schema

liuxiran opened a new issue #2441:
URL: https://github.com/apache/apisix/issues/2441


   Part of https://github.com/apache/apisix/issues/2082
   ### Current schema
   ```json
   {
   	"additionalProperties": false,
   	"properties": {
   		"disable": {
   			"type": "boolean"
   		}
   	},
   	"title": "work with route or service object",
   	"type": "object"
   }
   ```
   the plugin page looks:
   ![2020-10-16 20-39-49屏幕截图](https://user-images.githubusercontent.com/2561857/96259158-c3b5bd00-0fef-11eb-8375-b631eecead37.png)
   
   ---
   
   ### Expected schema
   according to the [doc](https://github.com/apache/apisix/blob/master/doc/zh-cn/plugins/hmac-auth.md#%E5%B1%9E%E6%80%A7) and [test case](https://github.com/apache/apisix/blob/1afa8f77272e6099d2c54e4f703f6a70adb16f72/t/plugin/hmac-auth.t#L27)
   
   ```json
   {
     "type": "object",
     "required": [
       "access_key",
       "secret_key"
     ],
     "properties": {
       "access_key": {
         "type": "string",
         "title": "Accesskey"
       },
       "secret_key": {
         "type": "string",
         "title": "Secretkey"
       },
       "algorithm": {
         "type": "string",
         "enum": [
           "hmac-sha1",
           "hmac-sha256",
           "hmac-sha512"
         ],
         "default": "hmac-sha256",
         "title": "Algorithm"
       },
       "clock_skew": {
         "type": "number",
         "title": "clockskew",
         "default": 0
       },
       "signed_headers": {
         "type": "array",
         "title": "A list of strings",
         "items": {
           "type": "string",
           "default": "bazinga"
         }
       }
     }
   }
   ```
   the form looks:
   
   ![2020-10-16 21-06-48屏幕截图](https://user-images.githubusercontent.com/2561857/96261849-8b17e280-0ff3-11eb-8243-de6d4fca3691.png)
   
   ```


----------------------------------------------------------------
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 issue #2441: plugin(hmac-auth): update the schema

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #2441:
URL: https://github.com/apache/apisix/issues/2441#issuecomment-710785441


   I think we should pass the schema type to get the correct schema, since currently we already have three kinds of schema:
   1. metadata
   2. consumer
   3. route/service


----------------------------------------------------------------
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 edited a comment on issue #2441: plugin(hmac-auth): update the schema

Posted by GitBox <gi...@apache.org>.
liuxiran edited a comment on issue #2441:
URL: https://github.com/apache/apisix/issues/2441#issuecomment-714330623


   ok,  based on the results of the discussion above, I think this issue contains at least two modifications: 
   
   - [x] admin-api provides api like:
        * `/apisix/admin/schema/plugins/{plugin_name}` to get plugin schema
        * `/apisix/admin/schema/plugins/{plugin_name}?schema_type=consumer_schema` to get plugin consumer_schema
   
   - [x] dashboard calls the corresponding api to get the correct schema.
   
   e.g:
   
   1. consumer wants to config hmac-auth plugin, then call `/apisix/admin/schema/plugins/hmac-auth?schema_type=consumer_schema` to get the config schema
   
   1. route wants to config hmac-auth plugin, then call `/apisix/admin/schema/plugins/hmac-auth` to get the config schema
   
   my partner and I will take this issue :)


----------------------------------------------------------------
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 issue #2441: plugin(hmac-auth): update the schema

Posted by GitBox <gi...@apache.org>.
liuxiran commented on issue #2441:
URL: https://github.com/apache/apisix/issues/2441#issuecomment-710779509


   `hmac-auth` define two schemas:
   
   - one is : https://github.com/apache/apisix/blob/d1729c0af3bc416a88904568b4d2718c99a1982d/apisix/plugins/hmac-auth.lua#L40
   
   - the other one is: https://github.com/apache/apisix/blob/d1729c0af3bc416a88904568b4d2718c99a1982d/apisix/plugins/hmac-auth.lua#L47
   
   - and the schema returned to the caller is only:  https://github.com/apache/apisix/blob/d1729c0af3bc416a88904568b4d2718c99a1982d/apisix/plugins/hmac-auth.lua#L80
   
   maybe this is the cause of the problem, and this case has already made part of the plugins unuseable in dashboard.
   
   so is it possible to return differet schema depending on the different param or return all schemas that caller coulde Judge which one to use?
   
   @juzhiyuan @moonming @membphis @spacewander 
   
   


----------------------------------------------------------------
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] Jaycean commented on issue #2441: plugin(hmac-auth): update the schema

Posted by GitBox <gi...@apache.org>.
Jaycean commented on issue #2441:
URL: https://github.com/apache/apisix/issues/2441#issuecomment-715128601


   Assigne to me


----------------------------------------------------------------
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 issue #2441: plugin(hmac-auth): update the schema

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #2441:
URL: https://github.com/apache/apisix/issues/2441#issuecomment-712678179


   > My suggestion is to put `metadata`/`consumer` into the arguments, if the argument is missing, choice the default plain `schema`.
   
   this way is much better. agree +1


----------------------------------------------------------------
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] Jaycean edited a comment on issue #2441: plugin(hmac-auth): update the schema

Posted by GitBox <gi...@apache.org>.
Jaycean edited a comment on issue #2441:
URL: https://github.com/apache/apisix/issues/2441#issuecomment-715128601


   Please assign to me


----------------------------------------------------------------
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 issue #2441: plugin(hmac-auth): update the schema

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #2441:
URL: https://github.com/apache/apisix/issues/2441#issuecomment-711143671


   My suggestion is to put `metadata`/`consumer` into the arguments, if the argument is missing, choice the default plain `schema`.


----------------------------------------------------------------
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 edited a comment on issue #2441: plugin(hmac-auth): update the schema

Posted by GitBox <gi...@apache.org>.
liuxiran edited a comment on issue #2441:
URL: https://github.com/apache/apisix/issues/2441#issuecomment-710779509


   `hmac-auth` define two schemas:
   
   - one is : https://github.com/apache/apisix/blob/d1729c0af3bc416a88904568b4d2718c99a1982d/apisix/plugins/hmac-auth.lua#L40
   
   - the other one is: https://github.com/apache/apisix/blob/d1729c0af3bc416a88904568b4d2718c99a1982d/apisix/plugins/hmac-auth.lua#L47
   
   - and the schema returned to the caller is only:  https://github.com/apache/apisix/blob/d1729c0af3bc416a88904568b4d2718c99a1982d/apisix/plugins/hmac-auth.lua#L80
   
   maybe this is the cause of the problem, and **this case has already made part of the plugins unuseable in dashboard.**
   
   so is it possible to return differet schema depending on the different param or return all schemas that caller coulde Judge which one to use?
   
   @juzhiyuan @moonming @membphis @spacewander 
   
   


----------------------------------------------------------------
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] juzhiyuan commented on issue #2441: plugin(hmac-auth): update the schema

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on issue #2441:
URL: https://github.com/apache/apisix/issues/2441#issuecomment-710779709


   @membphis Please take a look


----------------------------------------------------------------
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] imjoey commented on issue #2441: plugin(hmac-auth): update the schema

Posted by GitBox <gi...@apache.org>.
imjoey commented on issue #2441:
URL: https://github.com/apache/apisix/issues/2441#issuecomment-712514522


   > My suggestion is to put `metadata`/`consumer` into the arguments, if the argument is missing, choice the default plain `schema`.
   
   +1 . IMHO, query parameters would be more flexible.


----------------------------------------------------------------
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 issue #2441: plugin(hmac-auth): update the schema

Posted by GitBox <gi...@apache.org>.
liuxiran commented on issue #2441:
URL: https://github.com/apache/apisix/issues/2441#issuecomment-714330623


   ok,  based on the results of the discussion above, I think this issue contains at least two modifications: 
   
   - [ ] admin-api provides api like:
        * `/apisix/admin/schema/plugins/{plugin_name}` to get plugin schema
        * `/apisix/admin/schema/plugins/{plugin_name}?schema_type=consumer_schema` to get plugin consumer_schema
   
   - [ ] dashboard calls the corresponding api to get the correct schema.
   
   e.g:
   
   1. consumer wants to config hmac-auth plugin, then call `/apisix/admin/schema/plugins/hmac-auth?schema_type=consumer_schema` to get the config schema
   
   1. route wants to config hmac-auth plugin, then call `/apisix/admin/schema/plugins/hmac-auth` to get the config schema
   
   my partner and I will take this issue :)


----------------------------------------------------------------
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] juzhiyuan closed issue #2441: plugin(hmac-auth): update the schema

Posted by GitBox <gi...@apache.org>.
juzhiyuan closed issue #2441:
URL: https://github.com/apache/apisix/issues/2441


   


----------------------------------------------------------------
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] juzhiyuan commented on issue #2441: plugin(hmac-auth): update the schema

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on issue #2441:
URL: https://github.com/apache/apisix/issues/2441#issuecomment-714349134


   yep 😁


----------------------------------------------------------------
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 edited a comment on issue #2441: plugin(hmac-auth): update the schema

Posted by GitBox <gi...@apache.org>.
liuxiran edited a comment on issue #2441:
URL: https://github.com/apache/apisix/issues/2441#issuecomment-714330623


   ok,  based on the results of the discussion above, I think this issue contains at least two modifications: 
   
   - [x] admin-api provides api like:
        * `/apisix/admin/schema/plugins/{plugin_name}` to get plugin schema
        * `/apisix/admin/schema/plugins/{plugin_name}?schema_type=consumer_schema` to get plugin consumer_schema
   
   - [ ] dashboard calls the corresponding api to get the correct schema.
   
   e.g:
   
   1. consumer wants to config hmac-auth plugin, then call `/apisix/admin/schema/plugins/hmac-auth?schema_type=consumer_schema` to get the config schema
   
   1. route wants to config hmac-auth plugin, then call `/apisix/admin/schema/plugins/hmac-auth` to get the config schema
   
   my partner and I will take this issue :)


----------------------------------------------------------------
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 issue #2441: plugin(hmac-auth): update the schema

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #2441:
URL: https://github.com/apache/apisix/issues/2441#issuecomment-714506729


   `/apisix/admin/schema/plugins/{plugin_name}?schema_type=consumer_schema`
   
   to
   
   `/apisix/admin/schema/plugins/{plugin_name}?schema_type=consumer`
   
   simpler


----------------------------------------------------------------
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 issue #2441: plugin(hmac-auth): update the schema

Posted by GitBox <gi...@apache.org>.
liuxiran commented on issue #2441:
URL: https://github.com/apache/apisix/issues/2441#issuecomment-714507677


   > `/apisix/admin/schema/plugins/{plugin_name}?schema_type=consumer_schema`
   > 
   > to
   > 
   > `/apisix/admin/schema/plugins/{plugin_name}?schema_type=consumer`
   > 
   > simpler
   
   got 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



[GitHub] [apisix] membphis commented on issue #2441: plugin(hmac-auth): update the schema

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #2441:
URL: https://github.com/apache/apisix/issues/2441#issuecomment-711019661


   > * metadata
   > * consumer
   
   How about this API style?
   
   ```
   /apisix/admin/schema/plugins/{plugin_name}/metadata
   /apisix/admin/schema/plugins/{plugin_name}/consumer
   ```


----------------------------------------------------------------
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