The should fix #7 and furthurmore provides ability to define custom jwt scopes/fields.
The previous version hard coded first_name, last_name, email and etc into KeycloakToken. But these tokens can actually be turned off, especially when configured with external identity services.
This PR add a generic parameter named Extra and passes it all the way through into KeycloakToken. Also, ProfileAndEmail is provided as the default Extra generic type, to meet the needs of most keycloak user that sticks with default usage (username/email/password authentication and never border to turned off profile or email scope).
I bump the version in Cargo.toml to 0.5.0, since this commit introduces some breaking API changes. There is no more token.full_name but token.extra.profile.preferred_username when Extra is set to ProfileAndEmail, which is the default generic type.
Here is an example to define and use custom jwt extra scopes:
The should fix #7 and furthurmore provides ability to define custom jwt scopes/fields.
The previous version hard coded first_name, last_name, email and etc into
KeycloakToken
. But these tokens can actually be turned off, especially when configured with external identity services.This PR add a generic parameter named
Extra
and passes it all the way through into KeycloakToken. Also,ProfileAndEmail
is provided as the defaultExtra
generic type, to meet the needs of most keycloak user that sticks with default usage (username/email/password authentication and never border to turned off profile or email scope).I bump the version in Cargo.toml to 0.5.0, since this commit introduces some breaking API changes. There is no more
token.full_name
buttoken.extra.profile.preferred_username
whenExtra
is set toProfileAndEmail
, which is the default generic type.Here is an example to define and use custom jwt extra scopes: