slowli/jwt-compact

Extracting arbitrary key from jwt header

kishansairam9 opened this issue · 1 comments

JWT RFC defines the header to be either of JWS or JWE - reference

If we look at RFC for JOSE header in JWS https://www.rfc-editor.org/rfc/rfc7515 - section 4.2, 4.3 it allows aribtrary keys to be defined in jwt header part of payload as long as consumers and producers ensure no collisions in keyspace.

Don't think it is possible with current Header implementation. It has common fields defined via Serde, but think aribtrary ones will be ignored. Can we add custom option like we do in case of Claims?

/// Custom claims.
#[serde(flatten)]
pub custom: T,

Hi! This functionality looks reasonable; it wasn't implemented previously because there was no particular use case for custom header fields.