DynAuth.OpenIdConnect
1.0.0
dotnet add package DynAuth.OpenIdConnect --version 1.0.0
NuGet\Install-Package DynAuth.OpenIdConnect -Version 1.0.0
<PackageReference Include="DynAuth.OpenIdConnect" Version="1.0.0" />
<PackageVersion Include="DynAuth.OpenIdConnect" Version="1.0.0" />
<PackageReference Include="DynAuth.OpenIdConnect" />
paket add DynAuth.OpenIdConnect --version 1.0.0
#r "nuget: DynAuth.OpenIdConnect, 1.0.0"
#:package DynAuth.OpenIdConnect@1.0.0
#addin nuget:?package=DynAuth.OpenIdConnect&version=1.0.0
#tool nuget:?package=DynAuth.OpenIdConnect&version=1.0.0
๐ Dynamic authentication with OpenIDConnect & SAML Schemes in ASP.NET Core
DynAuth is a flexible authentication library for .NET applications, providing support for multiple authentication protocols including SAML2 and OpenID Connect. This is useful for multi-tenant apps or when your identity provider setup is not static.
Features
- ๐ Multi-protocol support
- SAML2 authentication
- OpenID Connect integration
- ๐ฏ Built for .NET 8.0
- โก Easy integration with ASP.NET Core applications
- ๐ ๏ธ Customizable authentication flows
๐งฉ Adding a Schemes at Runtime
1. IOidcSchemeManager
Call this from anywhere (e.g., an admin panel or per-tenant middleware):
- Adds new oidc client on the fly
public class SchemeService
{
public Task AddScheme()
{
var options = new OpenIdConnectOptions
{
SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme,
Authority = "https://accounts.google.com",
ClientId = "*",
ClientSecret = "*",
ResponseType = "code",
SaveTokens = true,
CallbackPath = $"/signin-google-test",
};
_oidcSchemeManager.AddScheme("google-test", options);
}
}
2. ISamlSchemeManager
Call this from anywhere (e.g., an admin panel or per-tenant middleware):
- Adds new saml client on the fly
public class SchemeService
{
public Task AddScheme()
{
var options = new Saml2Options
{
SPOptions =
{
EntityId = new EntityId("https://localhost:7119"),
ModulePath = "/signin-azure-saml2"
}
};
var idp = new IdentityProvider(new EntityId("https://sts.windows.net/16e2eac8-c69c-4976-919b-test/"),
options.SPOptions)
{
Binding = Saml2BindingType.HttpPost,
LoadMetadata = true,
MetadataLocation = "https://login.microsoftonline.com/16e2eac8-c69c-4976-919b-4c3a48c2c0f7/federationmetadata/2007-06/federationmetadata.xml?appid=b88b09ee-52b4-4454-8c1f-test"
};
options.IdentityProviders.Add(idp);
_samlSchemeManager.AddScheme("azure", options);
}
}
๐ ๏ธ Service Registration
In Program.cs
:
builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie(CookieAuthenticationDefaults.AuthenticationScheme)
.AddDynAuthOpenIdConnect()
.AddDynAuthSaml();
๐งช Testing the Setup
Check out the samples
directory for example implementations and usage.
๐งฉ Want to Contribute?
Feel free to fork and enhance this with:
- Admin UI for managing schemes
- Database persistence
- Caching / refreshing tokens
๐ฌ Questions / Help?
Open an issue or discussion if you need help wiring this up in your own project.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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 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. |
-
net7.0
- DynAuth (>= 1.0.0)
- Microsoft.AspNetCore.Authentication.OpenIdConnect (>= 7.0.20)
-
net8.0
- DynAuth (>= 1.0.0)
- Microsoft.AspNetCore.Authentication.OpenIdConnect (>= 8.0.15)
-
net9.0
- DynAuth (>= 1.0.0)
- Microsoft.AspNetCore.Authentication.OpenIdConnect (>= 9.0.4)
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 | 170 | 4/21/2025 |