/*! * Copyright 2017 - 2020 by ChartIQ, Inc. * All rights reserved. */ /** * 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](/docs/enterprise/authentication/) for an overview of using the Authentication Client. * * @module AuthenticationClient */ /** This is how we want our API to work going foward, the way the world does it: import { processAndSet } from "configClient" ``` export const processAndSet = () => { ... } ``` This module's single exported object gives us backward compatibility when our core code does this: import { ConfigClient } from "configClient" and provides the object that is attached to FSBL.Clients. This export should be kept as clean and simple as possible. ``` export const ConfigClient = { processAndSet } ``` The default export gives us backward compatibility where our core code does this: import ConfigClient from "configClient" This can be eliminated when our core core is converted to normal imports as in the first example. ``` export default ConfigClient; ``` */ import { StandardErrorCallback, StandardPromise, StandardCallback, StandardError } from "../types"; import { SpawnParams } from "../services/window/types"; /** * 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. * * ```javascript * FSBL.Clients.AuthenticationClient.publishAuthorization(username, credentials); * ``` * @param user The name of the authenticated user * @param credentials The authorization credentials (or token) for the current user, as specified by the application's authentication component. */ export declare const publishAuthorization: (user: string, credentials: any) => void; /** * Returns the current global credentials (as published through publishAuthorization) or null if no credentials are set yet. * @param cb A function that returns the current credentials. Will return null/undefined if no credentials have yet been established. */ export declare const getCurrentCredentials: (cb?: StandardErrorCallback) => StandardPromise; /** * Sends the provided data to the authentication service for a sign-on attempt. * * @param signOnData * @param signOnData.username The username to authenticate the request for * @param signOnData.password The password to validate for the requested user * @param signOnData.error An error message indicating failure to retrieve login credentials. * @param signOnData.signOnKey component-defined unique identifier string representing the sign-on data (the same string must be used for each unique sign on). */ export declare const transmitSignOnToAuthService: (signOnData: { username?: string; password?: string; signOnKey: string; error?: string; }) => void; /** * ALPHA Automatic sign-on Function. Returns the sign on data after either prompting user or getting a cached version. * * @param signOnKey component-defined unique identifier string representing the sign-on data (the same string must be used for each unique sign on). * @param params * @param params.icon a URL to an icon that displaces the Finsemble icon for the sign-on dialog. * @param params.prompt A string to display in the sign on dialog. * @param params.force Whether the sign-on dialog should be used even if accepted sign-on data is available in the encrypted store. * @param params.userMsg Optional parameter to be displayed for the user in the sign-on dialog. * @param cb callback (err,response) with the response being an object: { signOnKey, username, password, validationRequired } * @deprecated */ export declare const appSignOn: (signOnKey: any, params: { icon: string; prompt: string; force: boolean; userMsg?: string; }, cb?: StandardCallback) => Promise<{ err?: StandardError; data?: any; }>; /** * 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. * * @param signOnKey * @param params object * @param params.userMsg An optional message to be displayed for the user in the sign-on dialog * @param cb * @deprecated */ export declare const appRejectAndRetrySignOn: (signOnKey: string, params: { userMsg?: string; }, cb: StandardCallback) => void; /** * 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. * @param err The error to be returned if the method fails. * @param params 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. * @param cb 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. */ export declare const completeOAUTH: (err?: string, params?: any, cb?: StandardErrorCallback) => StandardPromise; /** * 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. * * @param params Parameters * @param params.profile The name of the authentication profile from the authentication config section. See [startup](/docs/smart-desktop/configuration/ConfigReference) for instance. * @param params.spawnParams Optionally specify parameters to send to spawn for spawning an authentication window. These parameters are the same as those found in LauncherClient#spawn. * @param cb Returns an object containing the authentication response, i.e., OAuth credentials, etc */ export declare const beginAuthentication: (params: { profile?: string; spawnParams?: SpawnParams; }, cb?: StandardErrorCallback) => StandardPromise; /** * @ignore */ export declare const AuthenticationClient: { /** * For backward compatibility * @private * @deprecated */ initialize: () => void; /** * For backward compatibility * @private * @deprecated */ onReady: (cb?: any) => void; beginAuthentication: (params: { profile?: string; spawnParams?: SpawnParams; }, cb?: StandardErrorCallback) => StandardPromise; completeOAUTH: (err?: string, params?: any, cb?: StandardErrorCallback) => StandardPromise; transmitSignOnToAuthService: (signOnData: { username?: string; password?: string; signOnKey: string; error?: string; }) => void; getCurrentCredentials: (cb?: StandardErrorCallback) => StandardPromise; publishAuthorization: (user: string, credentials: any) => void; appRejectAndRetrySignOn: (signOnKey: string, params: { userMsg?: string; }, cb: StandardCallback) => void; appRejectSignOn: (signOnKey: any) => void; appAcceptSignOn: (signOnKey: any) => void; appSignOn: (signOnKey: any, params: { icon: string; prompt: string; force: boolean; userMsg?: string; }, cb?: StandardCallback) => Promise<{ err?: StandardError; data?: any; }>; }; /** * @ignore */ export default AuthenticationClient; //# sourceMappingURL=authenticationClient.d.ts.map