Raycynix.Extensions.Security.AspNetCore 1.0.0

dotnet add package Raycynix.Extensions.Security.AspNetCore --version 1.0.0
                    
NuGet\Install-Package Raycynix.Extensions.Security.AspNetCore -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Raycynix.Extensions.Security.AspNetCore" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Raycynix.Extensions.Security.AspNetCore" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Raycynix.Extensions.Security.AspNetCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Raycynix.Extensions.Security.AspNetCore --version 1.0.0
                    
#r "nuget: Raycynix.Extensions.Security.AspNetCore, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Raycynix.Extensions.Security.AspNetCore@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Raycynix.Extensions.Security.AspNetCore&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Raycynix.Extensions.Security.AspNetCore&version=1.0.0
                    
Install as a Cake Tool

Raycynix.Extensions.Security.AspNetCore

Raycynix.Extensions.Security.AspNetCore adds ASP.NET Core JWT authentication, dynamic authorization policies, and shared authorization-attribute integration for Raycynix security.

What it contains

  • AddRaycynixAspNetCoreSecurity(...)
  • UseRaycynixSecurity(this IApplicationBuilder app)
  • per-request ClaimsPrincipal to ISecurityContext mapping
  • dynamic API policies for authenticated, permission:*, role:*, and subject:*
  • MVC convention support for shared security attributes from Raycynix.Extensions.Security.Abstractions
  • endpoint-builder helpers through RequireRaycynixAuthorization(...)
  • consistent 401 Unauthorized and 403 Forbidden JSON responses

Usage

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRaycynixAspNetCoreSecurity(builder.Configuration, options =>
{
    options.Jwt.Authority = "https://auth.raycynix.com";
    options.Jwt.Issuer = "raycynix-auth";
    options.Jwt.Audience = "raycynix-services";
});

var app = builder.Build();

app.UseRaycynixSecurity();

app.Run();
{
  "SecurityConfiguration": {
    "Jwt": {
      "Authority": "https://auth.raycynix.com",
      "Issuer": "raycynix-auth",
      "Audience": "raycynix-services",
      "RequireHttpsMetadata": true
    }
  }
}

Use authorization policies with standard names:

using Raycynix.Extensions.Security.AspNetCore.Authorization;

[Authorize(Policy = SecurityPolicies.Permission("users.read"))]
[Authorize(Policy = SecurityPolicies.AnyPermission("users.read", "users.write"))]
[Authorize(Policy = SecurityPolicies.AllPermissions("users.read", "users.export"))]
[Authorize(Policy = SecurityPolicies.Role("admin"))]
[Authorize(Policy = SecurityPolicies.AnyRole("admin", "support"))]
[Authorize(Policy = SecurityPolicies.AllRoles("manager", "auditor"))]
[Authorize(Policy = SecurityPolicies.Authenticated)]
[Authorize(Policy = SecurityPolicies.ServiceOnly)]

Or use the shared security attributes and let the package translate them into standard ASP.NET Core authorization policies:

using Raycynix.Extensions.Security.Abstractions.Attributes;

[RequireAuthenticatedSubject]
[RequireSubjectType(SecuritySubjectType.Service)]
[RequirePermission("users.read")]
public sealed class UsersController : ControllerBase
{
}

For minimal APIs or endpoint builders, use the helper extension:

app.MapGet("/users/{id}", HandleUserAsync)
    .RequireRaycynixAuthorization(
        new RequireAuthenticatedSubjectAttribute(),
        new RequirePermissionAttribute("users.read"));

The package expects JWT access tokens with:

  • sub
  • subject_type
  • roles
  • permissions

subject_type is mapped to SecuritySubjectType, allowing both User and Service request subjects to use the same ISecurityContext.

Authentication and authorization failures return safe JSON responses without exposing internal policy details.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0 31 4/8/2026
0.3.0 33 4/8/2026

See the repository changelog and release history for package-specific changes and breaking updates.