How to use the botframework-connector.ClaimsIdentity function in botframework-connector

To help you get started, we’ve selected a few botframework-connector examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / botbuilder-js / libraries / botbuilder / src / channelServiceHandler.ts View on Github external
private async authenticate(authHeader: string): Promise {
        try {
            if (!authHeader) {
                const isAuthDisable = this.credentialProvider.isAuthenticationDisabled()
                if (isAuthDisable) {
                        // In the scenario where Auth is disabled, we still want to have the
                        // IsAuthenticated flag set in the ClaimsIdentity. To do this requires
                        // adding in an empty claim.
                        return new ClaimsIdentity([], false);
                }
            }

            return await JwtTokenValidation.validateAuthHeader(authHeader, this.credentialProvider, this.channelService, 'unknown', undefined, this.authConfig);
        }
        catch (err) {
            throw new StatusCodeError(StatusCodes.UNAUTHORIZED);
        }
    }
}