narrow-greece-70477
08/27/2023, 4:11 AMauthorizers:
allow:
enabled: true
remote:
enabled: true
config:
remote: <http://localhost:3001/relation-tuples/check>
remote_json:
enabled: true
config:
remote: <http://localhost:3001/relation-tuples/check>
# <https://github.com/ory/oathkeeper/issues/797>
forward_response_headers_to_upstream: []
payload: |
{
"subject": "{{ print .Subject }}",
"resource": "{{ printIndex .MatchContext.RegexpCaptureGroups 0 }}"
}
Since I have this deployed on k8s using helm here is my extraContainer config. Here is the code for the proxy. Its very simple. https://github.com/ballerabdude/secure-http-proxy
extraContainers: |
- name: http-proxy
image: <http://myazureacr.azurecr.io/http-proxy:0.0.13|myazureacr.azurecr.io/http-proxy:0.0.13>
env:
- name: TARGET_URL
value: "<https://oryurl.com>"
- name: SECRET_PREFIX
value: "httpproxy-"
- name: KEYVAULT_URL
value: <https://my-kv.vault.azure.net>
- name: DEBUG_MODE
value: "true"
My access rule for the authorization part
authorizer:
handler: remote_json
config:
payload: |
{
"namespace": "Site",
"object": "<http://mysite.com|mysite.com>",
"relation": "allows",
"subject_id": "{{print .Extra.identity.id }}",
"subject": "User"
}
brave-pillow-3744
08/27/2023, 9:04 AMauthorizers:
remote_json:
enabled: true
config:
remote: <http://localhost:3001/relation-tuples/check>
payload: |
{
"subject_id": "{{ print .Extra.identity.id }}"
}
access-rules.yml
authorizer:
handler: remote_json
config:
remote: <http://localhost:3001/relation-tuples/check>
payload: |
{
"namespace": "Site",
"object": "<http://mysite.com|mysite.com>",
"relation": "allows",
"subject_id": "{{ print .Extra.identity.id }}"
}
Make sure when you do authentication using authenticators, the response payload has the Extra.identity.id
Hope this will be helpful.icy-manchester-83109
08/27/2023, 9:45 AMnarrow-greece-70477
08/27/2023, 2:08 PM{
"namespace": "Site",
"object": "<http://mysite.com|mysite.com>",
"relation": "allows",
"subject_id": "164cc415-499e-4ad7-bcc5-b9823af9dfea",
"subject": "User",
"subject_set": {
"namespace": "Group",
"object": "mysite-admins",
"relation": "members"
}
}
I wanted only users in the admin group to have access.