DioRed.Aith.AspNetCore 1.0.0-preview.9

This is a prerelease version of DioRed.Aith.AspNetCore.
dotnet add package DioRed.Aith.AspNetCore --version 1.0.0-preview.9
                    
NuGet\Install-Package DioRed.Aith.AspNetCore -Version 1.0.0-preview.9
                    
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="DioRed.Aith.AspNetCore" Version="1.0.0-preview.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DioRed.Aith.AspNetCore" Version="1.0.0-preview.9" />
                    
Directory.Packages.props
<PackageReference Include="DioRed.Aith.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 DioRed.Aith.AspNetCore --version 1.0.0-preview.9
                    
#r "nuget: DioRed.Aith.AspNetCore, 1.0.0-preview.9"
                    
#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 DioRed.Aith.AspNetCore@1.0.0-preview.9
                    
#: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=DioRed.Aith.AspNetCore&version=1.0.0-preview.9&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DioRed.Aith.AspNetCore&version=1.0.0-preview.9&prerelease
                    
Install as a Cake Tool

DioRed.Aith.AspNetCore

DioRed.Aith.AspNetCore provides seamless integration between ASP.NET Core applications and Aith, an OAuth 2.0 authorization server and OpenID Connect provider from DioRED.

It offers:

  • Browser login (Authorization Code + PKCE) with cookie-based app sessions
  • Automatic UserInfo → Claims mapping
  • High-level and advanced configuration models
  • Built-in interactive login/logout endpoint helpers
  • Support for multiple authentication schemes
  • Full extensibility for custom OAuth options

🚀 Installation

dotnet add package DioRed.Aith.AspNetCore

✨ Quick Start

Register Aith authentication in Program.cs:

builder.Services.AddAithAuthentication(o =>
{
    o.ClientId     = "my-app";
    o.ClientSecret = "secret";
});

Add interactive login/logout endpoints:

app.MapAithInteractiveEndpoints();

Protect your pages:

app.MapGet("/profile", (ClaimsPrincipal user) =>
{
    return $"Hello, {user.Identity?.Name}";
}).RequireAuthorization();

🔧 Advanced Configuration

If you need full control over cookie scheme names, the authentication pipeline, or the underlying OAuth handler:

builder.Services.AddAithAuthenticationCore(o =>
{
    o.CookieScheme = "MyCookies";
    o.AithScheme   = "MyAith";

    o.ConfigureAith = aith =>
    {
        aith.ClientId     = "my-app";
        aith.ClientSecret = "secret";
    };

    o.ConfigureAithOAuth = oauth =>
    {
        oauth.SignInScheme = "MyCookies";
        oauth.Scope.Add("custom-scope");
    };

    // Optional:
    // o.ConfigureCookie = cookie => { ... };
});

📡 UserInfo → Claims Mapping

Aith automatically fetches the UserInfo document and maps its fields to claims:

  • "name" → ClaimTypes.Name
  • "sub" → ClaimTypes.NameIdentifier
  • "email" → ClaimTypes.Email
  • "preferred_username" → "preferred_username"
  • All other JSON fields → claims with the same JSON property names

This ensures HttpContext.User.Identity.Name works as expected.


🧩 Interactive Login/Logout Endpoints

Add standardized interactive endpoints:

app.MapAithInteractiveEndpoints();

Customize paths/schemes if needed:

app.MapAithInteractiveEndpoints(
    loginPath: "/auth/login",
    logoutPath: "/auth/logout",
    cookieScheme: "MyCookies",
    challengeScheme: "MyAith"
);

📚 Summary

DioRed.Aith.AspNetCore gives you a clean, production-ready, extensible way to plug Aith authentication into any ASP.NET Core application, from minimal APIs to MVC to Razor Pages.

If you need programmatic Aith access using client_credentials, see the companion package:

👉 DioRed.Aith.Client (NuGet)

Product 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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.
  • net8.0

    • No dependencies.

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-preview.9 108 5/11/2026
1.0.0-preview.8 80 5/8/2026
1.0.0-preview.7 79 5/8/2026
1.0.0-preview.6 82 4/21/2026
1.0.0-preview.5 97 12/29/2025