1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//! JWT Header Accessor Traits based on RFC 7515 Defined Header Fields
use crateAlgorithm;
/// `alg` (Algorithm) Header Parameter
///
/// Ref: [RFC 7515 4.1.1](<https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.1>)
/// `jku` (JWK Set URL) Header Parameter
///
/// Ref: [RFC 7515 4.1.2](<https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.2>)
///
/// WARNING: only use this if you understand the inherent risks and mitigations, like
/// matching any JWT-provided URL against an allowlist of trusted locations. Fetching
/// keys from an arbitrary `jku` URL lets the token supply its own verification key and
/// can result in server-side request forgery (SSRF).
/// See [RFC 8725 3.10](<https://datatracker.ietf.org/doc/html/rfc8725#section-3.10>).
/// `jwk` (JSON Web Key) Header Parameter
///
/// Ref: [RFC 7515 4.1.3](<https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.3>)
///
/// WARNING: only use this if you understand the inherent risks and mitigations, like
/// validating any JWT-provided JWKs against a trusted root.
/// `kid` (Key ID) Header Parameter
///
/// Ref: [RFC 7515 4.1.4](<https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.4>)
/// `x5u` (X.509 URL) Header Parameter
///
/// Ref: [RFC 7515 4.1.5](<https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.5>)
///
/// WARNING: only use this if you understand the inherent risks and mitigations
/// `x5c` (X.509 Certificate Chain) Header Parameter
///
/// Ref: [RFC 7515 4.1.6](<https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.6>)
///
/// WARNING: only use this if you understand the inherent risks and mitigations
/// `x5t` (X.509 Certificate SHA-1 Thumbprint) Header Parameter
///
/// Ref: [RFC 7515 4.1.7](<https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.7>)
/// `x5t#S256` (X.509 Certificate SHA-256 Thumbprint) Header Parameter
///
/// Ref: [RFC 7515 4.1.8](<https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.8>)
/// `typ` (Type) Header Parameter
///
/// Ref: [RFC 7515 4.1.9](<https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.9>)
/// `cty` (Content Type) Header Parameter
///
/// Ref: [RFC 7515 4.1.10](<https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.10>)
/// `crit` (Critical) Header Parameter
///
/// Ref: [RFC 7515 4.1.11](<https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.11>)
///
/// A JWS MUST be rejected if `crit` lists any header parameter the recipient does not
/// understand and process. [`oxitoken`](crate) does not enforce this: [`serde`] ignores
/// unknown fields by default, so a header struct without a `crit` field will silently
/// accept tokens that use it. To enforce it, implement [`Crit`] and add a
/// [`TokenValidator`](crate::validation::TokenValidator) that rejects unsupported
/// entries, or use `#[serde(deny_unknown_fields)]` to reject any header field the
/// struct does not define.