Make typ an Option in Header

This commit is contained in:
Vincent Prouillet 2017-08-25 17:51:44 +09:00
parent d213fb8a62
commit 983380d1ab
2 changed files with 3 additions and 2 deletions

View File

@ -4,6 +4,7 @@
### Breaking change
- Remove `validate_signature` from `Validation`
- Make `typ` optional in header, some providers apparently don't use it
### Other
- Add `decode_header` to only decode the header: replaces the use case of `validate_signature`

View File

@ -8,7 +8,7 @@ pub struct Header {
/// The type of JWS: it can only be "JWT" here
///
/// Defined in [RFC7515#4.1.9](https://tools.ietf.org/html/rfc7515#section-4.1.9).
typ: String,
typ: Option<String>,
/// The algorithm used
///
/// Defined in [RFC7515#4.1.1](https://tools.ietf.org/html/rfc7515#section-4.1.1).
@ -44,7 +44,7 @@ impl Header {
/// Returns a JWT header with the algorithm given
pub fn new(algorithm: Algorithm) -> Header {
Header {
typ: "JWT".to_string(),
typ: Some("JWT".to_string()),
alg: algorithm,
cty: None,
jku: None,