Skip to content

[Microsoft.AspNetCore.Authentication.JwtBearer; 3.0.0-preview5-19227-01+] MissingFieldException #11593

@StiviiK

Description

@StiviiK

Describe the bug

.NET Core version: 3.0+
Nuget package: Microsoft.AspNetCore.Authentication.JwtBearer
Affected versions: 3.0.0-preview5-19227-01+
Last working version: 3.0.0-preview4-19216-03

Using JWT Bearer authentication, with the affected versions noted above, break the application by throwing an an MissingFieldException: Field not found: 'Microsoft.Net.Http.Headers.HeaderNames.WWWAuthenticate'.

To Reproduce

  1. Create an ASP.NET Core 3.0+ application add JWT Bearer Authentication
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
   .AddJwtBearer(opts =>
   {
      opts.TokenValidationParameters = new TokenValidationParameters
      {
         IssuerSigningKey = Encryption.GetRsaKeyFromXml(Configuration["JWT:RsaPublicKeyXml"]),
         ValidateIssuerSigningKey = true
      };
   });
  1. Add an [Authorize] attribute to an controller
  2. Try accessing that route/controller => Exception gets thrown

Expected behavior

Authentication handler to be working fine as in last working version 3.0.0-preview4-19216-03 and no exception to be thrown.

Screenshots

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-authIncludes: Authn, Authz, OAuth, OIDC, Bearer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions