botframework-connector
Version:
Bot Connector is autorest generated connector client.
70 lines (69 loc) • 3.52 kB
TypeScript
/**
* @module botframework-connector
*/
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { Activity } from 'botframework-schema';
import { AuthenticationConfiguration } from './authenticationConfiguration';
import { Claim, ClaimsIdentity } from './claimsIdentity';
import { ICredentialProvider } from './credentialProvider';
/**
* @deprecated Use `ConfigurationBotFrameworkAuthentication` instead to perform JWT token validation.
*/
export declare namespace JwtTokenValidation {
/**
* Authenticates the request and sets the service url in the set of trusted urls.
*
* @param {Partial<Activity>} activity The incoming Activity from the Bot Framework or the Emulator
* @param {string} authHeader The Bearer token included as part of the request
* @param {ICredentialProvider} credentials The set of valid credentials, such as the Bot Application ID
* @param {string} channelService The channel service
* @param {AuthenticationConfiguration} authConfig Optional, the auth config
* @returns {Promise<ClaimsIdentity>} Promise with ClaimsIdentity for the request.
*/
function authenticateRequest(activity: Partial<Activity>, authHeader: string, credentials: ICredentialProvider, channelService: string, authConfig?: AuthenticationConfiguration): Promise<ClaimsIdentity>;
/**
* Validate an auth header.
*
* @param {string} authHeader the auth header
* @param {ICredentialProvider} credentials the credentials
* @param {string} channelService the channel service
* @param {string} channelId the channel ID
* @param {string} serviceUrl the service URL
* @param {AuthenticationConfiguration} authConfig the auth config
* @returns {Promise<ClaimsIdentity>} a promise that resolves to the validated claims, or rejects if validation fails
*/
function validateAuthHeader(authHeader: string, credentials: ICredentialProvider, channelService: string, channelId: string, serviceUrl?: string, authConfig?: AuthenticationConfiguration): Promise<ClaimsIdentity>;
/**
* Gets the AppId from a claims list.
*
* @summary
* In v1 tokens the AppId is in the "ver" AuthenticationConstants.AppIdClaim claim.
* In v2 tokens the AppId is in the "azp" AuthenticationConstants.AuthorizedParty claim.
* If the AuthenticationConstants.VersionClaim is not present, this method will attempt to
* obtain the attribute from the AuthenticationConstants.AppIdClaim or if present.
*
* Throws a TypeError if claims is falsy.
*
* @param {Claim[]} claims An object containing claims types and their values.
* @returns {string} the app ID
*/
function getAppIdFromClaims(claims: Claim[]): string;
/**
* Determine whether or not a channel service is government
*
* @param {string} channelService the channel service
* @returns {boolean} true if this is a government channel service
*/
function isGovernment(channelService: string): boolean;
/**
* Internal helper to check if the token has the shape we expect "Bearer [big long string]".
*
* @param {string} authHeader A string containing the token header.
* @returns {boolean} True if the token is valid, false if not.
*/
function isValidTokenFormat(authHeader: string): boolean;
}
//# sourceMappingURL=jwtTokenValidation.d.ts.map