Hi all,
I have a JWT token from our auth provider that contains an array of permissions. It looks like haproxy can not deal with an array. Following is the instruction I am using:
http-request set-var(txn.perm) http_auth_bearer,jwt_payload_query('$.permissions[*]')
However, I am only receiving the first value within the array. I have a workaround but it does not scale very well…
http-request set-var(txn.perm1) http_auth_bearer,jwt_payload_query('$.permissions[0]')
http-request set-var(txn.perm2) http_auth_bearer,jwt_payload_query('$.permissions[1]')
http-request set-var(txn.perm3) http_auth_bearer,jwt_payload_query('$.permissions[2]')
http-request set-var(txn.perm4) http_auth_bearer,jwt_payload_query('$.permissions[3]')
http-request set-var(txn.perm5) http_auth_bearer,jwt_payload_query('$.permissions[4]')
http-request set-var(txn.perm6) http_auth_bearer,jwt_payload_query('$.permissions[5]')
http-request set-var(txn.perm7) http_auth_bearer,jwt_payload_query('$.permissions[6]')
http-request set-var(txn.perm8) http_auth_bearer,jwt_payload_query('$.permissions[7]')
http-request set-var(txn.perm9) http_auth_bearer,jwt_payload_query('$.permissions[8]')
http-request set-var-fmt(txn.perm) "%[var(txn.perm1)] %[var(txn.perm2)] %[var(txn.perm3)] %[var(txn.perm4)] %[var(txn.perm5)] %[var(txn.perm6)] %[var(txn.perm7)] %[var(txn.perm8)]"
I need to provision enough variables to contain every single permission which might prove hard.
Are there other alternatives to deal with this?
FYI I’m running HAProxy 2.6.6 within a docker container.
Thanks