acoustic-shampoo-32095
11/22/2023, 11:39 AMauthorizers:
allow:
enabled: true
remote_json:
enabled: true
config:
remote: <http://keto:4466/relation-tuples/check>
payload: |
{
"namespace": "api_access",
"object": "endpoints",
"relation": "access",
"subject_id": "{{ print .Extra.identity.metadata_admin.role }}"
}
While at it, another question:
How can I forward the other metadata_admin key value pairs to the service?
I would think it would be like this but I cannot access the metadata_admin at all.
mutators:
- handler: header
config:
headers:
X-Company-ID: "{{ print .Extra.identity.metadata_admin.companyId }}"
chilly-king-10285
11/22/2023, 11:39 AMchilly-king-10285
11/22/2023, 11:40 AMmetadata_admin
field from the identity object in Ory. However, the extracts do not provide specific information on how to access this field directly. In the context of Ory Oathkeeper, the remote_json
authorizer and the header
mutator both support Go Templates, which allow you to customize the payload and headers respectively. The Go Templates are applied to an AuthenticationSession
object. However, the extracts do not provide details on whether the metadata_admin
field is accessible through this object. As for your second question, the header
mutator can indeed be used to forward metadata to the service. Your configuration seems correct, assuming that metadata_admin
and companyId
are accessible fields. However, as mentioned earlier, the extracts do not provide specific information on accessing these fields. I would recommend checking the Ory documentation or reaching out to the Ory community for more specific guidance on accessing these fields. Here are some relevant links from the extracts: - [Oathkeeper Pipeline](https://www.ory.sh/docs/oathkeeper/pipeline) - [Oathkeeper Mutators](https://www.ory.sh/docs/oathkeeper/pipeline/mutator) - [Oathkeeper Authorizers](https://www.ory.sh/docs/oathkeeper/pipeline/authz) Please note that the security of storing role information in traits would depend on your specific application and security requirements. It's always a good idea to follow best practices for data security and privacy.