pub struct AuthorizedCode { /* private fields */ }Expand description
A validated callback, ready to redeem.
Holds the code and everything needed to complete the token request, all of it recorded before the user left the client.
Deliberately not Clone. RFC 6749 §4.1.2 makes an authorization code
single-use, and the way this crate holds that line is that redeeming
consumes the value: redeem takes it by value, so
one value cannot be spent twice. That is the scope of the guarantee, and it
is worth being exact about what it does not cover: a caller that invokes
authorize_callback twice against the same PendingAuthorization
still holds two values, and may try both. What stops the second is the
authorization server, which §4.1.2 requires to deny a reused code. The type
closes the accidental double-spend — a retry after a dropped connection,
where the first attempt may already have been honoured — and the server
closes the deliberate one.
Implementations§
Source§impl AuthorizedCode
impl AuthorizedCode
Sourcepub const fn code_verifier(&self) -> &CodeVerifier
pub const fn code_verifier(&self) -> &CodeVerifier
The PKCE verifier to send alongside it.
Sourcepub const fn resource(&self) -> &ResourceBinding
pub const fn resource(&self) -> &ResourceBinding
What the grant is bound to — the resource the token request must repeat.
Sourcepub fn redirect_uri(&self) -> &str
pub fn redirect_uri(&self) -> &str
The redirect URI the authorization request named, which RFC 6749 §4.1.3 requires a client to repeat if it included one.