smartive / zitadel-rust

An implementation of the ZITADEL gRPC API in Rust. Complemented with other useful elements such as ServiceAccount auth.
https://docs.rs/zitadel/latest/zitadel/
Other
46 stars 17 forks source link

Add project_roles for IntrospectedUser for rocket and actix #568

Closed FrTerstappen closed 2 months ago

FrTerstappen commented 2 months ago

Hello,

currently the struct IntrospectedUser is defined three times. Once for each of the frameworks actix, axum and rocket. Only the version used by axum has a field for the project_roles.

I am currently using a locally patched version of this library with rocket where I added the field (and its assignment) to the struct. This is working without problem.

I propose adding this directly to the library for rocket and actix so that the features for the three frameworks are the same. I see two possibilities to achieve this. One is to add the fields to the two other definitions of IntrospectedUser and the other is moving the IntrospectedUser struct to a central place and only having one. They currently seem to only differ by this filed and their description comment.

I am happy to provide a pull request for either of those to options if this is a change you are interested in.

NewtTheWolf commented 2 months ago

Hey @FrTerstappen,

That sounds pretty good!

However, I think that if the only major difference is the field, it would be better to create one global IntrospectedUser to avoid code duplication, in my opinion.