Microsoft.AspNetCore.Authentication.JwtBearer 10.0.0

About

Microsoft.AspNetCore.Authentication.JwtBearer is a middleware component designed for ASP.NET Core applications. It facilitates JSON Web Token (JWT) authentication, enabling secure authentication for APIs and web services. This package allows you to validate JWT tokens issued by an authentication server, ensuring secure access to your application's resources.

Key Features

  • Seamless integration with ASP.NET Core applications.
  • Supports JSON Web Token (JWT) authentication.
  • Enables secure authentication for APIs and web services.
  • Flexible configuration options for token validation parameters.
  • Works with .NET Core 3.0 and newer, as well as .NET Standard 2.1.

How to Use

using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.IdentityModel.Tokens;
using System.Text;

public void ConfigureServices(IServiceCollection services)
{
    services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
        .AddJwtBearer(options =>
        {
            options.TokenValidationParameters = new TokenValidationParameters
            {
                ValidateIssuer = true,
                ValidateAudience = true,
                ValidateLifetime = true,
                ValidateIssuerSigningKey = true,
                ValidIssuer = "your_issuer",
                ValidAudience = "your_audience",
                IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("your_secret_key"))
            };
        });

    // Other configurations...
}

For more detailed configuration options and advanced scenarios, please refer to the blog JWT Validation and Authorization in ASP.NET Core.

Main Types

The main types provided by this library are:

  • JwtBearerDefaults: Contains default values for JWT Bearer authentication.
  • JwtBearerEvents: Events used to handle JWT Bearer authentication events.
  • JwtBearerHandler: Handles JWT Bearer authentication requests.
  • wtBearerOptions: Options for configuring JWT Bearer authentication.

Additional Documentation

Feedback & Contributing

Microsoft.AspNetCore.Authentication.JwtBearer is released as open-source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Showing the top 20 packages that depend on Microsoft.AspNetCore.Authentication.JwtBearer.

Packages Downloads
IdentityServer4.AccessTokenValidation
ASP.NET Core authentication handler to validate JWT and reference tokens from IdentityServer4
80
IdentityServer4.AccessTokenValidation
ASP.NET Core authentication handler to validate JWT and reference tokens from IdentityServer4
97
IdentityServer4.AccessTokenValidation
ASP.NET Core middleware to validate JWT and reference tokens from IdentityServer4
76
IdentityServer4.AccessTokenValidation
ASP.NET Core middleware to validate JWT and reference tokens from IdentityServer4
78
IdentityServer4.AccessTokenValidation
ASP.NET Core middleware to validate JWT and reference tokens from IdentityServer4
79
IdentityServer4.AccessTokenValidation
ASP.NET Core middleware to validate JWT and reference tokens from IdentityServer4
83
Microsoft.AspNetCore.All
Provides a default set of APIs for building an ASP.NET Core application, and also includes API for third-party integrations with ASP.NET Core. This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download.
91
Microsoft.AspNetCore.App
Provides a default set of APIs for building an ASP.NET Core application. This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download.
75
Microsoft.AspNetCore.Authentication.AzureAD.UI
ASP.NET Core Azure Active Directory Integration provides components for easily integrating Azure Active Directory authentication within your ASP.NET Core application.
85
Microsoft.Identity.Web.TokenAcquisition
Implementation for higher level API for confidential client applications (ASP.NET Core and SDK/.NET).
79
ZhonTai.Admin.Core
中台Admin权限管理核心库
76
ZhonTai.Admin.Core
中台Admin权限管理核心库
78
ZhonTai.Admin.Core
中台Admin权限管理核心库
83
ZhonTai.Admin.Core
中台Admin权限管理核心库
84
ZhonTai.Admin.Core
中台Admin权限管理核心库
86
ZhonTai.Admin.Core
中台Admin权限管理核心库
91
ZhonTai.Admin.Core
中台Admin权限管理核心库
92
ZhonTai.Admin.Core
中台Admin权限管理核心库
94

Version Downloads Last updated
10.0.0 59 11/12/2025
10.0.0-rc.2.25502.107 40 10/15/2025
10.0.0-rc.1.25451.107 43 09/11/2025
10.0.0-preview.7.25380.108 39 08/14/2025
10.0.0-preview.6.25358.103 38 07/17/2025
10.0.0-preview.5.25277.114 51 06/08/2025
10.0.0-preview.4.25258.110 43 05/15/2025
10.0.0-preview.3.25172.1 43 04/22/2025
10.0.0-preview.2.25164.1 48 03/22/2025
10.0.0-preview.1.25120.3 44 03/09/2025
9.0.11 41 11/13/2025
9.0.10 52 10/15/2025
9.0.9 41 09/11/2025
9.0.8 39 08/06/2025
9.0.7 42 07/10/2025
9.0.6 49 06/12/2025
9.0.5 54 05/16/2025
9.0.4 51 04/19/2025
9.0.3 55 03/18/2025
9.0.2 85 02/21/2025
9.0.1 65 01/17/2025
9.0.0 50 11/14/2024
9.0.0-rc.2.24474.3 49 11/28/2024
9.0.0-rc.1.24452.1 51 12/03/2024
9.0.0-preview.7.24406.2 57 11/23/2024
9.0.0-preview.6.24328.4 44 11/23/2024
9.0.0-preview.5.24306.11 51 12/02/2024
9.0.0-preview.4.24267.6 52 05/25/2024
9.0.0-preview.3.24172.13 56 05/10/2024
9.0.0-preview.2.24128.4 51 04/23/2024
9.0.0-preview.1.24081.5 57 04/24/2024
8.0.22 41 11/13/2025
8.0.21 36 10/15/2025
8.0.20 36 09/11/2025
8.0.19 42 08/06/2025
8.0.18 42 07/10/2025
8.0.17 45 06/12/2025
8.0.16 43 05/16/2025
8.0.15 51 04/19/2025
8.0.14 53 03/18/2025
8.0.13 53 02/18/2025
8.0.12 55 01/17/2025
8.0.11 55 11/14/2024
8.0.10 58 11/04/2024
8.0.8 63 12/02/2024
8.0.7 55 11/29/2024
8.0.6 54 11/29/2024
8.0.5 56 05/31/2024
8.0.4 57 05/03/2024
8.0.3 65 05/10/2024
8.0.2 61 04/29/2024
8.0.1 56 05/31/2024
8.0.0 66 12/18/2023
8.0.0-rc.2.23480.2 59 05/07/2024
8.0.0-rc.1.23421.29 53 05/16/2024
8.0.0-preview.7.23375.9 55 05/31/2024
8.0.0-preview.6.23329.11 68 05/31/2024
8.0.0-preview.5.23302.2 44 05/31/2024
8.0.0-preview.4.23260.4 52 05/10/2024
8.0.0-preview.3.23177.8 54 04/23/2023
8.0.0-preview.2.23153.2 52 05/31/2024
8.0.0-preview.1.23112.2 52 04/22/2024
7.0.20 56 11/18/2024
7.0.19 62 05/14/2024
7.0.18 64 04/24/2024
7.0.17 53 05/10/2024
7.0.16 54 05/05/2024
7.0.15 56 05/06/2024
7.0.14 65 05/10/2024
7.0.13 62 05/31/2024
7.0.12 56 05/08/2024
7.0.11 61 05/02/2024
7.0.10 62 05/10/2024
7.0.9 64 05/31/2024
7.0.8 58 05/20/2024
7.0.7 48 12/18/2023
7.0.5 55 05/31/2024
7.0.4 53 05/06/2024
7.0.3 56 07/13/2023
7.0.2 54 05/07/2024
7.0.1 63 04/26/2024
7.0.0 52 05/31/2024
7.0.0-rc.2.22476.2 55 05/31/2024
7.0.0-rc.1.22427.2 47 05/31/2024
7.0.0-preview.7.22376.6 53 11/23/2024
7.0.0-preview.6.22330.3 47 05/31/2024
7.0.0-preview.5.22303.8 52 05/31/2024
7.0.0-preview.4.22251.1 50 05/25/2024
6.0.36 65 11/18/2024
6.0.35 52 11/14/2024
6.0.33 64 12/01/2024
6.0.32 52 12/05/2024
6.0.31 49 12/03/2024
6.0.30 57 05/14/2024
6.0.29 57 05/10/2024
6.0.28 56 05/07/2024
6.0.27 65 05/10/2024
6.0.26 57 05/31/2024
6.0.25 53 05/10/2024
6.0.24 57 05/01/2024
6.0.23 70 05/03/2024
6.0.22 59 05/02/2024
6.0.21 65 05/10/2024
6.0.20 54 12/02/2024
6.0.19 65 05/16/2024
6.0.18 58 04/24/2024
6.0.16 56 05/01/2024
6.0.15 49 12/03/2024
6.0.14 59 05/31/2024
6.0.13 54 05/03/2024
6.0.12 71 05/07/2023
6.0.11 55 05/05/2024
6.0.10 58 05/01/2024
6.0.9 56 05/06/2024
6.0.8 48 04/26/2024
6.0.7 56 05/31/2024
6.0.6 62 03/22/2023
6.0.5 51 05/31/2024
6.0.0-preview.6.21355.2 57 05/25/2024
5.0.17 60 07/13/2023
5.0.12 70 05/10/2022
5.0.9 47 04/23/2024
5.0.0-rc.1.20451.17 52 05/25/2024
3.1.32 60 04/23/2023
3.1.31 64 05/31/2024
3.1.30 49 10/25/2022
3.1.29 64 04/22/2024
3.1.28 53 05/07/2024
3.1.27 65 05/18/2024
3.1.26 54 04/23/2024
3.1.25 60 05/25/2024
3.1.8 58 05/31/2024
3.1.0 56 05/05/2024
3.0.0 57 02/04/2024
3.0.0-rc1.19457.4 51 05/31/2024
2.3.0 50 01/28/2025
2.1.2 67 05/10/2022
2.0.0-preview2-final 54 05/10/2024
1.0.5 52 05/14/2024