Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce types of the directly supported claims when they are set as Objects #403

Merged
merged 1 commit into from
Feb 1, 2021
Merged

Enforce types of the directly supported claims when they are set as Objects #403

merged 1 commit into from
Feb 1, 2021

Conversation

sberyozkin
Copy link
Contributor

@sberyozkin sberyozkin commented Jan 29, 2021

Fixes #391

I've been thinking for a while what exactly would be the right course of action when someone types .claim("sub", 1) and decided that instead of silently converting to String and causing some potentially difficult to diagnose problems it would be better to enforce the correct types for only those claims which are well-known (ex JWT and Mp JWT specs) but more importantly those which are directly (have the dedicated setters) supported by this API - this will also ensure the consistent handling of such claims, whether they set in a typed way or as Objects.

A few simple claims must be Strings, aud or groups - Strings or Collections of Strings, iat and exp - long or Instant.

Also improved the documentation. And added claim setters accepting Claims as a claim name

@sberyozkin sberyozkin added this to the 2.4.3 milestone Jan 29, 2021
@sberyozkin
Copy link
Contributor Author

@radcortez @MikeEdgar thanks

@sberyozkin sberyozkin merged commit c4008ae into smallrye:master Feb 1, 2021
@sberyozkin sberyozkin deleted the jwt-build-claim-conversion branch February 1, 2021 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JwtClaimsBuilder fails to enforce the correct type of directly supported claims
3 participants