pub trait ConsentStore: Send + Sync {
// Required methods
fn mint(&self, pending: PendingConsent) -> ConsentReference;
fn consume(&self, reference: &ConsentReference) -> Option<PendingConsent>;
fn discard(&self, reference: &ConsentReference);
fn revoke_client(&self, client_id: &str, did: Option<&str>) -> usize;
}Expand description
Where pending consent decisions live between authorize minting a
reference and a stamped call confirming it.
Required Methods§
Sourcefn mint(&self, pending: PendingConsent) -> ConsentReference
fn mint(&self, pending: PendingConsent) -> ConsentReference
Mints and stores a fresh reference for pending.
Sourcefn consume(&self, reference: &ConsentReference) -> Option<PendingConsent>
fn consume(&self, reference: &ConsentReference) -> Option<PendingConsent>
Marks the reference consumed and returns what it was pending, if it
was live. Consuming happens whether confirm goes on to approve or
refuse: a reference is single-use either way, so a caller cannot
retry a refused reference hoping for a different stamped identity.
Sourcefn discard(&self, reference: &ConsentReference)
fn discard(&self, reference: &ConsentReference)
Removes a reference ConsentStore::mint minted moments earlier,
because the decision record it was for was not, after all, stored.
oauth::par::push_authorization_request calls this on both of its
undo branches: crate::oauth::consent::begin runs before
DecisionStore::put — a token has to name the record it approves,
so it cannot be minted after — and a bound that refuses the record
must not leave the reference begin already minted for it
behind. Unlike ConsentStore::consume, this does not require the
reference still be live: nothing will ever present a reference for
a push that was undone, live or not, so there is nothing to check.
Sourcefn revoke_client(&self, client_id: &str, did: Option<&str>) -> usize
fn revoke_client(&self, client_id: &str, did: Option<&str>) -> usize
Drops every reference this store holds for client_id, or for
client_id on did alone. Answers how many went.
An operator ending an app’s logins ends what is in flight too: a reference left here is one stamped call short of an authorization code, which is one exchange short of a token.