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
type LoginResponse: Responder
type LoginResponse: Responder
The type used to respond to login requests.
The type used to respond to registration requests.
type LinkResponse: Responder
type LinkResponse: Responder
The type used to respond to account linking requests.
type LoginFut: Future<Output = Self::LoginResponse> + 'static
type LoginFut: Future<Output = Self::LoginResponse> + 'static
The type of future returned by the login handler.
type RegistrationFut: Future<Output = Self::RegistrationResponse> + 'static
type RegistrationFut: Future<Output = Self::RegistrationResponse> + 'static
The type of the future returned by the registration handler.
type LinkFut: Future<Output = Self::LinkResponse> + 'static
type LinkFut: Future<Output = Self::LinkResponse> + 'static
The type of the future returned by the account linking handler.
type LoginAuthenticatedFut: Future<Output = Result<HttpResponse, TelescopeError>> + 'static
type LoginAuthenticatedFut: Future<Output = Result<HttpResponse, TelescopeError>> + 'static
The type of future returned by the login authenticated response handler.
type RegistrationAuthenticatedFut: Future<Output = Result<HttpResponse, TelescopeError>> + 'static
type RegistrationAuthenticatedFut: Future<Output = Result<HttpResponse, TelescopeError>> + 'static
The type of future returned by the registration authenticated response handler.
type LinkAuthenticatedFut: Future<Output = Result<HttpResponse, TelescopeError>> + 'static
type LinkAuthenticatedFut: Future<Output = Result<HttpResponse, TelescopeError>> + 'static
The type of future returned by the registration authenticated response handler.
Associated Constants
const SERVICE_NAME: &'static str
const SERVICE_NAME: &'static str
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
fn login_handler(req: HttpRequest) -> Self::LoginFut
fn login_handler(req: HttpRequest) -> Self::LoginFut
Actix-web handler for the route that redirects to authentication for login. Guarded by this trait to GET requests.
fn registration_handler(req: HttpRequest) -> Self::RegistrationFut
fn registration_handler(req: HttpRequest) -> Self::RegistrationFut
Actix-web handler for the route that redirects to authentication for account creation (user registration). Guarded by this trait to GET requests.
fn link_handler(req: HttpRequest, ident: Identity) -> Self::LinkFut
fn link_handler(req: HttpRequest, ident: Identity) -> Self::LinkFut
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.
fn login_authenticated_handler(req: HttpRequest) -> Self::LoginAuthenticatedFut
fn login_authenticated_handler(req: HttpRequest) -> Self::LoginAuthenticatedFut
Actix-web handler for authentication callback to login. Guarded by this trait to GET requests.
fn registration_authenticated_handler(
req: HttpRequest
) -> Self::RegistrationAuthenticatedFut
fn registration_authenticated_handler(
req: HttpRequest
) -> Self::RegistrationAuthenticatedFut
Actix-web handler for authentication callback to account creation. Guarded by this trait to GET requests.
fn linking_authenticated_handler(
req: HttpRequest,
ident: Identity
) -> Self::LinkAuthenticatedFut
fn linking_authenticated_handler(
req: HttpRequest,
ident: Identity
) -> Self::LinkAuthenticatedFut
Actix-web handler
Provided methods
fn login_path() -> String
fn login_path() -> String
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.
fn register_path() -> String
fn register_path() -> String
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.
fn unlink_path() -> String
fn unlink_path() -> String
The path to unlink this service from the user’s account.
fn login_redirect_path() -> String
fn login_redirect_path() -> String
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.
fn link_redirect_path() -> String
fn link_redirect_path() -> String
The path to redirect back to after account linking success. This is similar to the login and registration authenticated redirect paths.
fn register_services(config: &mut ServiceConfig)
fn register_services(config: &mut ServiceConfig)
Register the necessary actix services to support this identity provider.
fn unlink_handler(
id: Identity,
cookie: AuthenticationCookie
) -> LocalBoxFuture<'static, Result<HttpResponse, TelescopeError>>
fn unlink_handler(
id: Identity,
cookie: AuthenticationCookie
) -> LocalBoxFuture<'static, Result<HttpResponse, TelescopeError>>
Actix-web handler for the route that unlinks an identity service.