mammoth-country-5949
07/13/2022, 6:26 PMcookie_session
authenticator:
cookie_session:
enabled: true
config:
check_session_url: <http://ory-kratos-public/sessions/whoami>
preserve_path: true
preserve_query: true
force_method: GET
extra_from: "@this"
and a remote_json
authorizer:
remote_json:
enabled: true
config:
remote: <http://ory-keto-read/check>
forward_response_headers_to_upstream: []
payload: |
{
"namespace": "access",
"subject_id": "{{print .Extra.identity.traits.role }}"
"relation": "{{ print .MatchContext.Method }}"
"object": "{{ printIndex .MatchContext.RegexpCaptureGroups 2 }}:{{ printIndex .MatchContext.RegexpCaptureGroups 3 }}"
}
Using the sample UI provided to work with Kretos for authentication.. I can login successfully and in the same session
I hit the URL I’ve configured in the access rules:
accessRules: |
[
{
"id": "allow-authenticated-with-kratos",
"upstream": {
"url": "<https://httpbin.org/anything>"
},
"match": {
"url": "http://<[^/]+>/<devices>/<[[:digit:]]+>",
"methods": [
"GET",
"POST",
"PUT",
"DELETE",
"PATCH"
]
},
"authenticators": [{
"handler": "cookie_session"
}],
"authorizer": {
"handler": "remote_json"
},
"mutators": [{
"handler": "noop"
}]
}
]
The proxy returns 500 and the logs are telling me this:
time=2022-07-13T18:25:26Z level=warning msg=Access request denied audience=application error=map[message:payload is not a JSON text: invalid character '"' after object key:value pair] granted=false http_host=<http://oathkeeper.local.com|oathkeeper.local.com> http_method=GET http_url=<http://oathkeeper.local.com/devices/1234> http_user_agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36 service_name=ORY Oathkeeper service_version=v0.38.19-beta.1
mammoth-country-5949
07/13/2022, 6:28 PMmammoth-country-5949
07/13/2022, 6:53 PMextra_from: "@this"
mammoth-country-5949
07/13/2022, 9:26 PMsteep-lamp-91158
steep-lamp-91158
metadata_public
and metadata_admin
to store the role
both are not editable by the user, and metadata_admin
not even readable by the usersteep-lamp-91158
mammoth-country-5949
07/14/2022, 3:40 PMmammoth-country-5949
07/14/2022, 3:41 PMmammoth-country-5949
07/14/2022, 4:35 PMmammoth-country-5949
07/14/2022, 4:35 PMsteep-lamp-91158
steep-lamp-91158
magnificent-energy-493