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>
impl<S0, S1, D, H> OAuthClient<S0, S1, D, H, DefaultHttpClient>
Sourcepub fn new<M>(config: OAuthClientConfig<S0, S1, M, D, H>) -> Result<Self>where
M: TryIntoOAuthClientMetadata<Error = Error>,
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,
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,
Start the authorization process.
This method will return a URL that the user should be redirected to.
Sourcepub async fn callback(
&self,
params: CallbackParams,
) -> Result<(OAuthSession<T, D, H, S1>, Option<String>)>
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.
Sourcepub async fn restore(&self, sub: &Did) -> Result<OAuthSession<T, D, H, S1>>
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.
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>
impl<S0, S1, D, H, T> Sync for OAuthClient<S0, S1, D, H, T>
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> 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