Hello again dear Oathkeeper people, I’m trying to ...
# talk-oathkeeper
s
Hello again dear Oathkeeper people, I’m trying to forward a payload from oathkeeper to a remote_json authorizer. I’m having a lot of trouble sending a slice of strings
[]string
. Here is a sample of my configuration (see
claims
key):
Copy code
authorizers:
        remote_json:
          enabled: true
          config:
            remote: <http://authz-service:4242/decide>
            payload: |
              {
                "input": {
                  "sub": "{{ print .Subject }}",
                  "bike": {{ or (print .Extra.hasBike) "false" }},
                  "claims": {{ printf "%+q" .Extra.claims }} 
                }
              }
I’ve followed the documentation provided by Ory here. In the current setup, oathkeeper gives me the following error:
message:payload is not a JSON text: invalid character '%' looking for beginning of value
If I try to escape the
printf
with
printf \"%+q\" .Extra.claims
I get another error:
unexpected "\\" in operand
. Any ideas/pointers into how to fix that ?
i
As far as I remember, functions offered by the sprig library are available. So you could use the
join
function to achieve your goal. Take a look here for usage examples: http://masterminds.github.io/sprig/string_slice.html
s
Hey ! Thanks 😊 I’d have to re-create the string escaping when needed so it seems doable but quite cumbersome. If I don’t find a better way, that’s what I’ll try 🙂