Microsoft.AspNetCore.Authentication.JwtBearer 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.

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

Packages Downloads
SanedBuildingBlocks
This package built for OIG-Saned
3,440
SanedBuildingBlocks
This package built for OIG-Saned
2,437
SanedBuildingBlocks
This package built for OIG-Saned
915
SanedBuildingBlocks
This package built for OIG-Saned
837
SanedBuildingBlocks
This package built for OIG-Saned
762
SanedBuildingBlocks
This package built for OIG-Saned
650
SanedBuildingBlocks
This package built for OIG-Saned
458
SanedBuildingBlocks
This package built for OIG-Saned
426
SanedBuildingBlocks
This package built for OIG-Saned
280
SanedBuildingBlocks
This package built for OIG-Saned
272
SanedBuildingBlocks
This package built for OIG-Saned
234
SanedBuildingBlocks
This package built for OIG-Saned
231
SanedBuildingBlocks
This package built for OIG-Saned
195
SanedBuildingBlocks
This package built for OIG-Saned
189
SanedBuildingBlocks
This package built for OIG-Saned
187
SanedBuildingBlocks
This package built for OIG-Saned
185
SanedBuildingBlocks
This package built for OIG-Saned
130
SanedBuildingBlocks
This package built for OIG-Saned
124
SanedBuildingBlocks
This package built for OIG-Saned
120
SanedBuildingBlocks
This package built for OIG-Saned
118

Version Downloads Last updated
9.0.0 18 12/01/2024
8.0.13 16 02/18/2025
8.0.12 16 02/18/2025
8.0.11 17 12/01/2024
8.0.10 16 02/18/2025
8.0.8 17 10/02/2024
8.0.3 16 03/16/2024
8.0.0 16 02/18/2025
7.0.20 16 02/18/2025
7.0.19 17 02/18/2025
7.0.18 16 02/18/2025
7.0.17 16 02/18/2025
7.0.16 16 02/18/2025
7.0.15 17 02/18/2025
7.0.14 17 12/31/2023
7.0.13 16 02/18/2025
7.0.12 16 02/18/2025
7.0.11 17 09/22/2023
7.0.10 17 09/29/2023
7.0.8 16 06/22/2023
7.0.7 15 02/18/2025
7.0.4 16 08/26/2023
7.0.1 17 10/07/2023
7.0.0 17 06/26/2023
6.0.36 16 02/18/2025
6.0.35 16 02/18/2025
6.0.33 16 02/18/2025
6.0.32 16 02/18/2025
6.0.31 16 02/18/2025
6.0.30 16 02/18/2025
6.0.29 16 02/18/2025
6.0.28 16 02/18/2025
6.0.27 16 02/18/2025
6.0.26 16 02/18/2025
6.0.25 16 02/18/2025
6.0.24 17 02/18/2025
6.0.23 17 02/18/2025
6.0.22 16 02/18/2025
6.0.21 16 02/18/2025
6.0.20 16 02/18/2025
6.0.19 16 02/18/2025
6.0.18 16 02/18/2025
6.0.16 16 02/18/2025
6.0.15 16 02/18/2025
6.0.14 17 02/18/2025
6.0.13 16 02/18/2025
6.0.12 16 02/18/2025
6.0.11 16 02/18/2025
6.0.10 17 09/05/2023
6.0.7 16 06/19/2023
6.0.6 16 02/18/2025
6.0.0 18 06/19/2023
5.0.17 17 10/02/2023
5.0.16 16 02/18/2025
5.0.15 16 02/18/2025
5.0.14 16 02/18/2025
5.0.13 16 02/18/2025
5.0.12 16 02/18/2025
5.0.11 17 02/18/2025
5.0.10 17 06/16/2023
5.0.5 16 02/18/2025
5.0.0 17 02/18/2025
3.1.32 16 02/18/2025
3.1.31 16 02/18/2025
3.1.30 16 02/18/2025
3.1.29 16 02/18/2025
3.1.28 16 02/18/2025
3.1.27 16 02/18/2025
3.1.26 16 02/18/2025
3.1.25 16 02/18/2025
3.1.24 16 02/18/2025
3.1.23 16 02/18/2025
3.1.22 16 02/18/2025
3.1.21 16 02/18/2025
3.1.20 16 02/18/2025
3.1.19 16 02/18/2025
3.1.18 16 02/18/2025
3.1.17 16 02/18/2025
3.1.16 16 02/18/2025
3.1.15 16 02/18/2025
3.1.14 16 02/18/2025
3.1.13 16 02/18/2025
3.1.12 16 02/18/2025
3.1.11 16 02/18/2025
3.1.10 16 02/18/2025
3.1.5 16 08/16/2023
3.1.3 16 02/18/2025
3.1.1 16 02/18/2025
3.0.3 15 02/18/2025
3.0.0 16 02/18/2025
2.2.0 16 02/18/2025
2.2.0-preview2-35157 17 02/18/2025
2.2.0-preview1-35029 17 02/18/2025
2.1.30 16 02/18/2025
2.1.2 16 02/18/2025
2.1.1 17 01/14/2024
2.1.0-rc1-final 16 02/18/2025
2.1.0-preview2-final 16 02/18/2025
2.1.0-preview1-final 16 02/18/2025
2.0.0 16 02/18/2025
2.0.0-preview2-final 16 02/18/2025
2.0.0-preview1-final 16 02/18/2025
1.1.3 16 02/18/2025
1.1.2 14 02/18/2025
1.1.1 17 02/18/2025
1.1.0 16 02/18/2025
1.1.0-preview1-final 17 02/18/2025
1.0.1 17 02/18/2025
1.0.0 16 02/18/2025
1.0.0-rc2-final 16 02/18/2025