OauthHandlerTrait

Trait OauthHandlerTrait 

Source
pub trait OauthHandlerTrait: Send + Sync {
    // Required methods
    fn handle_oauth(
        &self,
        client: Client,
        body: OauthV2AccessResponse,
    ) -> impl Future<Output = Result<Option<OauthRedirectResponse>, ResponseError>> + Send;
    fn take_oauth_token_from_team_id(
        &self,
        team_id: &str,
    ) -> impl Future<Output = Result<String, ResponseError>> + Send;
    fn redirect_uri(&self) -> &str;

    // Provided methods
    fn grant_type(&self) -> &str { ... }
    fn oauth_v2_access_request_form<'a>(
        &'a self,
        slack: &'a Slack,
        code: &'a str,
    ) -> OauthV2AccessRequest<'a> { ... }
    fn treat_oauth_redirect<'a>(
        &'a self,
        client: Client,
        slack: &'a Slack,
        code: &'a str,
    ) -> impl Future<Output = Result<OauthV2AccessResponse, ResponseError>> + Send + 'a { ... }
}
Expand description

The trait representing the interface that treats about OAuth.

Required Methods§

Source

fn handle_oauth( &self, client: Client, body: OauthV2AccessResponse, ) -> impl Future<Output = Result<Option<OauthRedirectResponse>, ResponseError>> + Send

Handles OauthV2AccessResponse.

If this handler returns None, the framework will return default value.

Source

fn take_oauth_token_from_team_id( &self, team_id: &str, ) -> impl Future<Output = Result<String, ResponseError>> + Send

Returns OAuth access_token from team_id (An ID of Workspace).

Source

fn redirect_uri(&self) -> &str

Provided Methods§

Source

fn grant_type(&self) -> &str

Source

fn oauth_v2_access_request_form<'a>( &'a self, slack: &'a Slack, code: &'a str, ) -> OauthV2AccessRequest<'a>

Creates and returns OauthV2AccessRequest.

Source

fn treat_oauth_redirect<'a>( &'a self, client: Client, slack: &'a Slack, code: &'a str, ) -> impl Future<Output = Result<OauthV2AccessResponse, ResponseError>> + Send + 'a

Treats redirect request.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§