botframework-connector
Version:
Bot Connector is autorest generated connector client.
62 lines • 3.26 kB
TypeScript
/**
* @module botframework-connector
*/
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { AuthenticationConfiguration } from './authenticationConfiguration';
import { Claim, ClaimsIdentity } from './claimsIdentity';
import { ICredentialProvider } from './credentialProvider';
/**
* @deprecated Use `ConfigurationBotFrameworkAuthentication` instead to perform skill validation.
* Validates JWT tokens sent to and from a Skill.
*/
export declare namespace SkillValidation {
/**
* Determines if a given Auth header is from a skill to bot or bot to skill request.
*
* @param {string} authHeader Bearer Token, in the "Bearer [Long String]" Format.
* @returns {boolean} True, if the token was issued for a skill to bot communication. Otherwise, false.
*/
function isSkillToken(authHeader: string): boolean;
/**
* Checks if the given object of claims represents a skill.
*
* @remarks
* A skill claim should contain:
* An "AuthenticationConstants.VersionClaim" claim.
* An "AuthenticationConstants.AudienceClaim" claim.
* An "AuthenticationConstants.AppIdClaim" claim (v1) or an a "AuthenticationConstants.AuthorizedParty" claim (v2).
* And the appId claim should be different than the audience claim.
* The audience claim should be a guid, indicating that it is from another bot/skill.
* @param claims An object of claims.
* @returns {boolean} True if the object of claims is a skill claim, false if is not.
*/
function isSkillClaim(claims: Claim[]): boolean;
/**
* Validates that the incoming Auth Header is a token sent from a bot to a skill or from a skill to a bot.
*
* @param authHeader The raw HTTP header in the format: "Bearer [longString]".
* @param credentials The user defined set of valid credentials, such as the AppId.
* @param channelService The channelService value that distinguishes public Azure from US Government Azure.
* @param channelId The ID of the channel to validate.
* @param authConfig The authentication configuration.
* @returns {Promise<ClaimsIdentity>} A "ClaimsIdentity" instance if the validation is successful.
*/
function authenticateChannelToken(authHeader: string, credentials: ICredentialProvider, channelService: string, channelId: string, authConfig: AuthenticationConfiguration): Promise<ClaimsIdentity>;
/**
* @ignore
* @private
* @param identity
* @param credentials
*/
function validateIdentity(identity: ClaimsIdentity, credentials: ICredentialProvider): Promise<void>;
/**
* Creates a set of claims that represent an anonymous skill. Useful for testing bots locally in the emulator
*
* @returns A [ClaimsIdentity](xref.botframework-connector.ClaimsIdentity) instance with authentication type set to [AuthenticationConstants.AnonymousAuthType](xref.botframework-connector.AuthenticationConstants) and a reserved [AuthenticationConstants.AnonymousSkillAppId](xref.botframework-connector.AuthenticationConstants) claim.
*/
function createAnonymousSkillClaim(): ClaimsIdentity;
}
//# sourceMappingURL=skillValidation.d.ts.map