NowAround.SharedKernel.Api.Authentication 0.1.0

NowAround.SharedKernel.Api.Authentication

Shared JWT bearer authentication setup for NowAround internal service APIs.

Features

  • Binds and validates NowAroundJwtOptions from configuration.
  • Registers ASP.NET Core JWT bearer authentication.
  • Configures issuer, audience, signing key, lifetime validation, role claim, and subject claim mapping.
  • Optional JWT event logging for troubleshooting authentication failures and challenges.

Installation

dotnet add package NowAround.SharedKernel.Api.Authentication

Configuration

The default configuration section name is InternalJwt.

{
  "InternalJwt": {
    "Issuer": "nowaround",
    "Audience": "nowaround-internal-services",
    "SigningKey": "replace-with-a-long-secret",
    "LogEvents": false,
    "AccessTokenLifetimeMinutes": 60
  }
}

Issuer, Audience, and SigningKey are required. Options are validated on application startup.

Usage

Register authentication with the configuration section:

using NowAround.SharedKernel.Api.Authentication;
using NowAround.SharedKernel.Api.Authentication.Options;

builder.Services.AddNowAroundAuthentication(NowAroundJwtOptions.SectionName);

Enable authentication and authorization in the request pipeline:

app.UseAuthentication();
app.UseAuthorization();

Options

NowAroundJwtOptions:

  • Issuer: expected token issuer.
  • Audience: expected token audience.
  • SigningKey: symmetric signing key used to validate tokens.
  • LogEvents: enables JWT debug logging for failed authentication, successful validation, and challenges.
  • AccessTokenLifetimeMinutes: shared token lifetime setting for callers that also generate internal tokens.

The bearer configuration uses ClaimTypes.Role for roles and sub for the name claim.

Showing the top 20 packages that depend on NowAround.SharedKernel.Api.Authentication.

Packages Downloads
NowAround.Identity.Client
Package Description
11
NowAround.Area.Client
Typed HTTP client for the NowAround Area API.
11
NowAround.Identity.Client
Typed Refit client and service registrations for the NowAround Identity service.
8
NowAround.Area.Client
Typed HTTP client for the NowAround Area API.
8
NowAround.Identity.Client
Typed Refit client and service registrations for the NowAround Identity service.
7
NowAround.Identity.Client
Typed Refit client and service registrations for the NowAround Identity service.
6
NowAround.Area.Client
Typed HTTP client for the NowAround Area API.
6
NowAround.Identity.Client
Typed Refit client and service registrations for the NowAround Identity service.
5
NowAround.Area.Client
Typed HTTP client for the NowAround Area API.
4
NowAround.Identity.Client
Typed Refit client and service registrations for the NowAround Identity service.
3
NowAround.Area.Client
Typed HTTP client for the NowAround Area API.
3
NowAround.Identity.Client
Typed Refit client and service registrations for the NowAround Identity service.
2
NowAround.Identity.Client
Typed Refit client and service registrations for the NowAround Identity service.
1

Version Downloads Last updated
0.3.0 30 06/03/2026
0.2.1-ci.254 3 06/01/2026
0.2.0 11 06/01/2026
0.2.0-ci.235 5 05/30/2026
0.2.0-ci.218 11 05/26/2026
0.1.1-ci.214 2 05/23/2026
0.1.0 15 05/19/2026
0.0.1 21 05/15/2026