Reference Source
public class | source

AuthenticationPlugin

Extends:

devapt-core-common/dist/js/plugins/plugin~Plugin → AuthenticationPlugin

Authentication plugin base class.

Constructor Summary

Public Constructor
public

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

Create an Authentication base class.

Member Summary

Public Members
public

Method Summary

Public Methods
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_runtime: RuntimeBase, arg_manager: AuhtenticationManager, arg_name: string, arg_class: string, arg_log_context: string | undefined): nothing source

Create an Authentication base class.

Params:

NameTypeAttributeDescription
arg_runtime RuntimeBase

runtime instance.

arg_manager AuhtenticationManager

authentication plugins manager.

arg_name string

plugin name.

arg_class string

plugin class name.

arg_log_context string | undefined

optional.

Return:

nothing

Public Members

public is_authentication_plugin: boolean source

Public Methods

public abstract apply_on_server(arg_server: object): nothing source

Apply authentication plugin io given server. Use a middleware.

Params:

NameTypeAttributeDescription
arg_server object

Runtime server (Express/Restify server for example)

Return:

nothing

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

Authenticate a user with request credentials.

Params:

NameTypeAttributeDescription
arg_credentials Credentials | undefined

request credentials object.

Return:

object

a promise of boolean.

public abstract check_token(): boolean source

Check a credentials token.

Return:

boolean

request token is valid.

public abstract 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).

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 abstract disable(arg_settings: object | undefined): object source

Disable authentication plugin with contextual informations.

Params:

NameTypeAttributeDescription
arg_settings object | undefined

optional contextual settings.

Return:

object

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

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

Enable authentication plugin with contextual informations.

Params:

NameTypeAttributeDescription
arg_settings object | undefined

optional contextual settings.

Return:

object

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

public abstract get_token(): string source

Get credentials token of authenticated user.

Return:

string

credentials token.

public abstract login(): object source

Login current request (alias of authenticate).

Return:

object

a promise of boolean.

public abstract logout(): object source

Logout current authenticated user.

Return:

object

a promise of boolean.

public abstract renew_token(): string source

Create a new credentials token for authenticated user.

Return:

string

credentials token.