pub struct RelyingParty { /* private fields */ }Expand description
A relying party: one issuer, one client, one key set.
Implementations§
Source§impl RelyingParty
impl RelyingParty
pub fn new( config: Config, clock: Arc<dyn Clock>, http: Arc<dyn Outbound>, ) -> RelyingParty
pub fn config(&self) -> &Config
pub fn key_count(&self) -> usize
Sourcepub fn refresh(&self) -> Result<(), String>
pub fn refresh(&self) -> Result<(), String>
Fetch the discovery document and the key set.
Called once at startup — a process that cannot reach its identity provider should say so
then rather than when the first person tries to log in — and then on
REFRESH_EVERY_MS, and then whenever a token names an unknown key.
Sourcepub fn refresh_due(&self) -> bool
pub fn refresh_due(&self) -> bool
Whether RelyingParty::refresh is due — the interval has passed, or a token named a key
the set does not carry and the floor between fetches has passed.
Sourcepub fn verify_id_token(
&self,
token: &str,
nonce: Option<&str>,
) -> Result<Verified, Refusal>
pub fn verify_id_token( &self, token: &str, nonce: Option<&str>, ) -> Result<Verified, Refusal>
Verify an ID token and say who it is about.
nonce is Some exactly once in a token’s life — at the callback, where the relying party
still remembers what it asked for. On every later connection there is nothing to compare
against, and pretending otherwise would be a check that always passes.
Sourcepub fn begin_login(&self, return_to: &str) -> Result<Login, String>
pub fn begin_login(&self, return_to: &str) -> Result<Login, String>
Where to send a browser that wants to log in, and the cookie that remembers what we asked.
return_to is a path, checked to be one: a redirect target a client supplies is an open
redirect if it can name a host.
Sourcepub fn complete_login(
&self,
query: &str,
transaction: &str,
) -> Result<Completion, String>
pub fn complete_login( &self, query: &str, transaction: &str, ) -> Result<Completion, String>
The browser is back. Check what it brought, swap the code for a token, and verify it.
The result is the ID token itself: it is what the session cookie carries, so that every later connection re-verifies the issuer’s signature rather than one this process made up.
Trait Implementations§
Source§impl Debug for RelyingParty
impl Debug for RelyingParty
Source§impl Identity for RelyingParty
impl Identity for RelyingParty
Source§fn verify(&self, claim: &str) -> Result<Actor, Rejected>
fn verify(&self, claim: &str) -> Result<Actor, Rejected>
The claim is the ID token, from the session cookie or from the hello frame.
There is no nonce here — see RelyingParty::verify_id_token. Everything else is checked
on every connection rather than once at login, which is what makes the session’s
lifetime the issuer’s decision.