jwt icon indicating copy to clipboard operation
jwt copied to clipboard

Add ID to Claims interface

Open st3fan opened this issue 1 year ago • 1 comments

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.

st3fan avatar Oct 09 '23 17:10 st3fan

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.

oxisto avatar Oct 09 '23 17:10 oxisto