#[non_exhaustive]pub struct Confirmation {
pub jkt: Option<String>,
pub x5t_s256: Option<CertificateThumbprint>,
}dpop or mtls only.Expand description
The RFC 7800 section 3.1 confirmation claim: HOW a token is sender constrained, meaning what a presenter has to prove in addition to holding the string.
This is what a resource server checks the binding against, and it is the whole reason sender constraining is worth anything at introspection time: without it the binding is known only to the authorization server, and an RS that introspects is back to trusting a bearer string.
EVERY MEMBER IS OPTIONAL, and that is the design rather than an accident. RFC 7800 section
3.1 defines cnf as a JSON OBJECT whose members are confirmation methods, and different
sender-constraining mechanisms register different members OF THE SAME OBJECT: RFC 9449
section 6.1 registers jkt for a DPoP key binding, RFC 8705 section 3.1 registers
x5t#S256 for a certificate binding. A token can legitimately carry both, so neither may
be modelled as “the” confirmation and neither may overwrite the other. Adding a mechanism
means adding an optional member here; it never means replacing this type.
DESERIALIZED THROUGH ConfirmationWire, for the reason IntrospectionResponse is
deserialized through IntrospectionWire, and the member set above is why it has to be
separate from that one. cnf is an OBJECT of confirmation methods and each feature registers
its own, so a build with dpop and not mtls carries the OUTER member and not the inner one:
the guard on IntrospectionWire::cnf passes (the member IS present), the interior deserializes
to a Confirmation with nothing in it, and Confirmation::is_empty answers true. That is
the certificate-bound-token-read-as-a-bearer-token case in full, arrived at through the guard
meant to stop it. The interior needs the same treatment as the exterior, and this is it.
#[non_exhaustive]: the paragraph above says adding a sender-constraining mechanism means
adding an optional member here, and dpop and mtls each add one INDEPENDENTLY, so there are
four different field sets this type has depending on which pair of flags is on. The attribute is
what makes that promise cost a host nothing: build with Confirmation::default() (every member
is optional by construction) and set the members the mechanism you use registers.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.jkt: Option<String>dpop only.RFC 9449 section 6.1 jkt: the RFC 7638 SHA-256 thumbprint of the client’s proof
key, base64url without padding.
x5t_s256: Option<CertificateThumbprint>mtls only.RFC 8705 section 3.1 x5t#S256: the SHA-256 thumbprint of the DER encoding of the
X.509 certificate the client presented when the token was issued. A resource server
checks it with Confirmation::confirms_certificate.
Implementations§
Source§impl Confirmation
impl Confirmation
Sourcepub fn confirms_certificate(&self, der: &[u8]) -> bool
Available on crate feature mtls only.
pub fn confirms_certificate(&self, der: &[u8]) -> bool
mtls only.RESOURCE SERVER side of RFC 8705 section 3: whether the certificate on the connection the token was presented over is the one the token is bound to.
A resource server that has introspected a token (section 3.2 — a channel this server opens
to registered resource servers since 0.9.2; see crate::ServerConfig::resource_servers)
or verified a JWT (section
3.1) calls this with the DER of the client certificate ITS OWN TLS layer verified. The two
halves are equally load bearing, and this method can only do the second one: a certificate
the resource server did not verify proves nothing, exactly as set out in this module’s docs.
Answers false for a token that carries no certificate binding at all. That is the safe
direction and the only one this method can take: a resource server calling it is asking “is
this token bound to my caller”, and an unbound token is not. A resource server that ACCEPTS
unbound tokens (a mixed deployment, mid-migration) must ask that question separately, with
Confirmation::certificate_thumbprint, rather than reading a false here as permission.
Sourcepub fn certificate_thumbprint(&self) -> Option<&CertificateThumbprint>
Available on crate feature mtls only.
pub fn certificate_thumbprint(&self) -> Option<&CertificateThumbprint>
mtls only.The RFC 8705 section 3.1 x5t#S256 this token is bound to, or None for an unbound token.
Sourcepub fn for_certificate(certificate: &ClientCertificate<'_>) -> Self
Available on crate feature mtls only.
pub fn for_certificate(certificate: &ClientCertificate<'_>) -> Self
mtls only.The confirmation an access token issued over certificate carries (RFC 8705 section 3.1).
The RFC 9449 jkt member, when that feature is also compiled in, is left absent rather
than overwritten: a token can be bound by both mechanisms at once and neither owns the
object. See Confirmation.
Trait Implementations§
Source§impl Clone for Confirmation
impl Clone for Confirmation
Source§fn clone(&self) -> Confirmation
fn clone(&self) -> Confirmation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more