red-secretary-8597
02/01/2024, 8:02 AMverifiable_addresses
data from kratos.
Here is my sample config for oathkeeper
- id: "api:httpbin-protected"
upstream:
preserve_host: true
url: "<http://httpbin:80/anything>"
match:
url: "<http://oathkeeper:4455/httpbin/><.*>"
methods:
- GET
- POST
- PUT
- PATCH
- DELETE
authenticators:
- handler: cookie_session
mutators:
- handler: header
config:
headers:
X-Verified: "{{ print .Extra.identity.verifiable_addresses }}"
authorizer:
handler: allow
errors:
- handler: redirect
config:
to: <http://localhost:4435/panel/login>
This will give the upstream the X-Verified: [map[created_at:2024-02-01T07:12:38.871976Z id:7652afd1-c05b-432c-bf80-98e6d6a6efcd status:completed updated_at:2024-02-01T07:12:38.871976Z value:<mailto:test@test.com|test@test.com> verified:true verified_at:2024-02-01T07:12:57.743714Z via:email]]"
but i only want the verified:true
part.
Is it possible for oathkeeper to get the first data from the array of map? thank you 🙏icy-manchester-83109
02/01/2024, 8:35 AM{{ first .Extra.identity.verifiable_addresses }}
see also http://masterminds.github.io/sprig/lists.html), or e.g. {{ index .Extra.identity.verifiable_addresses 0 }}
red-secretary-8597
02/01/2024, 9:00 AMwitty-holiday-65473
02/01/2024, 9:20 AMrequire_verified_address
set, it's a good idea to use printIndex
because that particular function will gracefully handle nil
where index
itself will not. not absolutely required, but a touch safer.
slight downside: printIndex
won't work with string
indexes as would be present in maps.