cduvray / jwt-authorizer

JWT authorization layer for Axum.
MIT License
68 stars 21 forks source link

Implement `serialize` for Default Token Claim structs #38

Closed lcmgh closed 10 months ago

lcmgh commented 11 months ago

Serialize is not implemented for types of the standard token claim such as OneOrArray<T> or NumericDate.

I am currently working with https://github.com/mikkyang/rust-jwt for creating some tests based on a self signed token. The lib accepts claims that implement Serialize which means I cannot reuse my custom claims created for usage within jwt-authorizer as they use fields such as NumericDate.

cduvray commented 11 months ago

Hi, you can use anything that is Clone + DeserializeOwned + Send + Sync as claims, I think you can use RegisteredClaims from rust-jwt (I did not try but it should work). However I can add serialisation support for the type NumericDate and RegisteredClaims (if you want you can add a pull request).