Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}
}
}