Allow to set a custom 'header content type' in the cty
field
#82
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
rfc7519 specifies only one valid value for the
cty
field in the header: "JWT", meaning the payload itself is another complete JWT.This change supports setting
cty
to something else (any string) by constructing the header withSome(HeaderContentType::Custom("..."))
.This should solve #67. The implementation here comes with a few (minor?) problems:
Copy
, since it now contains a String. I was not able to prevent this without changing the public interface. As far as I can see this only means we have to do a clone operation whenever a HCT::Custom is copied (i.e.JoseHeader::content_type
). CloningHeaderContentType::JsonWebToken
should - in my understanding - still by a copy.serde::Deserialize
andserde::Serialize
implementations, since I was not able to find a way to make serde flatten the the Custom enum variant in any other way.... so one could argue, every change this PR introduces is a problem?
But maybe it solves a real use case for an acceptable cost?