RelyingParty

Struct RelyingParty 

Source
pub struct RelyingParty { /* private fields */ }
Expand description

A relying party: one issuer, one client, one key set.

Implementations§

Source§

impl RelyingParty

Source

pub fn new( config: Config, clock: Arc<dyn Clock>, http: Arc<dyn Outbound>, ) -> RelyingParty

Source

pub fn config(&self) -> &Config

Source

pub fn provider(&self) -> Option<Provider>

The endpoints, once discovery has run.

Source

pub fn key_count(&self) -> usize

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Identity for RelyingParty

Source§

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.

Source§

fn kind(&self) -> &'static str

What this provider is, for the dashboard and for the startup line. An operator who cannot tell from the logs whether authentication is on does not have authentication.
Source§

fn login(&self) -> Option<&RelyingParty>

The browser-facing half, for a provider that can run a login flow. Read more
Source§

fn verifies(&self) -> bool

Whether this provider verifies anything at all. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more