Trait telescope::web::services::auth::IdentityProvider[][src]

pub trait IdentityProvider: 'static {
    type LoginResponse: Responder;
    type RegistrationResponse: Responder;
    type LinkResponse: Responder;
    type LoginFut: Future<Output = Self::LoginResponse> + 'static;
    type RegistrationFut: Future<Output = Self::RegistrationResponse> + 'static;
    type LinkFut: Future<Output = Self::LinkResponse> + 'static;
    type LoginAuthenticatedFut: Future<Output = Result<HttpResponse, TelescopeError>> + 'static;
    type RegistrationAuthenticatedFut: Future<Output = Result<HttpResponse, TelescopeError>> + 'static;
    type LinkAuthenticatedFut: Future<Output = Result<HttpResponse, TelescopeError>> + 'static;

    const SERVICE_NAME: &'static str;
    const USER_ACCOUNT_TY: UserAccountType;
Show 15 methods fn login_handler(req: HttpRequest) -> Self::LoginFut;
fn registration_handler(req: HttpRequest) -> Self::RegistrationFut;
fn link_handler(req: HttpRequest, ident: Identity) -> Self::LinkFut;
fn login_authenticated_handler(
        req: HttpRequest
    ) -> Self::LoginAuthenticatedFut;
fn registration_authenticated_handler(
        req: HttpRequest
    ) -> Self::RegistrationAuthenticatedFut;
fn linking_authenticated_handler(
        req: HttpRequest,
        ident: Identity
    ) -> Self::LinkAuthenticatedFut; fn login_path() -> String { ... }
fn register_path() -> String { ... }
fn link_path() -> String { ... }
fn unlink_path() -> String { ... }
fn login_redirect_path() -> String { ... }
fn registration_redirect_path() -> String { ... }
fn link_redirect_path() -> String { ... }
fn register_services(config: &mut ServiceConfig) { ... }
fn unlink_handler(
        id: Identity,
        cookie: AuthenticationCookie
    ) -> LocalBoxFuture<'static, Result<HttpResponse, TelescopeError>> { ... }
}
Expand description

Trait for identity providers (GitHub OAuth2, Discord OAuth2, RPI CAS, etc).

Associated Types

The type used to respond to login requests.

The type used to respond to registration requests.

The type used to respond to account linking requests.

The type of future returned by the login handler.

The type of the future returned by the registration handler.

The type of the future returned by the account linking handler.

The type of future returned by the login authenticated response handler.

The type of future returned by the registration authenticated response handler.

The type of future returned by the registration authenticated response handler.

Associated Constants

The lowercase, one word name of the service. This is used in generating redirect paths and registering the service with actix. It must be unique.

The type of user account represented by this authentication service.

Required methods

Actix-web handler for the route that redirects to authentication for login. Guarded by this trait to GET requests.

Actix-web handler for the route that redirects to authentication for account creation (user registration). Guarded by this trait to GET requests.

Actix-web handler for the route that redirects to the authentication provider to link an account.

Linking an account will authenticate with the identity provider and then insert the account into the RCOS database via the API. If there is already an account linked, then the account’s platform ID will be checked against the ID of the linked account. If it matches then the auth cookie is modified, and we return a successful response. If it does not match, we forget the new account and tell the user to unlink their existing account on this platform first.

Actix-web handler for authentication callback to login. Guarded by this trait to GET requests.

Actix-web handler for authentication callback to account creation. Guarded by this trait to GET requests.

Actix-web handler

Provided methods

Get the login path of this service. This is the route in actix that will redirect to the authorization page using the handler function also defined in this trait.

Get the registration path of this service. This is the route in actix that will redirect to the authorization page using the handler also defined by this trait. This is similar to Self::login_path but is for account registration rather than sign in.

The path to link this identity service. This is similar to the other two, but is intended to be used to link an existing account.

The path to unlink this service from the user’s account.

The path for the identity provider to redirect back to after authenticating a user for login. This path is also registered under actix with the authentication callback handler defined by this trait.

The path for the identity provider to redirect back to after authenticating a user for account creation. This path is also registered under actix with the authentication callback handler defined by this trait.

The path to redirect back to after account linking success. This is similar to the login and registration authenticated redirect paths.

Register the necessary actix services to support this identity provider.

Actix-web handler for the route that unlinks an identity service.

Implementors