jwt
jwt copied to clipboard
Add ID to Claims interface
This patch adds the jti
claim to the Claims
interface with a GetID()
method. It also implements GetID()
for both MapClaims
and RegisteredClaims
.
This makes it easier to use the registered claims (as documented in https://datatracker.ietf.org/doc/html/rfc7519#section-4.1) when you don't know whether you have an instance of RegisteredClaims
or MapClaims
to work with.
(I have a a concrete use for this where it saves me a type switch to find out what type of claims I am working with)
I realize that this is a drive-by pull request - if this change is unwanted then please discard it.
This looks like a good idea, unfortunately this is API breaking, so this is something we need to keep reserved for a future v6
, so this might be "stuck" for a while.