Skip to main content

Module: AuthenticationClient

The Authentication Client supports three distinct areas of functionality:

1) The client API provides hooks for plugging in a custom sign-on component at the beginning of Finsemble start-up (before application-level components are started).

2) The client API provides hooks for running authentication processes dynamically via "authentication profiles."

3) The client API provides automatic login capabilities for Finsemble components (password auto-fill).

See the Authentication tutorial for an overview of using the Authentication Client.

Functions

appRejectAndRetrySignOn

appRejectAndRetrySignOn(signOnKey, params, cb): void

ALPHA Automatic sign-on Function. Rejects previous sign-on data and restarts sign on. Returns the sign-on data after either prompting user or getting a cached version. Should only be called when validationRequired is true in sign-on response.

deprecated

Parameters

NameTypeDescription
signOnKeystring
paramsObjectobject
params.userMsg?stringAn optional message to be displayed for the user in the sign-on dialog
cbStandardCallback<StandardError, any>

Returns

void


appSignOn

appSignOn(signOnKey, params, cb?): Promise<{ data?: any ; err?: StandardError }>

ALPHA Automatic sign-on Function. Returns the sign on data after either prompting user or getting a cached version.

deprecated

Parameters

NameTypeDescription
signOnKeyanycomponent-defined unique identifier string representing the sign-on data (the same string must be used for each unique sign on).
paramsObject
params.forcebooleanWhether the sign-on dialog should be used even if accepted sign-on data is available in the encrypted store.
params.iconstringa URL to an icon that displaces the Finsemble icon for the sign-on dialog.
params.promptstringA string to display in the sign on dialog.
params.userMsg?stringOptional parameter to be displayed for the user in the sign-on dialog.
cb?StandardCallback<StandardError, any>callback (err,response) with the response being an object: { signOnKey, username, password, validationRequired }

Returns

Promise<{ data?: any ; err?: StandardError }>


beginAuthentication

beginAuthentication(params, cb?): StandardPromise<any>

Starts an authentication process. The callback will be triggered when the authentication is totally complete. Use this method if you have a component that needs to complete an authentication process, such as OAuth2.

You must set up an "authentication profile" in your Finsemble config. Reference the name of that profile in params.profile.

Parameters

NameTypeDescription
paramsObjectParameters
params.profile?stringThe name of the authentication profile from the authentication config section. See startup for instance.
params.spawnParams?SpawnParamsOptionally specify parameters to send to spawn for spawning an authentication window. These parameters are the same as those found in LauncherClient#spawn.
cb?StandardErrorCallback<any>Returns an object containing the authentication response, i.e., OAuth credentials, etc

Returns

StandardPromise<any>


completeOAUTH

completeOAUTH(err?, params?, cb?): StandardPromise<any>

Completes an OAuth2 authentication that was begun with beginAuthentication. This function is called when an OAuth2 response is completed. You should call this function from within the page that you specified in "redirect_uri" in your Authentication Profile config.

Parameters

NameTypeDescription
err?stringThe error to be returned if the method fails.
params?anyOptionally pass the OAuth2 query string parameters from your response page. Set to null and the query string will automatically be parsed based on the OAuth2 specification.
cb?StandardErrorCallback<any>Returns the result (err, data). Data will contain the results of the authentication process, such as the access_token and other values provided by your Identify Provider.

Returns

StandardPromise<any>


getCurrentCredentials

getCurrentCredentials(cb?): StandardPromise<any>

Returns the current global credentials (as published through publishAuthorization) or null if no credentials are set yet.

Parameters

NameTypeDescription
cb?StandardErrorCallback<any>A function that returns the current credentials. Will return null/undefined if no credentials have yet been established.

Returns

StandardPromise<any>


publishAuthorization

publishAuthorization(user, credentials): void

During Finsemble's start-up process, this function must be invoked before Finsemble will start the application. Once invoked, the authenticated user name and authorization credentials are received by the Authentication Service and published on the "AuthenticationService.authorization" channel. Any component can revive the credentials by subscribing to that channel or by calling getCurrentCredentials.

Note that all calls to Storage Client are keyed to the authenticated user. See StorageClient#setUser. If authentication is not enabled, then "defaultUser" is used instead.

FSBL.Clients.AuthenticationClient.publishAuthorization(username, credentials);

Parameters

NameTypeDescription
userstringThe name of the authenticated user
credentialsanyThe authorization credentials (or token) for the current user, as specified by the application's authentication component.

Returns

void


transmitSignOnToAuthService

transmitSignOnToAuthService(signOnData): void

Sends the provided data to the authentication service for a sign-on attempt.

Parameters

NameTypeDescription
signOnDataObject
signOnData.error?stringAn error message indicating failure to retrieve login credentials.
signOnData.password?stringThe password to validate for the requested user
signOnData.signOnKeystringcomponent-defined unique identifier string representing the sign-on data (the same string must be used for each unique sign on).
signOnData.username?stringThe username to authenticate the request for

Returns

void