Class: AuthenticationClient
Authentication Client (Finsemble Connect)
The Authentication Client supports three distinct areas of functionality:
-
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).
-
The client API provides hooks for running authentication processes dynamically via "authentication profiles."
-
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.
Methods
-
beginAuthentication(params, cb)
-
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.
Name Type Description params
Parameters
Name Type Description profile
optional The name of the authentication profile from the authentication config section. See "startup" for instance.
spawnParams
SpawnParams optional Optionally specify parameters to send to spawn for spawning an authentication window. These parameters are the same as those found in LauncherClient#spawn.
cb
StandardCallback -
completeOAUTH(err, params, cb)
-
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.
Name Type Description err
undefined | string optional The error to be returned if the method fails.
params
any optional Optionally 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
StandardCallback -
getCurrentCredentials(cb)
-
Returns the current global credentials (as published through publishAuthorization) or null if no credentials are set yet.
Name Type Description cb
StandardCallback -
publishAuthorization(user, credentials)
-
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.
Name Type Description user
string The name of the authenticated user
credentials
any The authorization credentials (or token) for the current user, as specified by the application's authentication component.
Example
FSBL.Clients.AuthenticationClient.publishAuthorization(username, credentials);
-
transmitSignOnToAuthService(signOnData)
-
Sends the provided data to the authentication service for a sign-on attempt.
Name Type Description signOnData
Name Type Description error
optional password
optional signOnKey
string username
optional