/** * Copyright 2020 Splunk, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"): you may * not use this file except in compliance with the License. You may obtain * a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ import { AccessToken } from '../model/access-token'; import { GrantType } from '../splunk-auth-client-settings'; /** * TokenManagerSettings. */ export declare class TokenManagerSettings { /** * TokenManagerSettings constructor. * @param grantType Grant Type. * @param authHost Authorize Host. * @param autoTokenRenewalBuffer Auto token renewal buffer. * @param clientId Client Id. * @param redirectUri Redirect URI. * @param region Region. * @param storageName Storage name. * @param enableMultiRegionSupport Enable multi region support. */ constructor(grantType: GrantType, authHost: string, autoTokenRenewalBuffer: number, clientId: string, redirectUri: string, region: string, storageName?: string, enableMultiRegionSupport?: boolean); /** * Grant Type. */ grantType: GrantType; /** * Authorization Host. */ authHost: string; /** * Auto token renewal buffer. */ autoTokenRenewalBuffer: number; /** * Client Id. */ clientId: string; /** * Redirect URI. */ redirectUri: string; /** * Region */ region: string; /** * Storage name. */ storageName: string; /** * Update auth host url to be tenant based if set to true */ enableMultiRegionSupport: boolean; } /** * TokenManager. */ export declare class TokenManager { /** * TokenManager. * @param settings TokenManagerSettings. */ constructor(settings: TokenManagerSettings); private _settings; private _storage; private _authProxy; private _autoRefreshFunction?; /** * Puts the access token in storage. */ set(accessToken: AccessToken): void; /** * Gets the access token from storage. * * Returns the tenant-scoped access token if the tenant is defined * and available in the session storage otherwise default to * the globally-scoped access token. */ get(tenant: string | undefined): AccessToken; /** * Clears the access token in storage. */ clear(): void; /** * Refreshes the token. */ refreshToken(accessToken: AccessToken): Promise; private setAutoRefreshTokenTimer; }