-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
X-Authenticated-Userid header not being forwarded to upstream API #535
Comments
@darkaeon10 I cannot replicate this bug with |
@thefosk Alright thanks! Hooray for 0.5.0! |
#476 Fixed it for the password grant, the problem is still open for the client credential workflow though |
@Gingonic correct me if I am wrong: The Since there is no third-party user logging into the web application, the To recap, |
Not sure about that :
Especially
Meaning there still is (or at least can be) a customer hidden behind the token. |
@Gingonic that is actually correct, thanks for the help. I will push a fix that will only allow to set an |
* Mashape/master: (23 commits) Update README.md Update README.md Closing Kong#562 Adding wait time before ratelimiting tests Fixing test fix(jwt) handle `iss` not being found in jwt credentials Update README.md docs(update) remove redundancy docs(update) fix layout fix(test) fix config test after Kong#563 Update README.md Adding missing statement for Kong#571 perf(analytics) global optimizations fix(plugins) make default config for plugins an empty object Closes Kong#445 dbocs(changelog) 0.5.0 changes Better content-type check in response-transformer plugin Closes Kong#535 Fixes the root problem at Kong#565 fix(key-auth) remove support for key in request body ...
@thefosk Is it possible that this is still an issue? I'm in Kong 0.5.0 and I'm not getting the headers forwarded. Not sure if I'm doing something wrong. This what I'm doing:
and then
I'm not getting the headers in the server, this is all I got:
|
@rafael let us know how it goes with the 0.5.1 |
@rafael So I just tested this with 0.5.1:
$ curl -d "request_host=oauth.com&upstream_url=http://httpbin.org" 127.0.0.1:8001/apis
{"upstream_url":"http:\/\/httpbin.org","id":"ddf3c3f2-f562-4022-c0ba-1a9c04647b24","name":"oauth.com","created_at":1444877763000,"request_host":"oauth.com"}
$ curl -d "name=oauth2&config.scopes=profile,email&config.enable_authorization_code=false&config.enable_password_grant=true" 127.0.0.1:8001/apis/oauth.com/plugins/
{"api_id":"ddf3c3f2-f562-4022-c0ba-1a9c04647b24","id":"3e2b98c8-7956-4f64-cf11-725981036a14","created_at":1444877851000,"enabled":true,"name":"oauth2","config":{"enable_authorization_code":false,"token_expiration":7200,"enable_implicit_grant":false,"scopes":["profile","email"],"provision_key":"23516763ec0c4311c39c48c34c5a661d","hide_credentials":false,"enable_password_grant":true,"enable_client_credentials":false,"mandatory_scope":false}}
$ curl -d "username=thefosk" 127.0.0.1:8001/consumers/
{"username":"thefosk","created_at":1444877894000,"id":"1eb36d22-b95d-4270-c2d9-7999a807256c"}
$ curl -d "name=Test&redirect_uri=https://www.google.com/" 127.0.0.1:8001/consumers/thefosk/oauth2/
{"consumer_id":"1eb36d22-b95d-4270-c2d9-7999a807256c","client_id":"9eb343fa20994be2cb0f69be8c6e9821","id":"670cf03a-4a16-4f3a-cf15-ec19dcfffdb4","name":"Test","created_at":1444877985000,"redirect_uri":"https:\/\/www.google.com\/","client_secret":"6205af554e474109c1b237f6a122b0d4"}
$ curl -d "grant_type=password&username=hello&password=world&scope=email&client_id=9eb343fa20994be2cb0f69be8c6e9821&client_secret=6205af554e474109c1b237f6a122b0d4&provision_key=23516763ec0c4311c39c48c34c5a661d&authenticated_userid=bob" -H "Host: oauth.com" https://127.0.0.1:8443/oauth2/token --insecure
{"refresh_token":"6c10650e9f844f4ecfe4c858dc962bb5","token_type":"bearer","access_token":"425184289b8b484bc85abf313a5be11d","expires_in":7200}
$ curl -H "Host: oauth.com" https://127.0.0.1:8443/get?access_token=425184289b8b484bc85abf313a5be11d --insecure
{
"args": {
"access_token": "425184289b8b484bc85abf313a5be11d"
},
"headers": {
"Accept": "*/*",
"Host": "httpbin.org",
"User-Agent": "curl/7.43.0",
"X-Authenticated-Scope": "email",
"X-Authenticated-Userid": "bob",
"X-Consumer-Id": "1eb36d22-b95d-4270-c2d9-7999a807256c",
"X-Consumer-Username": "thefosk"
},
"origin": "127.0.0.1, 40.140.33.170",
"url": "https://httpbin.org/get?access_token=425184289b8b484bc85abf313a5be11d"
} The header |
@thefosk: Started from scratch in 0.5.1 and it's working. Thanks! |
@thefosk - I am using Kong0.5.0 and trying to test the client credentials flow. I followed all the steps
curl -i -k --insecure -X POST https://localhost:8443/oauth2/token I am getting 401 - unauthorized message as follows. Can you please tell me what is wrong with the request. HTTP/1.1 401 Unauthorized {"message":"No API Key found in headers, body or querystring"} |
Found the problem. once I passed the host header as part of the request got back the access and refresh token. |
I manually provisioned an OAuth2 token (Resource Owner Password Credentials flow) for a user through a curl command as follows:
I used the returned access token by the provision above (10a2fcc8f0a34f05cf06df7ff90f7c23) to access my API. However, Kong did not include an X-Authenticated-Userid header in the forwarded request. A list of all headers received at the upstream server are shown below:
Any help would be greatly appreciated. Thanks!
The text was updated successfully, but these errors were encountered: