Reference Source
public class | source

AuthenticationLowDbPlugin

Extends:

devapt-core-common/dist/js/plugins/plugin~PluginAuthenticationPlugin → AuthenticationLowDbPlugin

Authentication class with a LowDb user/login database.

Constructor Summary

Public Constructor
public

constructor(arg_manager: AuhtenticationManager, arg_name: string, arg_log_context: string | undefined): nothing

Create an Authentication plugin class based on query parameters.

Member Summary

Public Members
public
public

file_db: *

public
public
public
public
public
public
public

Method Summary

Public Methods
public

authenticate(arg_credentials: Credentials | undefined): object

Authenticate a user with a file giving request credentials.

public

create_middleware(arg_should_401: boolean, arg_next_auth_mw: Function): Function

Get a authentication middleware to use on servers (see Connect/Express middleware signature).

public

disable(arg_settings: object | undefined): object

Disable authentication plugin with contextual informations.

public

enable(arg_settings: object | undefined): object

Enable authentication plugin with contextual informations.

public

get_user_by_id(arg_user_id: string): string

Get user record by its id.

public

get_user_id(arg_user_record: object): string

Get user id from a user record.

Inherited Summary

From class AuthenticationPlugin
public
public abstract

apply_on_server(arg_server: object): nothing

Apply authentication plugin io given server.

public abstract

authenticate(arg_credentials: Credentials | undefined): object

Authenticate a user with request credentials.

public abstract

Check a credentials token.

public abstract

create_middleware(arg_should_401: boolean, arg_next_auth_mw: Function): Function

Get a authentication middleware to use on servers (see Connect/Express middleware signature).

public abstract

disable(arg_settings: object | undefined): object

Disable authentication plugin with contextual informations.

public abstract

enable(arg_settings: object | undefined): object

Enable authentication plugin with contextual informations.

public abstract

Get credentials token of authenticated user.

public abstract

Login current request (alias of authenticate).

public abstract

Logout current authenticated user.

public abstract

Create a new credentials token for authenticated user.

Public Constructors

public constructor(arg_manager: AuhtenticationManager, arg_name: string, arg_log_context: string | undefined): nothing source

Create an Authentication plugin class based on query parameters.

Override:

AuthenticationPlugin#constructor

Params:

NameTypeAttributeDescription
arg_manager AuhtenticationManager

authentication plugins manager.

arg_name string

plugin name.

arg_log_context string | undefined

optional.

Return:

nothing

Public Members

public failure_redirect: * source

public file_db: * source

public file_name: * source

public id_fieldname: * source

public is_authentication_lowdb_plugin: boolean source

public password_fieldname: * source

public success_redirect: * source

public use_session: * source

public username_fieldname: * source

Public Methods

public authenticate(arg_credentials: Credentials | undefined): object source

Authenticate a user with a file giving request credentials.

Override:

AuthenticationPlugin#authenticate

Params:

NameTypeAttributeDescription
arg_credentials Credentials | undefined

request credentials object.

Return:

object

a promise of boolean.

public create_middleware(arg_should_401: boolean, arg_next_auth_mw: Function): Function source

Get a authentication middleware to use on servers (see Connect/Express middleware signature).

Override:

AuthenticationPlugin#create_middleware

Params:

NameTypeAttributeDescription
arg_should_401 boolean

should send an 401 error on authentication failure.

arg_next_auth_mw Function

next authentication middleware.

Return:

Function

function(request,response,next){...}

public disable(arg_settings: object | undefined): object source

Disable authentication plugin with contextual informations.

Override:

AuthenticationPlugin#disable

Params:

NameTypeAttributeDescription
arg_settings object | undefined

optional contextual settings.

Return:

object

a promise object of a boolean result (success:true, failure:false)

public enable(arg_settings: object | undefined): object source

Enable authentication plugin with contextual informations.

Override:

AuthenticationPlugin#enable

Params:

NameTypeAttributeDescription
arg_settings object | undefined

optional contextual settings.

Return:

object

a promise object of a boolean result (success:true, failure:false)

public get_user_by_id(arg_user_id: string): string source

Get user record by its id.

Params:

NameTypeAttributeDescription
arg_user_id string

user id.

Return:

string

user id.

public get_user_id(arg_user_record: object): string source

Get user id from a user record.

Params:

NameTypeAttributeDescription
arg_user_record object

user record object.

Return:

string

user id.