DioRed.Dais.AspNetCore
1.0.0-preview.4
DAIS has been completely renamed to Aith
dotnet add package DioRed.Dais.AspNetCore --version 1.0.0-preview.4
NuGet\Install-Package DioRed.Dais.AspNetCore -Version 1.0.0-preview.4
<PackageReference Include="DioRed.Dais.AspNetCore" Version="1.0.0-preview.4" />
<PackageVersion Include="DioRed.Dais.AspNetCore" Version="1.0.0-preview.4" />
<PackageReference Include="DioRed.Dais.AspNetCore" />
paket add DioRed.Dais.AspNetCore --version 1.0.0-preview.4
#r "nuget: DioRed.Dais.AspNetCore, 1.0.0-preview.4"
#:package DioRed.Dais.AspNetCore@1.0.0-preview.4
#addin nuget:?package=DioRed.Dais.AspNetCore&version=1.0.0-preview.4&prerelease
#tool nuget:?package=DioRed.Dais.AspNetCore&version=1.0.0-preview.4&prerelease
DioRed.Dais.AspNetCore
DioRed.Dais.AspNetCore provides seamless integration between ASP.NET Core applications and the DAIS (DioRed Authentication & Identity Server) OAuth2/OpenID-Connectβstyle authentication system.
It offers:
- Simple cookie-based login via DAIS Authorization Code + PKCE
- Automatic UserInfo β Claims mapping
- High-level and advanced configuration models
- Built-in login/logout endpoint helpers
- Support for multiple authentication schemes
- Full extensibility for custom OAuth options
π Installation
dotnet add package DioRed.Dais.AspNetCore
β¨ Quick Start
Register DAIS authentication in Program.cs:
builder.Services.AddDaisAuthentication(o =>
{
o.ClientId = "my-app";
o.ClientSecret = "secret";
o.Scopes = new[] { "profile", "email" };
});
Add login/logout endpoints:
app.MapDaisAuthEndpoints();
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.AddDais(o =>
{
o.CookieScheme = "MyCookies";
o.DaisScheme = "MyDais";
o.ConfigureDais = dais =>
{
dais.ClientId = "my-app";
dais.Scopes = new[] { "profile", "email" };
};
o.ConfigureDaisOAuth = oauth =>
{
oauth.SignInScheme = "MyCookies";
oauth.Scope.Add("custom-scope");
};
});
π‘ UserInfo β Claims Mapping
DAIS automatically fetches the UserInfo document and maps its fields to claims:
"name"βClaimTypes.Name"sub"βClaimTypes.NameIdentifier"preferred_username"β"preferred_username"- All other JSON fields β raw claim names via
MapAll()
This ensures HttpContext.User.Identity.Name works as expected.
π§© Login/Logout Endpoints Helper
Add standardized endpoints:
app.MapDaisAuthEndpoints();
Customize paths/schemes if needed:
app.MapDaisAuthEndpoints(
loginPath: "/auth/login",
logoutPath: "/auth/logout",
cookieScheme: "MyCookies",
challengeScheme: "MyDais"
);
π Summary
DioRed.Dais.AspNetCore gives you a clean, production-ready, extensible way to plug DAIS authentication into any ASP.NET Core application, from minimal APIs to MVC to Razor Pages.
If you need programmatic DAIS access using client_credentials, check out the companion package:
π DioRed.Dais.Client
| 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. net9.0 is compatible. 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 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. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.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.4 | 146 | 11/29/2025 | |
| 1.0.0-preview.3 | 140 | 11/29/2025 | |
| 1.0.0-preview.2 | 204 | 11/26/2025 | |
| 1.0.0-preview.1 | 208 | 11/25/2025 |