You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The previous way to handle unregistered claims was to use these methods:
Which have both been deprecated, stating to "use a sub-type", which I assume means to define an instance of HasClaimsSet for some type I define;
However, there doesn't appear to be any way to actually provide unregistered claims for a custom type, since there's no lens for unregistered claims in HasClaimsSet to implement in the instance, and there's no way to create a ClaimsSet record otherwise since the _unregisteredClaims field of ClaimsSet isn't exported.
I suppose I could use the FromJSON instance of ClaimsSet to implement HasClaimsSet without using any deprecated methods, but that definitely seems like taking the long-way around and would involve introducing a possible failure point in the decoding step.
Perhaps was an claimUnregistered :: Lens' a (Map Text Value) accidentally omitted from HasClaimsSet when the other methods were deprecated?
Thanks!
The text was updated successfully, but these errors were encountered:
The design decision I took was that non-RFC7159 claims processed (or produced) by an application should be defined as first-class fields of subtypes. There is a simple example at the top of https://hackage.haskell.org/package/jose-0.10/docs/Crypto-JWT.html (data Super). You should not need to use instance FromJSON ClaimsSet to define instance HasClaimsSet for the subtype. You also need to define FromJSON (if verifying) and ToJSON (if producing) for the subtype.
How you get and set the additional fields (claims) in the subtype is up to you. Lenses, ordinary field accessors, whatever you prefer. But there will no longer be a Map of unrecognised/unregistered claims.
The previous way to handle unregistered claims was to use these methods:
Which have both been deprecated, stating to "use a sub-type", which I assume means to define an instance of
HasClaimsSet
for some type I define;However, there doesn't appear to be any way to actually provide unregistered claims for a custom type, since there's no lens for unregistered claims in
HasClaimsSet
to implement in the instance, and there's no way to create aClaimsSet
record otherwise since the_unregisteredClaims
field ofClaimsSet
isn't exported.I suppose I could use the
FromJSON
instance ofClaimsSet
to implementHasClaimsSet
without using any deprecated methods, but that definitely seems like taking the long-way around and would involve introducing a possible failure point in the decoding step.Perhaps was an
claimUnregistered :: Lens' a (Map Text Value)
accidentally omitted fromHasClaimsSet
when the other methods were deprecated?Thanks!
The text was updated successfully, but these errors were encountered: