CodedByKay.BondBridge.JwtAuth
1.0.5-alpha
dotnet add package CodedByKay.BondBridge.JwtAuth --version 1.0.5-alpha
NuGet\Install-Package CodedByKay.BondBridge.JwtAuth -Version 1.0.5-alpha
<PackageReference Include="CodedByKay.BondBridge.JwtAuth" Version="1.0.5-alpha" />
paket add CodedByKay.BondBridge.JwtAuth --version 1.0.5-alpha
#r "nuget: CodedByKay.BondBridge.JwtAuth, 1.0.5-alpha"
// Install CodedByKay.BondBridge.JwtAuth as a Cake Addin #addin nuget:?package=CodedByKay.BondBridge.JwtAuth&version=1.0.5-alpha&prerelease // Install CodedByKay.BondBridge.JwtAuth as a Cake Tool #tool nuget:?package=CodedByKay.BondBridge.JwtAuth&version=1.0.5-alpha&prerelease
JwtAuthExtension Class Library
Overview
The JwtAuthExtension
class library provides a straightforward and efficient way to integrate JWT (JSON Web Token) authentication into ASP.NET Core applications. It simplifies the process of configuring authentication and authorization mechanisms, focusing on token validation, issuer, and audience verification.
Features
- Easy integration with ASP.NET Core services.
- Configures JWT authentication with minimal setup.
- Supports token validation parameters including issuer signing key, issuer, audience, and token lifetime.
- Facilitates authorization policy definitions for different user roles.
Getting Started
Prerequisites
- .NET Core SDK (version 3.1 or later)
- An ASP.NET Core project
Installation
- Ensure your project file (.csproj) is properly configured to generate a NuGet package.
- Use the
dotnet pack
command to create a NuGet package from your class library. - Add the generated NuGet package to your ASP.NET Core project.
Usage
To use the JwtAuthExtension
in your project, follow these steps:
- In your
Startup.cs
, import the namespace:
using CodedByKay.BondBridge.JwtAuth.JwtAuthExtension;
Call the AddJwtAuthentication extension method within the ConfigureServices method of your Startup.cs, passing the necessary parameters:
public void ConfigureServices(IServiceCollection services)
{
services.AddJwtAuthentication(secretKey: "YourSecretKey", issuer: "YourIssuer", audience: "YourAudience");
}
Configuration
Customize your JWT authentication by modifying the parameters passed to AddJwtAuthentication:
secretKey
: Your secret key for signing tokens.issuer
: The issuer of the token.audience
: The audience of the token.
Contributing
Contributions to the JwtAuthExtension library are welcome. Please follow the standard fork-and-pull request workflow.
License Specify your license here. Common licenses for open-source projects include MIT, GPL, and Apache 2.0.
Contact For support or to contact the maintainers, please provide contact details or link to the project's issues page.
Pack the library like this
dotnet pack -c Release -o ./nuget
Remember to replace placeholder texts like "YourNamespace", "YourSecretKey", "YourIssuer", and "YourAudience" with the actual values specific to your project. Also, decide on a license that fits your project's needs and include it in the README.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 8.0.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.IdentityModel.Tokens (>= 7.3.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.5-alpha | 74 | 2/24/2024 |
1.0.4-alpha | 55 | 2/24/2024 |
1.0.3-alpha | 53 | 2/24/2024 |
1.0.2-alpha | 63 | 2/24/2024 |
1.0.1-alpha | 67 | 2/24/2024 |
1.0.0-alpha | 55 | 2/24/2024 |