pub struct CibaProvider { /* private fields */ }Expand description
In-memory CIBA provider implementing Auth Request → Token lifecycle.
Implementations§
Source§impl CibaProvider
impl CibaProvider
Sourcepub fn new(
config: CibaConfig,
token_generator: impl Fn(&str, &str, &str) -> CibaTokenResponse + Send + Sync + 'static,
) -> Self
pub fn new( config: CibaConfig, token_generator: impl Fn(&str, &str, &str) -> CibaTokenResponse + Send + Sync + 'static, ) -> Self
Create a provider with the given config and token generator.
Sourcepub async fn authenticate(
&self,
request: CibaAuthRequest,
mode: CibaMode,
) -> Result<CibaAuthResponse>
pub async fn authenticate( &self, request: CibaAuthRequest, mode: CibaMode, ) -> Result<CibaAuthResponse>
Process a backchannel authentication request.
Sourcepub async fn approve(&self, auth_req_id: &str, subject: &str) -> Result<()>
pub async fn approve(&self, auth_req_id: &str, subject: &str) -> Result<()>
Approve an authentication request (called when user consents).
Sourcepub async fn poll_token(
&self,
auth_req_id: &str,
) -> Result<CibaTokenResponse, CibaError>
pub async fn poll_token( &self, auth_req_id: &str, ) -> Result<CibaTokenResponse, CibaError>
Poll for the token (used in poll mode).
Returns Ok(CibaTokenResponse) on success,
Err with appropriate CIBA error on pending/denied/expired/slow-down.
Sourcepub async fn get_notification(
&self,
auth_req_id: &str,
) -> Result<(CibaMode, Option<String>, Option<CibaTokenResponse>)>
pub async fn get_notification( &self, auth_req_id: &str, ) -> Result<(CibaMode, Option<String>, Option<CibaTokenResponse>)>
Get the notification payload for ping/push modes.
Sourcepub async fn cleanup_expired(&self)
pub async fn cleanup_expired(&self)
Clean up expired requests.
Sourcepub async fn get_status(&self, auth_req_id: &str) -> Option<CibaRequestStatus>
pub async fn get_status(&self, auth_req_id: &str) -> Option<CibaRequestStatus>
Get the status of an auth request.
Sourcepub async fn pending_count(&self) -> usize
pub async fn pending_count(&self) -> usize
Get the total number of pending requests.
Auto Trait Implementations§
impl Freeze for CibaProvider
impl !RefUnwindSafe for CibaProvider
impl Send for CibaProvider
impl Sync for CibaProvider
impl Unpin for CibaProvider
impl UnsafeUnpin for CibaProvider
impl !UnwindSafe for CibaProvider
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more