DainnUser.OpenIddict
1.0.3
dotnet add package DainnUser.OpenIddict --version 1.0.3
NuGet\Install-Package DainnUser.OpenIddict -Version 1.0.3
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="DainnUser.OpenIddict" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DainnUser.OpenIddict" Version="1.0.3" />
<PackageReference Include="DainnUser.OpenIddict" />
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 DainnUser.OpenIddict --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DainnUser.OpenIddict, 1.0.3"
#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 DainnUser.OpenIddict@1.0.3
#: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=DainnUser.OpenIddict&version=1.0.3
#tool nuget:?package=DainnUser.OpenIddict&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DainnUser
A comprehensive .NET 8 class library for user management, authentication, and authorization.
Features
- Authentication: JWT-based authentication with refresh token rotation
- Social Login: Google, Facebook, GitHub, Microsoft OAuth integration
- Two-Factor Authentication: TOTP-based 2FA with QR code generation
- User Management: Complete CRUD operations with role-based access control
- Session Management: Multi-device session tracking and management
- Email Services: Multi-provider support (SMTP, SendGrid, AWS SES)
- Security: Rate limiting, reCAPTCHA, account lockout, password policies
- Storage: Multi-provider support (Local, Azure Blob, AWS S3)
- Database: Support for SQL Server, PostgreSQL, MySQL, SQLite
Installation
Install the core packages via NuGet:
dotnet add package DainnUser.Core
dotnet add package DainnUser.Infrastructure
dotnet add package DainnUser.Application
For web UI components:
dotnet add package DainnUser.Web
Quick Start
1. Configure Services
builder.Services.AddDainnUser(options =>
{
options.ConnectionString = "your-connection-string";
options.DatabaseProvider = DatabaseProvider.SqlServer;
options.JwtSecret = "your-secret-key-min-32-bytes";
options.JwtIssuer = "your-issuer";
options.JwtAudience = "your-audience";
});
2. Configure Authentication
builder.Services.AddDainnUserJwtAuthentication();
3. Apply Migrations
app.UseDainnUserMigrations();
4. Use Authentication
app.UseAuthentication();
app.UseAuthorization();
Configuration
JWT Settings
{
"DainnUser": {
"Jwt": {
"Secret": "your-secret-key-minimum-32-bytes",
"Issuer": "your-issuer",
"Audience": "your-audience",
"ExpirationMinutes": 60
}
}
}
Social Login
{
"DainnUser": {
"EnableSocialLogin": true,
"GoogleClientId": "your-google-client-id",
"GoogleClientSecret": "your-google-client-secret",
"FacebookAppId": "your-facebook-app-id",
"FacebookAppSecret": "your-facebook-app-secret",
"GitHubClientId": "your-github-client-id",
"GitHubClientSecret": "your-github-client-secret",
"MicrosoftClientId": "your-microsoft-client-id",
"MicrosoftClientSecret": "your-microsoft-client-secret"
}
}
Email Configuration
{
"DainnUser": {
"Email": {
"Provider": "Smtp",
"Smtp": {
"Host": "smtp.gmail.com",
"Port": 587,
"Username": "your-email@gmail.com",
"Password": "your-password",
"EnableSsl": true,
"FromEmail": "noreply@yourdomain.com",
"FromName": "Your App"
}
}
}
}
Usage Examples
Register a User
var result = await authService.RegisterAsync(new RegisterDto
{
Email = "user@example.com",
Username = "username",
Password = "SecurePassword123!"
});
Login
var result = await authService.LoginAsync(new LoginDto
{
Email = "user@example.com",
Password = "SecurePassword123!"
});
var accessToken = result.AccessToken;
var refreshToken = result.RefreshToken;
Social Login
var result = await socialLoginService.LoginWithGoogleAsync(
authorizationCode: "google-auth-code",
callbackUrl: "https://yourapp.com/signin-google",
ipAddress: "127.0.0.1",
userAgent: "Mozilla/5.0"
);
Enable Two-Factor Authentication
var setup = await twoFactorService.SetupTwoFactorAsync(userId);
var qrCodeUrl = setup.QrCodeUrl; // Display to user
Documentation
Requirements
- .NET 8.0 or later
- Entity Framework Core 8.0 or later
- Supported databases: SQL Server, PostgreSQL, MySQL, SQLite
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For issues, questions, or contributions, please visit the GitHub repository.
| 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 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
- DainnUser.Application (>= 1.0.3)
- DainnUser.Core (>= 1.0.3)
- DainnUser.Infrastructure (>= 1.0.3)
- OpenIddict.AspNetCore (>= 7.5.0)
- OpenIddict.EntityFrameworkCore (>= 7.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.