Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 1.3 KB

README.md

File metadata and controls

55 lines (40 loc) · 1.3 KB

JwtProducer

Easy jwt implementation

Current Packages

Nuget version Nuget downloads Build & Test Main

HOW TO USE

Copy to appsettings.json and configure the parameters

"JwtOption": {
    "SaveToken": true, // true or false
    "ValidateIssuer": false, // true or false
    "ValidateAudience": false, // true or false
    "ValidateLifetime": true, // true or false
    "Issuer": null, // string
    "Audience": null, // string
    "SigningKey": "You should be write here your security key!" // string
  }

Add to program.cs

builder.Services.AddJwtProducer(builder.Configuration);
app.UseAuthentication();
app.UseAuthorization();

Usage

    [Route("api/[controller]")]
    [ApiController]
    public class AuthController : ControllerBase
    {
        private readonly IJwtBuilder _jwtBuilder;
        public AuthController(IJwtBuilder jwtBuilder)
        {
            _jwtBuilder = jwtBuilder;
        }
    }