Skip to main content

Abstract Class: BaseRegistrationRoute<U, A>

Defined in: auth/src/routes/BaseRegistrationRoute.ts:52

Provides a simple account registration flow that verifies an e-mail or phone number using OTP authentication before creating the account.

The registration flow:

  1. Client calls POST /start with either an e-mail address of phone number to verify.
  2. Sends an OTP code to the provided email or phone number in step 1.
  3. Client calls POST /verify with the email or phone number and OTP code.
  4. If OTP code is verified, creates a new User and Alias, returns a valid JWT token.

Extended by​

Type Parameters​

U​

U extends User

A​

A extends Alias

Constructors​

Constructor​

new BaseRegistrationRoute<U, A>(): BaseRegistrationRoute<U, A>

Returns​

BaseRegistrationRoute<U, A>

Properties​

aliasClass​

abstract protected aliasClass: any

Defined in: auth/src/routes/BaseRegistrationRoute.ts:53


aliasRepo?​

protected optional aliasRepo?: RepoUtils<A>

Defined in: auth/src/routes/BaseRegistrationRoute.ts:86


auditLogUtils?​

protected optional auditLogUtils?: AuditLogUtils

Defined in: auth/src/routes/BaseRegistrationRoute.ts:63


defaultScopes​

protected defaultScopes: string[] = []

Defined in: auth/src/routes/BaseRegistrationRoute.ts:66


jwtConfig?​

protected optional jwtConfig?: any

Defined in: auth/src/routes/BaseRegistrationRoute.ts:69


logger​

protected logger: any

Defined in: auth/src/routes/BaseRegistrationRoute.ts:72


messagingUtils?​

protected optional messagingUtils?: MessagingUtils

Defined in: auth/src/routes/BaseRegistrationRoute.ts:75


rateLimiter?​

protected optional rateLimiter?: RateLimiter

Defined in: auth/src/routes/BaseRegistrationRoute.ts:78


systemSettingsClass?​

abstract protected optional systemSettingsClass?: any

Defined in: auth/src/routes/BaseRegistrationRoute.ts:54


systemSettingsUtils?​

protected optional systemSettingsUtils?: SystemSettingsUtils

Defined in: auth/src/routes/BaseRegistrationRoute.ts:60


tokenUtils?​

protected optional tokenUtils?: TokenUtils

Defined in: auth/src/routes/BaseRegistrationRoute.ts:81


trustedProxies​

protected trustedProxies: string[] = []

Defined in: auth/src/routes/BaseRegistrationRoute.ts:84


userClass​

abstract protected userClass: any

Defined in: auth/src/routes/BaseRegistrationRoute.ts:55


userRepo?​

protected optional userRepo?: RepoUtils<U>

Defined in: auth/src/routes/BaseRegistrationRoute.ts:87

Methods​

initialize()​

protected initialize(): Promise<void>

Defined in: auth/src/routes/BaseRegistrationRoute.ts:90

Returns​

Promise<void>


isRegistrationAllowed()​

protected isRegistrationAllowed(): Promise<boolean>

Defined in: auth/src/routes/BaseRegistrationRoute.ts:121

Returns true if new accounts may currently be registered. Reads the runtime SystemSettings when systemSettingsClass is set, otherwise (or for anything not stored) falls back to @Config("auth:allowRegistration").

Returns​

Promise<boolean>


start()​

start(body, req): Promise<Record<string, never>>

Defined in: auth/src/routes/BaseRegistrationRoute.ts:132

Sends a one-time verification code to the provided e-mail address or phone number.

Parameters​

body​

StartBody

req​

HttpRequest

Returns​

Promise<Record<string, never>>


verify()​

verify(body, req, res): Promise<AuthResult>

Defined in: auth/src/routes/BaseRegistrationRoute.ts:222

Verifies the one-time code sent by start(). On success, creates a new User and verified Alias and returns an JWT token.

Parameters​

body​

VerifyBody

req​

HttpRequest

res​

HttpResponse

Returns​

Promise<AuthResult>