Reference Source
public class | source

Credentials

Authentication informations, used on server and on browser.

Example:

	API:
		->set_credentials(arg_datas):nothing - check and set crendtials datas.
		
		->dump():string - dump credentials to a readable string without sensitive datas.
		->digest_password(arg_string):string - hash credentials password (static).
		
		->serialize(arg_app_secret):string - transform credentials to a string.
		->deserialize(string, arg_app_secret):boolean - load credentials from a string.string

		->encrypt(arg_app_key):string - encrypted string.
		->decrypt(arg_string, arg_app_key):boolean - success or failure.

		->extract(arg_string):object - extract a record with credentials values from a formatted string.

Static Method Summary

Static Public Methods
public static

digest_password(arg_password: string): string

Transform credentials password with a hash method.

public static

Get empty credentials record.

Constructor Summary

Public Constructor
public

constructor(arg_datas: object): nothing

Create a Credentials instance.

Member Summary

Public Members
public

Class type flag.

public

Update handler.

Private Members
private

_credentials: Immutable.Map

Credentials settings.

Method Summary

Public Methods
public

decrypt(arg_string: string, arg_app_key: string): string

Decrypt credentials encrypted string.

public

deserialize(arg_string: string): boolean

Deserialize credentials from a string without encryption.

public

Dump credentials datas to a readable string without sensitive datas.

public

encrypt(arg_app_key: string): string

Transform credentials to a string with encryption.

public

extract(arg_string: string): object

Extract credentials fields from a string (password should be hashed and encoded, only [a-zA-Z0-9_] chars).

public

Get credentials application.

public

Get credentials datas.

public

Get credentials datas.

public

Get credentials environment.

public

Get credentials user.

public

Get credentials tenant.

public

Get credentials token.

public

Get credentials url part.

public

Get credentials user.

public

Credentials are valid for access.

public

Transform credentials to a string without encryption which could be sent over a network.

public

Check and set credentials datas.

Static Public Methods

public static digest_password(arg_password: string): string source

Transform credentials password with a hash method.

Params:

NameTypeAttributeDescription
arg_password string

password string.

Return:

string

hashed string.

public static get_empty_credentials(): object source

Get empty credentials record.

Return:

object

Public Constructors

public constructor(arg_datas: object): nothing source

Create a Credentials instance. Store credentials values into an immutable Map.

Params:

NameTypeAttributeDescription
arg_datas object

credentials datas object.

Return:

nothing

Public Members

public is_credentials: boolean source

Class type flag.

public update_handler: function source

Update handler.

Private Members

private _credentials: Immutable.Map source

Credentials settings.

Public Methods

public decrypt(arg_string: string, arg_app_key: string): string source

Decrypt credentials encrypted string.

Params:

NameTypeAttributeDescription
arg_string string

string.

arg_app_key string

encryption key.

Return:

string

encrypted string.

public deserialize(arg_string: string): boolean source

Deserialize credentials from a string without encryption. @TODO: use RegExp to split the string into credentials attributes.

Params:

NameTypeAttributeDescription
arg_string string

serialized string.

Return:

boolean

deserialized string success or failure.

public dump(): string source

Dump credentials datas to a readable string without sensitive datas.

Return:

string

readable string without sensitive datas.

public encrypt(arg_app_key: string): string source

Transform credentials to a string with encryption.

Params:

NameTypeAttributeDescription
arg_app_key string

encryption key.

Return:

string

encrypted string.

public extract(arg_string: string): object source

Extract credentials fields from a string (password should be hashed and encoded, only [a-zA-Z0-9_] chars).

Params:

NameTypeAttributeDescription
arg_string string

string as "CREDENTIALS:{tenant:%s,env:%s,app:%s,token:%s,user:%s,pass:%s}".

Return:

object

credentials values record.

public get_application(): string | undefined source

Get credentials application.

Return:

string | undefined

public get_credentials(): object source

Get credentials datas.

Return:

object

public get_credentials_for_template(): object source

Get credentials datas.

Return:

object

public get_env(): string | undefined source

Get credentials environment.

Return:

string | undefined

public get_pass_digest(): string | undefined source

Get credentials user.

Return:

string | undefined

public get_tenant(): string | undefined source

Get credentials tenant.

Return:

string | undefined

public get_token(): string | undefined source

Get credentials token.

Return:

string | undefined

public get_url_part(): string source

Get credentials url part.

Return:

string

public get_user(): string | undefined source

Get credentials user.

Return:

string | undefined

public is_valid(): boolean source

Credentials are valid for access.

Return:

boolean

public serialize(): string source

Transform credentials to a string without encryption which could be sent over a network.

Return:

string

serialized string.

public set_credentials(arg_datas: object): boolean source

Check and set credentials datas.

Params:

NameTypeAttributeDescription
arg_datas object

credentials datas object.

Return:

boolean