Ledon.Security.Accounts 0.0.1

dotnet add package Ledon.Security.Accounts --version 0.0.1
                    
NuGet\Install-Package Ledon.Security.Accounts -Version 0.0.1
                    
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="Ledon.Security.Accounts" Version="0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ledon.Security.Accounts" Version="0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Ledon.Security.Accounts" />
                    
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 Ledon.Security.Accounts --version 0.0.1
                    
#r "nuget: Ledon.Security.Accounts, 0.0.1"
                    
#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 Ledon.Security.Accounts@0.0.1
                    
#: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=Ledon.Security.Accounts&version=0.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Ledon.Security.Accounts&version=0.0.1
                    
Install as a Cake Tool

Ledon.Security.Accounts

账号生命周期:注册、邮箱确认、PBKDF2 密码、失败锁定、忘记/重置密码,可选接入 Ledon.Notifications 发送邮件。

builder.Services.AddLedonAccounts(o =>
{
    o.RequireConfirmedEmail = true;
    o.MaxFailedAccessAttempts = 5;
    o.LockoutDuration = TimeSpan.FromMinutes(5);
    o.RegisterUserValidator = true; // 让 /auth/login 使用账号登录
});

端点(MapEndpoints 默认开启,由 UseLedonWeb() 自动映射):

方法 路径 说明
POST /auth/accounts/register 注册;返回 201
POST /auth/accounts/verify-email 确认邮箱
POST /auth/accounts/resend-verification 重发确认
POST /auth/accounts/forgot-password 请求重置(始终 202,不暴露账号是否存在)
POST /auth/accounts/reset-password 重置密码

服务用法:

var result = await accounts.RegisterAsync("alice", "alice@example.com", "S3cret-pass");
await accounts.ConfirmEmailAsync(result.Account.Id, result.EmailVerificationToken!);
var login = await accounts.AuthenticateAsync("alice", "S3cret-pass");
if (login.Status == AccountLoginStatus.Success) { /* login.User */ }
  • 密码使用 PBKDF2-SHA256(10 万次迭代、随机盐)哈希,常量时间校验;
  • 确认/重置令牌只存 SHA-256 哈希、一次性、带过期时间,重发同用途令牌会使旧令牌失效;
  • 默认内存存储;生产多实例请替换 IAccountStore 与 IAccountTokenStore(数据库/Redis);
  • ExposeTokensInResponses 仅用于本地开发;生产请配置通知渠道;
  • AccountsUserValidator 默认不自动注册([DisableAutoDiscovery]),需要时打开 RegisterUserValidator。

完整文档:https://github.com/wosledon/ledon-framework

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
0.0.1 47 10/28/2026