ramosbugs / openidconnect-rs

OpenID Connect Library for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to request non-standard claims for id_token

jgiacomoni opened this issue · comments

We are using pure implicit flow (id_token only) to request non-standard claims with standard and non-standard scope values.

EDIT scopes won't work for us as we need to be able to specify various attributes/value for each requested claim.

per https://openid.net/specs/openid-connect-core-1_0.html#Claims

we should be able to specify something like this in the authorization query params

{
"id_token":
{
"field_x": {
"essential": true,
"value" : "y",
"condition" : "z", // non-standard
},
}

If this isn't supported, are there plans to do so? or should I assume I need to manually append these claims to the authorization_url?

thanks!

Hey @jgiacomoni,

This can currently be done using AuthorizationRequest::add_extra_param, where claims is the name and the serialized JSON is the value. The value will be URL-encoded automatically, so just pass in the plain JSON.

I'd be open to a PR (after some discussion about the API) for adding a higher-level interface for setting this parameter but don't plan to implement that myself in the near future.

@ramosbugs thanks! I'll take a look. I'm currently in prototyping mode so I'll probably just follow your suggestion until I need something more robust.