Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ public JwtAuthenticationHeaderHandler(IAccessTokenProviderAccessor tokenProvider

protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
// skip token endpoints
if (request.RequestUri?.AbsolutePath.Contains("/tokens") is not true)
// skip token endpoints and pages with attribute [AllowAnonymous]
if (request.RequestUri?.AbsolutePath.Contains("/tokens") is not true &&
request.RequestUri?.AbsolutePath.Contains("/self-register") is not true &&
request.RequestUri?.AbsolutePath.Contains("/forgot-password") is not true)
{
if (await _tokenProviderAccessor.TokenProvider.GetAccessTokenAsync() is string token)
{
Expand All @@ -31,4 +33,4 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage

return await base.SendAsync(request, cancellationToken);
}
}
}