You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Okay, so I am somewhat new to Rust so let me know if I am way off base here.
In my project, I want access to some extra details that I know are being returned in the introspection response. However, when using the rocket integration I am limited to the content of the IntrospectedUser struct:
#[derive(Debug)]pubstructIntrospectedUser{/// UserID of the introspected user (OIDC Field "sub").pubuser_id:String,pubusername:Option<String>,pubname:Option<String>,pubgiven_name:Option<String>,pubfamily_name:Option<String>,pubpreferred_username:Option<String>,pubemail:Option<String>,pubemail_verified:Option<bool>,publocale:Option<String>,pubproject_roles:Option<HashMap<String,HashMap<String,String>>>,pubmetadata:Option<HashMap<String,String>>,}
This is likely fine for most people, but I want access to the rest of the details in the ZitadelIntrospectionResponse struct. Now one could just extend the struct in the library:
#[derive(Debug)]pubstructIntrospectedUser{/// UserID of the introspected user (OIDC Field "sub").pubuser_id:String,pubusername:Option<String>,pubname:Option<String>,pubgiven_name:Option<String>,pubfamily_name:Option<String>,pubpreferred_username:Option<String>,pubemail:Option<String>,pubemail_verified:Option<bool>,publocale:Option<String>,pubproject_roles:Option<HashMap<String,HashMap<String,String>>>,pubmetadata:Option<HashMap<String,String>>,pubresponse:ZitadelIntrospectionResponse}implFrom<ZitadelIntrospectionResponse>forIntrospectedUser{fnfrom(response:ZitadelIntrospectionResponse) -> Self{Self{user_id: response.sub().unwrap().to_string(),username: response.username().map(|s| s.to_string()),name: response.extra_fields().name.clone(),given_name: response.extra_fields().given_name.clone(),family_name: response.extra_fields().family_name.clone(),preferred_username: response.extra_fields().preferred_username.clone(),email: response.extra_fields().email.clone(),email_verified: response.extra_fields().email_verified,locale: response.extra_fields().locale.clone(),project_roles: response.extra_fields().project_roles.clone(),metadata: response.extra_fields().metadata.clone(),response: response.clone()}}}
Or we could just change the scoping of the zitadel::rocket::introspection::config struct attributes to be public (without the crate scope limitation):
I am not sure what approach the community here thinks is best and is ultimately more supportable. Also if I missed an easier way to get the extra details then please let me know :-)
The extra details I am looking for are part of the ZitadelIntrospectionExtraTokenFields struct and having the following URNs urn:zitadel:iam:user:resourceowner:id urn:zitadel:iam:user:resourceowner:name urn:zitadel:iam:user:resourceowner:primary_domain.
The text was updated successfully, but these errors were encountered:
Okay, so I am somewhat new to Rust so let me know if I am way off base here.
In my project, I want access to some extra details that I know are being returned in the introspection response. However, when using the rocket integration I am limited to the content of the
IntrospectedUser
struct:This is likely fine for most people, but I want access to the rest of the details in the
ZitadelIntrospectionResponse
struct. Now one could just extend the struct in the library:Or we could just change the scoping of the
zitadel::rocket::introspection::config
struct attributes to be public (without the crate scope limitation):This small change allows me to just write my own implementation which also functions just fine:
I am not sure what approach the community here thinks is best and is ultimately more supportable. Also if I missed an easier way to get the extra details then please let me know :-)
The extra details I am looking for are part of the
ZitadelIntrospectionExtraTokenFields
struct and having the following URNsurn:zitadel:iam:user:resourceowner:id urn:zitadel:iam:user:resourceowner:name urn:zitadel:iam:user:resourceowner:primary_domain
.The text was updated successfully, but these errors were encountered: