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 2021/04/10 15:03:08 UTC

[GitHub] [apisix] Marco-Zheng opened a new issue #4022: request help:

Marco-Zheng opened a new issue #4022:
URL: https://github.com/apache/apisix/issues/4022


   ### Issue description
   when i installed jwt-auth with authCode by using curl -H , it didn't work
   ![image](https://user-images.githubusercontent.com/52538259/114274176-ce598800-9a4f-11eb-8854-afc58debb191.png)
   
   but used curl --cookie, it worked well!
   ![image](https://user-images.githubusercontent.com/52538259/114274244-0e206f80-9a50-11eb-81d4-b4ee0e5a31cb.png)
   
   may i know if any wrong with my settings?
   
   below is my settings:
   
   - Consumer:
   ```
   {
     "username": "jack",
     "plugins": {
       "jwt-auth": {
         "algorithm": "RS256",
         "base64_secret": false,
         "exp": 86400,
         "key": "user-key",
         "private_key": "-----BEGIN RSA PRIVATE KEY-----\n……\n-----END RSA PRIVATE KEY-----",
         "public_key": "-----BEGIN PUBLIC KEY-----\n……\n-----END PUBLIC KEY-----",
         "secret": "my-secret-key"
       }
     }
   }
   ```
   - Route
   ```
   {
     "uris": [
       "/patient/patient/id"
     ],
     "name": "xxxxxxxx",
     "methods": [
       "GET",
       "HEAD",
       "POST",
       "PUT",
       "DELETE",
       "OPTIONS",
       "PATCH"
     ],
     "hosts": [
       "marco.org"
     ],
     "plugins": {
       "echo": {
         "after_body": "\n----the request finished----\n",
         "before_body": "----the request coming----\n"
       },
       "jwt-auth": {},
       "key-auth": {
         "disable": true
       },
       "proxy-rewrite": {
         "headers": {
           "X-Api-Engine": "apisix",
           "X-Api-Version": "v1",
           "X-Api-useless": ""
         },
         "scheme": "http",
         "uri": "/patient/patient/id"
       }
     },
     "upstream_id": "xxxxxxxx",
     "status": 1
   }
   ```
   
   
   
   ### Environment
   
   * apisix version (cmd: `apisix version`): 2.5
   


-- 
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 issue #4022: request help:

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


   > Maybe any problem with getting conf.auth_value,but i didn't find where trigger the method of echo.access(conf, ctx)
   > ![image](https://user-images.githubusercontent.com/52538259/114291958-d3edb700-9abd-11eb-9e7f-f4b9a00b7c10.png)
   
   It seems that you have added your own logic code to the jwt-auth plugin. According to the code logic you modified, it is reasonable to use the request header `Authorization` to get the result. Because, there is no `conf.auth_value` field in the `conf` parameter of the jwt-auth plugin.


-- 
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] Marco-Zheng commented on issue #4022: request help:

Posted by GitBox <gi...@apache.org>.
Marco-Zheng commented on issue #4022:
URL: https://github.com/apache/apisix/issues/4022#issuecomment-817242039


   > ed putting the token in the request header (A
   
   I checked my auth-code is correct , per cookie solution worked well, but while i use below method
   ```
   curl -i -X GET "http://127.0.0.1:9080/patient/patient/id" -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MTgxNTE5OTYsImtleSI6InVzZXIta2V5In0.8zjuhXV5MwQMSl6FIPyBJnCzxWYfBkc4Y6shG0RonOU' -H "Host: marco.org" -i
   ```
   the error log shown as below... Obviously it was rejected.
   ![image](https://user-images.githubusercontent.com/52538259/114291486-596f6800-9aba-11eb-815e-b80f02d268b8.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] Firstsawyou edited a comment on issue #4022: request help:

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


   This is very strange, I tested putting the token in the request header (Authorization) and it worked very well.
   Did you check if the signature used is correct, or check the output of the `error.log` log?


-- 
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 removed a comment on issue #4022: request help:

Posted by GitBox <gi...@apache.org>.
Firstsawyou removed a comment on issue #4022:
URL: https://github.com/apache/apisix/issues/4022#issuecomment-817246558


   > Maybe any problem with getting conf.auth_value,but i didn't find where trigger the method of echo.access(conf, ctx)
   > ![image](https://user-images.githubusercontent.com/52538259/114291958-d3edb700-9abd-11eb-9e7f-f4b9a00b7c10.png)
   
   It seems that you have added your own logic code to the jwt-auth plugin. According to the code logic you modified, it is reasonable to use the request header `Authorization` to get the result. Because, there is no `conf.auth_value` field in the `conf` parameter of the jwt-auth plugin.


-- 
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] tokers removed a comment on issue #4022: request help: jw-auth is ineffective

Posted by GitBox <gi...@apache.org>.
tokers removed a comment on issue #4022:
URL: https://github.com/apache/apisix/issues/4022#issuecomment-817262870


   @Marco-Zheng The body "unauthorized body" in your first screenshot is not generated by APISIX. I cannot search it in APISIX code base, have you ever tried to access the upstream directly?


-- 
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 #4022: request help: jw-auth is ineffective

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


   Closed as lack of response.


-- 
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 closed issue #4022: request help: jw-auth is ineffective

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


   


-- 
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] tokers commented on issue #4022: request help: jw-auth is ineffective

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


   @Marco-Zheng The body "unauthorized body" in your first screenshot is not generated by APISIX. I cannot search it in APISIX code base, have you ever tried to access the upstream directly?


-- 
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 issue #4022: request help:

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


   This is very strange, I tested putting the token in the request header (Authorization) and it worked very well.
   Did you check that the signature used is correct?


-- 
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 issue #4022: request help:

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


   > Maybe any problem with getting conf.auth_value,but i didn't find where trigger the method of echo.access(conf, ctx)
   > ![image](https://user-images.githubusercontent.com/52538259/114291958-d3edb700-9abd-11eb-9e7f-f4b9a00b7c10.png)
   
   It seems that you have added your own logic code to the jwt-auth plugin. According to the code logic you modified, it is reasonable to use the request header `Authorization` to get the result. Because, there is no `conf.auth_value` field in the `conf` parameter of the jwt-auth plugin.


-- 
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] Marco-Zheng commented on issue #4022: request help:

Posted by GitBox <gi...@apache.org>.
Marco-Zheng commented on issue #4022:
URL: https://github.com/apache/apisix/issues/4022#issuecomment-817243482


   > This is very strange, I tested putting the token in the request header (Authorization) and it worked very well.
   > Did you check if the signature used is correct, or check the output of the `error.log` log?
   
   Maybe any problem with getting conf.auth_value,but i didn't find where trigger the method of echo.access(conf, ctx)
   ![image](https://user-images.githubusercontent.com/52538259/114291958-d3edb700-9abd-11eb-9e7f-f4b9a00b7c10.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