Skip to content
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

Correctly add auth headers that should be sent to the upstream #143

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

adam-cattermole
Copy link
Member

@adam-cattermole adam-cattermole commented Nov 12, 2024

Authorino does not support the following fields in an OkHttpResponse:

  • response_headers_to_add
  • headers_to_remove
  • query_parameters_to_set
  • query_parameters_to_remove

If any of these are set we panic with an appropriate response.

We now (correctly) set headers sent to the upstream from the headers field.

Confirmed this locally by adding the following to the authconfig:

headers:
  "simple":
    json:
      properties:
        "data":
          value: true

Make the request:

curl -H "Host: test.a.auth.com" -H "Authorization: APIKEY IAMALICE" http://127.0.0.1:8000/get -i

See in the echo response of the upstream that it receives the header:

{
  "method": "GET",
  "path": "/get",
  "query_string": null,
  "body": "",
  "headers": {
    "Host": "test.a.auth.com",
    "User-Agent": "curl/8.7.1",
    "Accept": "*/*",
    "Authorization": "APIKEY IAMALICE",
    "X-Forwarded-For": "10.244.0.18",
    "X-Forwarded-Proto": "http",
    "X-Envoy-Internal": "true",
    "X-Request-Id": "ebd0ab64-73c4-4a03-ad20-9ce810a3f057",
    "Simple": "{\"data\":true}",
    "X-Envoy-Expected-Rq-Timeout-Ms": "15000",
    "Version": "HTTP/1.1"
  },
  "uuid": "4a8906a8-31ec-493f-98a9-513ff7b4c79b"
}

src/service/auth.rs Outdated Show resolved Hide resolved
@adam-cattermole adam-cattermole merged commit a32f1dd into main Nov 12, 2024
13 checks passed
@adam-cattermole adam-cattermole deleted the fix-auth-headers branch November 12, 2024 17:14
@adam-cattermole adam-cattermole added the bug Something isn't working label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants