Hey guys, I ran into an awkward problem while tryi...
# general
g
Hey guys, I ran into an awkward problem while trying to access a field under the
.Extra
map of
AuthenticatorSession
. The field is called
urn:zitadel:iam:user:resourceowner:name
, set by Zitadel on the JWT. However, if I try to use
"org_id": "{{ print .Extra.urn:zitadel:iam:user:resourceowner:name }}"
to get the field I get the following error,
level=error msg=An error occurred while handling a request audience=application error=map[message:template: e614bd826ea4391239a0b56709de34735c482d94e1a9276faaf1772893d85079:7: expected :=] http_request=map[headers:map[accept:*/* accept-encoding:gzip, deflate, br, zstd accept-language:en-US,en;q=0.9 authorization:Value is sensitive and has been redacted.
I am assuming the
:
is somehow interfering with go template parsing but can't think of a way to solve it. I've tried, 1.
.Extra."urn:zitadel:iam:user:resourceowner:name"
2.
.Extra["urn:zitadel:iam:user:resourceowner:name"]
3.
.Extra urn:zitadel:iam:user:resourceowner:name
4.
.Extra.\"urn:zitadel:iam:user:resourceowner:name\"
5.
.Extra.urn\:zitadel\:iam\:user\:resourceowner\:name
all of them had error because of unexpected character
1
Seems like I jumped the gun here, I didn't notice that the templating supports sprig functions including dict get. With that it was as simple as
"{{ print (get .Extra "urn:zitadel:iam:user:resourceowner:name") }}"
. The other sprig string functions helped me with the other fields as well.
2