Class: AuthenticationApi

SanteDBWrapper.AuthenticationApi()

new AuthenticationApi()

Authentication API

Source:

Members

(static, constant) this.ANONYMOUS_USER

SID for ANONYMOUS user

Source:

Methods

(static) authorizationCodeLoginAsync(noSession) → {Promise}

Performs an OAUTH authorization code grant

This function should be called *after* the authorization code has been obtained from the authorization server
Parameters:
Name Type Description
noSession boolean When true, indicates that there should not be a persistent session created
Source:
See:
Returns:
A promise representing the session request
Type
Promise

(static) challengeLoginAsync(userName, challenge, response, tfaSecret) → {Promise}

Performs an extended login for the purpose of password reset (using a challenge and response)

This type of grant is an extension of the oauth grants. The resulting session is only valid for changing the user's own password. No other functions will work with this token
Parameters:
Name Type Description
userName string The name of the user which is logging in
challenge string The selected user challenge which is being answered
response string The user's response to the challenge offerred
tfaSecret string The two-factor secret if provided
Source:
See:
Returns:
A promise representing the login request
Type
Promise

(static) clientCredentialLoginAsync(noSession, scope) → {Promise}

Performs an OAUTH client credentials login

A client credentials login is a login principal which only has an application principal. This is useful for password resets, etc.
Parameters:
Name Type Description
noSession boolean When true, indicates that a session should not be replaced that the request is a one time use token
scope Array The list of scopes for this session
Source:
See:
Returns:
A promise representing the login request
Type
Promise

(static) demandAsync(policy) → {Promise}

Demand permission for the specified policy

Parameters:
Name Type Description
policy string The policy which is being demanded
Source:
Returns:
A promise representing the fulfillment or rejection of the demand
Type
Promise

(static) getSessionInfoAsync(forceServer) → {Promise}

Gets the extended session information

Parameters:
Name Type Description
forceServer boolean When true (or supplied) instructs the function to force a server fetch of the session
Source:
Returns:
A promise representing the fulfillment or rejection of the get request
Type
Promise

(static) getTfaModeAsync() → {Promise}

Retrieves information about the two-factor authentication modes supported by the server

Source:
Returns:
The promise representing the fulfillment or rejection of the get request
Type
Promise

(static) logoutAsync() → {Promise}

Abandons the current SanteDB session

Source:
Returns:
The promise representing the fulfillment or rejection of the logout request
Type
Promise

(static) passwordLoginAsync(userName, password, tfaSecret, scope, uacPrompt, purposeOfUse) → {Promise}

Performs a OAUTH password login

Parameters:
Name Type Description
userName string The name of the user which is logging in
password string The password of the user
tfaSecret string The two-factor secret if provided
scope string When true indicates that there should not be a persistent session (i.e. one time authentication)
uacPrompt boolean True if the authentication is part of a UAC prompt and no perminant session is to be
purposeOfUse String The identifier of the purpose of use for the access
Source:
See:
Returns:
A promise representing the login request
Type
Promise

(static) pinLoginAsync(userName, password, tfaSecret, noSession, purposeOfUse, scope) → {Promise}

Performs a local pin login

Parameters:
Name Type Description
userName string The name of the user which is logging in
password string The password of the user
tfaSecret string The two-factor secret if provided
noSession boolean When true indicates that there should not be a persistent session (i.e. one time authentication)
purposeOfUse String The reason the authentication is happening
scope Array The requested scope of the session
Source:
See:
Returns:
A promise representing the login request
Type
Promise

(static) refreshLoginAsync(noSession) → {Promise}

Performs a refresh token grant

Parameters:
Name Type Description
noSession boolean True if no session should be setup
Source:
See:
Returns:
A promise representing the session refresh request
Type
Promise

(static) sendTfaSecretAsync(mode) → {Promise}

Requests a two-factor authentication secret to be sent

Parameters:
Name Type Description
mode string The mode of two-factor authentication (email, sms, etc.)
Source:
Returns:
A promise representing the outcome of the TFA secret send
Type
Promise

(static) setElevator(elevator)

Sets the elevator function

Parameters:
Name Type Description
elevator any An elevation implementation
Properties
Name Type Description
getToken function A function to get the current token
elevate function A function to perform elevation
Source:

(static) setPasswordAsync(sid, userName, passwd) → {Promise}

Sets the password of the specified user

Parameters:
Name Type Description
sid string The security identifier of the user which is being updated
userName string The name of the user to set the password to
passwd string The password to set the currently logged in user to
Source:
Returns:
The promise representing the fulfillment or rejection of the password change
Type
Promise