pub struct Client<P: Provider> { /* private fields */ }
Expand description
OpenID Connect relying party client
Implementations§
Source§impl<P: Provider> Client<P>
impl<P: Provider> Client<P>
Sourcepub fn auth_url(&self, session: &Session, prompt: Option<OidcPrompt>) -> Url
pub fn auth_url(&self, session: &Session, prompt: Option<OidcPrompt>) -> Url
Create authn URL with query parameter
If you request the user to force re-login, set prompt=Some(Login)
Sourcepub async fn authenticate<T>(
&self,
state: &str,
code: &str,
session: &Session,
) -> Result<IdToken<T>, Error>where
T: DeserializeOwned,
pub async fn authenticate<T>(
&self,
state: &str,
code: &str,
session: &Session,
) -> Result<IdToken<T>, Error>where
T: DeserializeOwned,
Authenticate user with state
, code
state
, code
are retrived from HTTP query parameters or form body.
session
is retrived from HTTP cookie.
If you need decoding extra claims in ID token, specify your own Deserialized type as T. Otherwise, set T as ()
ⓘ
let session_key = cookie_jar.get("__Host-oidc-session")?.value();
let session_value = some_database.load(session_key)?;
let session = tiny_oidc_rp::Session::load_session(session_key, session_value)?;
let id_token = oidc_client.authenticate<()>(state, code, &session)?;
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for Client<P>where
P: Freeze,
impl<P> RefUnwindSafe for Client<P>where
P: RefUnwindSafe,
impl<P> Send for Client<P>
impl<P> Sync for Client<P>
impl<P> Unpin for Client<P>where
P: Unpin,
impl<P> UnwindSafe for Client<P>where
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more