Skip to content

Commit

Permalink
JwtBearerTokenResolver should handle null HttpContext (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
fraliv13 authored May 27, 2022
1 parent 7d1b6d8 commit 81e4244
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public JwtBearerTokenResolver(IHttpContextAccessor httpContextAccessor, string p

public Task<string> GetTenantToken()
{
if (!_httpContextAccessor.HttpContext.Request.Headers.ContainsKey(HeaderNames.Authorization))

var hasAuthorizationHeader = _httpContextAccessor?.HttpContext?.Request?.Headers?.ContainsKey(HeaderNames.Authorization) ?? false;
if (!hasAuthorizationHeader)
{
return Task.FromResult((string)null);
}
Expand Down

0 comments on commit 81e4244

Please sign in to comment.