Open BenjamenMeyer opened 4 months ago
I created my own jsonClaims
type that JSON encodes all the fields based on mockoidc's
mockClaims
type which adds the additional field which is what is used by my implementation of Claims()
.
PR #54 has some example code that exemplifies the behavior in a similar pattern to how I was doing it in my other code. The PR creates a custom user with a new attribute (PhoneVerified
) and then adds a test to the session to get a token with the custom user type and checks for the attribute being in the claims as one would expect. The new test presently fails.
I stumbled over the same, would be nice to have easier way adding new claims.
Services often need to add their own claims to tokens to manage what users are allowed to do in a system. OIDC providers like Okta, Auth0, and others allow their users to add claims via configuration and integrations to support this. How can this be done with
mockoidc
? One can decode the access token to get the claims.I tried building a custom user object:
with the
Claims()
method adding the additional data to thejwt.Claims
, but I still only get the original data - nothing in the way of the custom claims I added.What am I missing?