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:
- Client calls
POST /startwith either an e-mail address of phone number to verify. - Sends an OTP code to the provided email or phone number in step 1.
- Client calls
POST /verifywith the email or phone number and OTP code. - If OTP code is verified, creates a new
UserandAlias, 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
abstractprotectedaliasClass:any
Defined in: auth/src/routes/BaseRegistrationRoute.ts:53
aliasRepo?
protectedoptionalaliasRepo?:RepoUtils<A>
Defined in: auth/src/routes/BaseRegistrationRoute.ts:86
auditLogUtils?
protectedoptionalauditLogUtils?:AuditLogUtils
Defined in: auth/src/routes/BaseRegistrationRoute.ts:63
defaultScopes
protecteddefaultScopes:string[] =[]
Defined in: auth/src/routes/BaseRegistrationRoute.ts:66
jwtConfig?
protectedoptionaljwtConfig?:any
Defined in: auth/src/routes/BaseRegistrationRoute.ts:69
logger
protectedlogger:any
Defined in: auth/src/routes/BaseRegistrationRoute.ts:72
messagingUtils?
protectedoptionalmessagingUtils?:MessagingUtils
Defined in: auth/src/routes/BaseRegistrationRoute.ts:75
rateLimiter?
protectedoptionalrateLimiter?:RateLimiter
Defined in: auth/src/routes/BaseRegistrationRoute.ts:78
systemSettingsClass?
abstractprotectedoptionalsystemSettingsClass?:any
Defined in: auth/src/routes/BaseRegistrationRoute.ts:54
systemSettingsUtils?
protectedoptionalsystemSettingsUtils?:SystemSettingsUtils
Defined in: auth/src/routes/BaseRegistrationRoute.ts:60
tokenUtils?
protectedoptionaltokenUtils?:TokenUtils
Defined in: auth/src/routes/BaseRegistrationRoute.ts:81
trustedProxies
protectedtrustedProxies:string[] =[]
Defined in: auth/src/routes/BaseRegistrationRoute.ts:84
userClass
abstractprotecteduserClass:any
Defined in: auth/src/routes/BaseRegistrationRoute.ts:55
userRepo?
protectedoptionaluserRepo?:RepoUtils<U>
Defined in: auth/src/routes/BaseRegistrationRoute.ts:87
Methods
initialize()
protectedinitialize():Promise<void>
Defined in: auth/src/routes/BaseRegistrationRoute.ts:90
Returns
Promise<void>
isRegistrationAllowed()
protectedisRegistrationAllowed():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>