Microsoft.AspNetCore.Authentication.JwtBearer
9.0.0
Prefix Reserved
dotnet add package Microsoft.AspNetCore.Authentication.JwtBearer --version 9.0.0
NuGet\Install-Package Microsoft.AspNetCore.Authentication.JwtBearer -Version 9.0.0
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.0" />
paket add Microsoft.AspNetCore.Authentication.JwtBearer --version 9.0.0
#r "nuget: Microsoft.AspNetCore.Authentication.JwtBearer, 9.0.0"
// Install Microsoft.AspNetCore.Authentication.JwtBearer as a Cake Addin #addin nuget:?package=Microsoft.AspNetCore.Authentication.JwtBearer&version=9.0.0 // Install Microsoft.AspNetCore.Authentication.JwtBearer as a Cake Tool #tool nuget:?package=Microsoft.AspNetCore.Authentication.JwtBearer&version=9.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.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. |
-
net9.0
NuGet packages (2.6K)
Showing the top 5 NuGet packages that depend on Microsoft.AspNetCore.Authentication.JwtBearer:
Package | Downloads |
---|---|
IdentityServer4.AccessTokenValidation
ASP.NET Core authentication handler to validate JWT and reference tokens from IdentityServer4 |
|
Microsoft.Identity.Web.TokenAcquisition
Implementation for higher level API for confidential client applications (ASP.NET Core and SDK/.NET). |
|
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. |
|
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. |
|
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. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/ab1f1c636afa3a6607f2d67bc387b586596d1d38 |
GitHub repositories (420)
Showing the top 5 popular GitHub repositories that depend on Microsoft.AspNetCore.Authentication.JwtBearer:
Repository | Stars |
---|---|
bitwarden/server
Bitwarden infrastructure/backend (API, database, Docker, etc).
|
|
abpframework/abp
Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
|
|
dotnet/AspNetCore.Docs
Documentation for ASP.NET Core
|
|
duplicati/duplicati
Store securely encrypted backups in the cloud!
|
|
dotnet-architecture/eShopOnWeb
Sample ASP.NET Core 8.0 reference application, powered by Microsoft, demonstrating a layered application architecture with monolithic deployment model. Download the eBook PDF from docs folder.
|
Version | Downloads | Last updated | |
---|---|---|---|
9.0.0 | 19,346 | 11/12/2024 | |
9.0.0-rc.2.24474.3 | 35,758 | 10/8/2024 | |
9.0.0-rc.1.24452.1 | 31,655 | 9/10/2024 | |
9.0.0-preview.7.24406.2 | 8,150 | 8/13/2024 | |
9.0.0-preview.6.24328.4 | 26,080 | 7/9/2024 | |
9.0.0-preview.5.24306.11 | 5,688 | 6/11/2024 | |
9.0.0-preview.4.24267.6 | 11,466 | 5/21/2024 | |
9.0.0-preview.3.24172.13 | 79,570 | 4/11/2024 | |
9.0.0-preview.2.24128.4 | 25,649 | 3/12/2024 | |
9.0.0-preview.1.24081.5 | 25,924 | 2/13/2024 | |
8.0.11 | 31,670 | 11/12/2024 | |
8.0.10 | 2,766,463 | 10/8/2024 | |
8.0.8 | 6,764,602 | 8/13/2024 | |
8.0.7 | 5,566,327 | 7/9/2024 | |
8.0.6 | 7,025,674 | 5/28/2024 | |
8.0.5 | 2,640,255 | 5/14/2024 | |
8.0.4 | 6,623,838 | 4/9/2024 | |
8.0.3 | 4,824,437 | 3/12/2024 | |
8.0.2 | 5,682,526 | 2/13/2024 | |
8.0.1 | 6,963,308 | 1/9/2024 | |
8.0.0 | 20,687,809 | 11/14/2023 | |
8.0.0-rc.2.23480.2 | 397,015 | 10/10/2023 | |
8.0.0-rc.1.23421.29 | 92,263 | 9/12/2023 | |
8.0.0-preview.7.23375.9 | 172,683 | 8/8/2023 | |
8.0.0-preview.6.23329.11 | 61,194 | 7/11/2023 | |
8.0.0-preview.5.23302.2 | 11,257 | 6/13/2023 | |
8.0.0-preview.4.23260.4 | 10,219 | 5/16/2023 | |
8.0.0-preview.3.23177.8 | 16,468 | 4/11/2023 | |
8.0.0-preview.2.23153.2 | 7,876 | 3/14/2023 | |
8.0.0-preview.1.23112.2 | 59,197 | 2/21/2023 | |
7.0.20 | 661,108 | 5/28/2024 | |
7.0.19 | 102,079 | 5/14/2024 | |
7.0.18 | 327,385 | 4/9/2024 | |
7.0.17 | 353,002 | 3/12/2024 | |
7.0.16 | 573,461 | 2/13/2024 | |
7.0.15 | 1,009,107 | 1/9/2024 | |
7.0.14 | 2,048,961 | 11/14/2023 | |
7.0.13 | 2,374,219 | 10/24/2023 | |
7.0.12 | 1,776,689 | 10/10/2023 | |
7.0.11 | 2,596,770 | 9/12/2023 | |
7.0.10 | 3,643,887 | 8/8/2023 | |
7.0.9 | 2,665,430 | 7/11/2023 | |
7.0.8 | 2,249,743 | 6/22/2023 | |
7.0.7 | 1,184,149 | 6/13/2023 | |
7.0.5 | 6,941,511 | 4/11/2023 | |
7.0.4 | 3,445,876 | 3/14/2023 | |
7.0.3 | 3,309,301 | 2/14/2023 | |
7.0.2 | 4,130,059 | 1/10/2023 | |
7.0.1 | 8,715,472 | 12/13/2022 | |
7.0.0 | 5,054,544 | 11/7/2022 | |
7.0.0-rc.2.22476.2 | 84,123 | 10/11/2022 | |
7.0.0-rc.1.22427.2 | 23,479 | 9/14/2022 | |
7.0.0-preview.7.22376.6 | 23,140 | 8/9/2022 | |
7.0.0-preview.6.22330.3 | 216,471 | 7/12/2022 | |
7.0.0-preview.5.22303.8 | 6,100 | 6/14/2022 | |
7.0.0-preview.4.22251.1 | 10,357 | 5/10/2022 | |
7.0.0-preview.3.22178.4 | 4,356 | 4/13/2022 | |
7.0.0-preview.2.22153.2 | 3,867 | 3/14/2022 | |
7.0.0-preview.1.22109.13 | 3,310 | 2/17/2022 | |
6.0.36 | 5,120 | 11/12/2024 | |
6.0.35 | 145,618 | 10/8/2024 | |
6.0.33 | 567,219 | 8/13/2024 | |
6.0.32 | 509,061 | 7/9/2024 | |
6.0.31 | 698,370 | 5/28/2024 | |
6.0.30 | 345,873 | 5/14/2024 | |
6.0.29 | 1,100,349 | 4/9/2024 | |
6.0.28 | 1,001,416 | 3/12/2024 | |
6.0.27 | 1,281,774 | 2/13/2024 | |
6.0.26 | 2,453,296 | 1/9/2024 | |
6.0.25 | 3,251,485 | 11/14/2023 | |
6.0.24 | 1,971,555 | 10/24/2023 | |
6.0.23 | 977,345 | 10/10/2023 | |
6.0.22 | 1,823,425 | 9/12/2023 | |
6.0.21 | 2,602,988 | 8/8/2023 | |
6.0.20 | 2,463,093 | 7/11/2023 | |
6.0.19 | 1,624,269 | 6/22/2023 | |
6.0.18 | 822,553 | 6/13/2023 | |
6.0.16 | 6,708,647 | 4/11/2023 | |
6.0.15 | 4,046,989 | 3/14/2023 | |
6.0.14 | 4,410,444 | 2/14/2023 | |
6.0.13 | 6,978,805 | 1/10/2023 | |
6.0.12 | 10,362,329 | 12/13/2022 | |
6.0.11 | 7,416,882 | 11/7/2022 | |
6.0.10 | 11,451,297 | 10/11/2022 | |
6.0.9 | 8,698,557 | 9/13/2022 | |
6.0.8 | 10,882,304 | 8/9/2022 | |
6.0.7 | 8,787,968 | 7/12/2022 | |
6.0.6 | 7,118,164 | 6/14/2022 | |
6.0.5 | 10,114,995 | 5/10/2022 | |
6.0.4 | 7,978,634 | 4/11/2022 | |
6.0.3 | 9,381,901 | 3/8/2022 | |
6.0.2 | 7,320,924 | 2/8/2022 | |
6.0.1 | 12,523,501 | 12/14/2021 | |
6.0.0 | 12,457,921 | 11/8/2021 | |
6.0.0-rc.2.21480.10 | 74,755 | 10/12/2021 | |
6.0.0-rc.1.21452.15 | 59,413 | 9/14/2021 | |
6.0.0-preview.7.21378.6 | 65,185 | 8/10/2021 | |
6.0.0-preview.6.21355.2 | 19,044 | 7/14/2021 | |
6.0.0-preview.5.21301.17 | 11,519 | 6/15/2021 | |
6.0.0-preview.4.21253.5 | 9,808 | 5/24/2021 | |
6.0.0-preview.3.21201.13 | 13,510 | 4/8/2021 | |
6.0.0-preview.2.21154.6 | 3,888 | 3/11/2021 | |
6.0.0-preview.1.21103.6 | 6,338 | 2/12/2021 | |
5.0.17 | 2,602,586 | 5/10/2022 | |
5.0.16 | 641,271 | 4/11/2022 | |
5.0.15 | 998,354 | 3/8/2022 | |
5.0.14 | 938,747 | 2/8/2022 | |
5.0.13 | 2,496,284 | 12/14/2021 | |
5.0.12 | 20,137,643 | 11/7/2021 | |
5.0.11 | 3,843,308 | 10/12/2021 | |
5.0.10 | 3,875,992 | 9/14/2021 | |
5.0.9 | 7,340,814 | 8/10/2021 | |
5.0.8 | 2,866,344 | 7/13/2021 | |
5.0.7 | 4,116,300 | 6/8/2021 | |
5.0.6 | 2,926,562 | 5/11/2021 | |
5.0.5 | 4,139,761 | 4/6/2021 | |
5.0.4 | 2,949,109 | 3/9/2021 | |
5.0.3 | 3,125,170 | 2/9/2021 | |
5.0.2 | 2,796,549 | 1/12/2021 | |
5.0.1 | 3,151,791 | 12/8/2020 | |
5.0.0 | 10,766,774 | 11/9/2020 | |
5.0.0-rc.2.20475.17 | 105,934 | 10/13/2020 | |
5.0.0-rc.1.20451.17 | 269,427 | 9/14/2020 | |
5.0.0-preview.8.20414.8 | 1,095,968 | 8/25/2020 | |
5.0.0-preview.7.20365.19 | 16,595 | 7/21/2020 | |
5.0.0-preview.6.20312.15 | 20,490 | 6/25/2020 | |
5.0.0-preview.5.20279.2 | 3,435 | 6/10/2020 | |
5.0.0-preview.4.20257.10 | 4,280 | 5/18/2020 | |
5.0.0-preview.3.20215.14 | 4,386 | 4/23/2020 | |
5.0.0-preview.2.20167.3 | 3,456 | 4/2/2020 | |
5.0.0-preview.1.20124.5 | 5,478 | 3/16/2020 | |
3.1.32 | 2,014,922 | 12/13/2022 | |
3.1.31 | 257,059 | 11/8/2022 | |
3.1.30 | 204,539 | 10/11/2022 | |
3.1.29 | 246,174 | 9/13/2022 | |
3.1.28 | 2,005,330 | 8/9/2022 | |
3.1.27 | 352,307 | 7/12/2022 | |
3.1.26 | 340,402 | 6/14/2022 | |
3.1.25 | 628,947 | 5/10/2022 | |
3.1.24 | 452,673 | 4/11/2022 | |
3.1.23 | 1,910,014 | 3/8/2022 | |
3.1.22 | 3,024,166 | 12/14/2021 | |
3.1.21 | 2,191,929 | 11/7/2021 | |
3.1.20 | 975,355 | 10/11/2021 | |
3.1.19 | 1,215,965 | 9/14/2021 | |
3.1.18 | 7,710,617 | 8/10/2021 | |
3.1.17 | 1,086,503 | 7/13/2021 | |
3.1.16 | 2,142,612 | 6/8/2021 | |
3.1.15 | 1,583,291 | 5/11/2021 | |
3.1.14 | 2,022,422 | 4/6/2021 | |
3.1.13 | 2,332,689 | 3/9/2021 | |
3.1.12 | 2,109,553 | 2/9/2021 | |
3.1.11 | 3,451,551 | 1/12/2021 | |
3.1.10 | 5,607,465 | 11/9/2020 | |
3.1.9 | 6,136,582 | 10/13/2020 | |
3.1.8 | 10,495,490 | 9/8/2020 | |
3.1.7 | 4,682,278 | 8/11/2020 | |
3.1.6 | 5,493,494 | 7/14/2020 | |
3.1.5 | 7,849,690 | 6/9/2020 | |
3.1.4 | 7,163,404 | 5/12/2020 | |
3.1.3 | 9,449,152 | 3/24/2020 | |
3.1.2 | 7,077,378 | 2/18/2020 | |
3.1.1 | 9,417,039 | 1/14/2020 | |
3.1.0 | 7,206,109 | 12/3/2019 | |
3.1.0-preview3.19555.2 | 13,570 | 11/13/2019 | |
3.1.0-preview2.19528.8 | 3,363 | 11/1/2019 | |
3.1.0-preview1.19508.20 | 7,335 | 10/15/2019 | |
3.0.3 | 670,652 | 2/18/2020 | |
3.0.2 | 285,702 | 1/14/2020 | |
3.0.0 | 38,798,783 | 9/23/2019 | |
3.0.0-rc1.19457.4 | 24,965 | 9/16/2019 | |
3.0.0-preview9.19424.4 | 146,805 | 9/4/2019 | |
3.0.0-preview8.19405.7 | 27,847 | 8/13/2019 | |
3.0.0-preview7.19365.7 | 40,094 | 7/23/2019 | |
3.0.0-preview6.19307.2 | 36,433 | 6/12/2019 | |
3.0.0-preview5-19227-01 | 23,998 | 5/6/2019 | |
3.0.0-preview4-19216-03 | 6,977 | 4/18/2019 | |
3.0.0-preview3-19153-02 | 7,720 | 3/6/2019 | |
3.0.0-preview-19075-0444 | 12,274 | 1/29/2019 | |
2.2.0 | 28,205,292 | 12/3/2018 | |
2.2.0-preview3-35497 | 71,396 | 10/17/2018 | |
2.2.0-preview2-35157 | 35,935 | 9/12/2018 | |
2.2.0-preview1-35029 | 8,882 | 8/22/2018 | |
2.1.30 | 947,417 | 8/19/2021 | |
2.1.2 | 17,448,266 | 8/21/2018 | |
2.1.1 | 11,581,485 | 6/18/2018 | |
2.1.0 | 14,935,020 | 5/29/2018 | |
2.1.0-rc1-final | 40,914 | 5/6/2018 | |
2.1.0-preview2-final | 38,711 | 4/10/2018 | |
2.1.0-preview1-final | 53,733 | 2/26/2018 | |
2.0.4 | 4,527,435 | 5/7/2018 | |
2.0.3 | 4,157,920 | 3/13/2018 | |
2.0.1 | 7,428,673 | 11/14/2017 | |
2.0.0 | 12,089,982 | 8/11/2017 | |
2.0.0-preview2-final | 55,741 | 6/27/2017 | |
2.0.0-preview1-final | 17,749 | 5/10/2017 | |
1.1.3 | 469,603 | 9/20/2017 | |
1.1.2 | 1,249,037 | 5/9/2017 | |
1.1.1 | 472,153 | 3/6/2017 | |
1.1.0 | 396,242 | 11/16/2016 | |
1.1.0-preview1-final | 6,516 | 10/24/2016 | |
1.0.5 | 12,460 | 11/14/2017 | |
1.0.4 | 6,488 | 9/20/2017 | |
1.0.3 | 18,077 | 5/9/2017 | |
1.0.2 | 115,678 | 3/6/2017 | |
1.0.1 | 21,760 | 12/12/2016 | |
1.0.0 | 713,711 | 6/27/2016 | |
1.0.0-rc2-final | 19,513 | 5/16/2016 |