Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Authentication<T>

This class is known as the Authentication module It handles OAuth for several providers for now (Facebook, Google, Amazon, GitHub and Twitter) It also handles email authentication with prevalidation or postvalidation of the email

It requires two Store to work one idents and one users

The parameters are

  providerName: {
    clientID: '...',
    clientSecret: '...',
    scope: ''
  },
  email: {
        postValidation: true|false   // If postValidation=true, account created without email verification
  }
  url: 'url' // By default /auth

Type parameters

Hierarchy

Constructors

Properties

_createException: string
_identsStore: Store<Ident>
_initException: any = undefined
_initTime: number
_name: string

Service name

_passwordVerifier: PasswordVerifier
_usersStore: Store<User>
_webda: Core

Webda Core object

logger: Logger

Logger with class context

parameters: T

Hold the parameters for your service

It will be bring from the webda.config.json

providers: Set<string> = new Set<string>()
defaultMaxListeners: number

Methods

  • __clean(): Promise<any>
  • _getMe(ctx: Context): Promise<void>
  • _handleEmail(ctx: Context): Promise<any>
  • _handleEmailCallback(ctx: Context): Promise<void>
  • _listAuthentications(ctx: Context): Promise<void>
  • _passwordRecovery(ctx: Context): Promise<void>
  • _passwordRecoveryEmail(ctx: Context): Promise<void>
  • _registerNewEmail(ctx: any): Promise<void>
  • _sendEmailValidation(ctx: any): Promise<void>
  • _verifyPassword(password: string): Promise<void>
  • addListener(event: string | symbol, listener: function): this
  • addProvider(name: string): void
  • addRoute(url: string, methods: HttpMethodType[], executer: Function, openapi?: object, allowPath?: boolean): void
  • checkPassword(hash: any, pass: any): boolean
  • emit(event: string | symbol, ...args: any[]): boolean
  • emitSync(event: any, data: any): Promise<any[]>
  • eventNames(): Array<string | symbol>
  • generateEmailValidationToken(user: string, email: string): string
  • getMaxListeners(): number
  • getName(): string
  • getParameters(): T
  • getService<T>(service: string): T
  • getUrl(): string
  • hashInfo(info: string): string
  • hashPassword(pass: string): string
  • init(): Promise<void>
  • initRoutes(): void
  • listenerCount(type: string | symbol): number
  • listeners(event: string | symbol): Function[]
  • login(ctx: Context, user: any, ident: any): Promise<any[]>
  • logout(ctx: Context): Promise<void>
  • off(event: string | symbol, listener: function): this
  • on(event: string | symbol, listener: function): this
  • onAsync(event: any, callback: any, queue?: string): void
  • Listen to an event as on(...) would do except that it will be asynchronous

    Parameters

    • event: any
    • callback: any
    • Default value queue: string = undefined

      Name of queue to use, can be undefined, queue name are used to define differents priorities

    Returns void

  • onIdentLogin(ctx: Context, provider: string, identId: string, profile: any): Promise<void>
  • once(event: string | symbol, listener: function): this
  • prependListener(event: string | symbol, listener: function): this
  • prependOnceListener(event: string | symbol, listener: function): this
  • rawListeners(event: string | symbol): Function[]
  • registerUser(ctx: Context, datas: any, user?: any): Promise<any>
  • reinit(config: any): Promise<void>
  • removeAllListeners(event?: string | symbol): this
  • removeListener(event: string | symbol, listener: function): this
  • resolve(): void
  • sendRecoveryEmail(ctx: Context, user: any, email: string): Promise<any>
  • sendValidationEmail(ctx: Context, email: string): Promise<any>
  • setIdents(identStore: any): void
  • setMaxListeners(n: number): this
  • setUsers(userStore: any): void
  • toPublicJSON(object: any): string
  • listenerCount(emitter: EventEmitter, event: string | symbol): number

Generated using TypeDoc