Hi all! I'm wondering: I'm using keto as my remote...
# talk-keto
s
Hi all! I'm wondering: I'm using keto as my remote_json authorizer in oathkeeper, but I would need to retrieve the namespace from the request header. So far, all of my attempts have either returns a 500 Internal Server Error (due to invalid golang syntax) or 403 Forbidden error (since the value is not correctly inserted into the payload). Has anyone faced a similar issue? The relevant access rule is as follows:, the
print .Extra.email
works fine. I've read the documentation regarding net/http golang and also tried a similar approach as shown here: https://github.com/ory/oathkeeper/issues/964 but to no avail. Any help is really appreciated 🙂
Copy code
{
  "id": "ory:keto",
  "upstream": {
    "url": "<http://my-upstream>"
  },
  "match": {
    "url": "http://<[^/]+>/any-path/<.*>",
    "methods": [
      "GET"
    ]
  },
  "authenticators": [
    {
      "handler": "jwt"
    }
  ],
  "authorizer": {
    "handler": "remote_json",
    "config": {
      "payload": "{\"namespace\": \"{{ print .Header \"Namespace\" }}\", \"object\": \"any-object\", \"relation\": \"any-relation\", \"subject_id\": \"{{ print .Extra.email }}\"}"
    }
  },
  "mutators": [
    {
      "handler": "noop"
    }
  ]
}
s
you probably have to double escape the quotes, try yaml as that is easier
at least regarding to quotes
s
We solved it using this: "namespace\": \"{{ .MatchContext.Header.Get \"X-mycustomheader\"