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,378
SanedBuildingBlocks
This package built for OIG-Saned
2,351
SanedBuildingBlocks
This package built for OIG-Saned
908
SanedBuildingBlocks
This package built for OIG-Saned
831
SanedBuildingBlocks
This package built for OIG-Saned
740
SanedBuildingBlocks
This package built for OIG-Saned
643
SanedBuildingBlocks
This package built for OIG-Saned
449
SanedBuildingBlocks
This package built for OIG-Saned
419
SanedBuildingBlocks
This package built for OIG-Saned
274
SanedBuildingBlocks
This package built for OIG-Saned
266
SanedBuildingBlocks
This package built for OIG-Saned
189
SanedBuildingBlocks
This package built for OIG-Saned
184
SanedBuildingBlocks
This package built for OIG-Saned
182
SanedBuildingBlocks
This package built for OIG-Saned
123
SanedBuildingBlocks
This package built for OIG-Saned
118
SanedBuildingBlocks
This package built for OIG-Saned
115
SanedBuildingBlocks
This package built for OIG-Saned
112
SanedBuildingBlocks
This package built for OIG-Saned
108
SanedBuildingBlocks
This package built for OIG-Saned
101
SanedBuildingBlocks
This package built for OIG-Saned
92

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