Struct OAuthClient

Source
pub struct OAuthClient<S0, S1, D, H, T = DefaultHttpClient>
where T: HttpClient + Send + Sync + 'static, S1: SessionStore + Send + Sync + 'static, S1::Error: Error + Send + Sync + 'static,
{ pub client_metadata: OAuthClientMetadata, /* private fields */ }
Expand description

An OAuth client for AT Protocol.

This client is used to process OAuth flows with AT Protocol.

Fields§

§client_metadata: OAuthClientMetadata

Implementations§

Source§

impl<S0, S1, D, H> OAuthClient<S0, S1, D, H, DefaultHttpClient>
where S1: SessionStore + Send + Sync + 'static, S1::Error: Error + Send + Sync + 'static,

Source

pub fn new<M>(config: OAuthClientConfig<S0, S1, M, D, H>) -> Result<Self>
where M: TryIntoOAuthClientMetadata<Error = Error>,

Create a new OAuth client.

Source§

impl<S0, S1, D, H, T> OAuthClient<S0, S1, D, H, T>
where S0: StateStore + Send + Sync + 'static, S1: SessionStore + Send + Sync + 'static, D: Resolver<Input = Did, Output = DidDocument, Error = Error> + Send + Sync, H: Resolver<Input = Handle, Output = Did, Error = Error> + Send + Sync, T: HttpClient + Send + Sync + 'static, S0::Error: Error + Send + Sync + 'static, S1::Error: Error + Send + Sync + 'static,

Source

pub fn jwks(&self) -> JwkSet

Get the jwks of the client.

Source

pub async fn authorize( &self, input: impl AsRef<str>, options: AuthorizeOptions, ) -> Result<String>

Start the authorization process.

This method will return a URL that the user should be redirected to.

Source

pub async fn callback( &self, params: CallbackParams, ) -> Result<(OAuthSession<T, D, H, S1>, Option<String>)>

Handle the callback from the authorization server.

This method will exchange the authorization code for an access token and store the session, and return the OAuthSession and the application state.

Source

pub async fn restore(&self, sub: &Did) -> Result<OAuthSession<T, D, H, S1>>

Load a stored session by giving the subject DID.

This method will return the OAuthSession if it exists.

Source

pub async fn revoke(&self, sub: &Did) -> Result<()>

Revoke a session by giving the subject DID.

Auto Trait Implementations§

§

impl<S0, S1, D, H, T> Freeze for OAuthClient<S0, S1, D, H, T>
where S0: Freeze,

§

impl<S0, S1, D, H, T = DefaultHttpClient> !RefUnwindSafe for OAuthClient<S0, S1, D, H, T>

§

impl<S0, S1, D, H, T> Send for OAuthClient<S0, S1, D, H, T>
where S0: Send, D: Sync + Send, H: Sync + Send,

§

impl<S0, S1, D, H, T> Sync for OAuthClient<S0, S1, D, H, T>
where S0: Sync, D: Sync + Send, H: Sync + Send,

§

impl<S0, S1, D, H, T> Unpin for OAuthClient<S0, S1, D, H, T>
where S0: Unpin,

§

impl<S0, S1, D, H, T = DefaultHttpClient> !UnwindSafe for OAuthClient<S0, S1, D, H, T>

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, C> Cacheable<C> for T

Source§

fn cached(self, cache: C) -> Cached<T, C>

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<P, T> Throttleable<P> for T
where P: Default,

Source§

fn throttled(self) -> Throttled<T, P>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ErasedDestructor for T
where T: 'static,