1
This commit is contained in:
1 parent
3135189ea3
commit
a003d90b0e
21 files changed
+754
-145
No files matched your search
@@ -0,0 +1,22 @@
|
||||
using MAX.Core.DependencyInjection;
|
||||
using Store.Management.Api;
|
||||
using Store.Management.Api.Authentication;
|
||||
|
||||
namespace Store.Management.Framework.Services;
|
||||
|
||||
/// <summary>用户登录服务,复用应用 API 客户端的认证会话。</summary>
|
||||
public interface ILoginService
|
||||
{
|
||||
/// <summary>提交登录;passwordHash 为 UTF-8 密码的 32 位大写 MD5。</summary>
|
||||
Task LoginAsync(string userName, string passwordHash, CancellationToken cancellationToken = default);
|
||||
}
|
||||
|
||||
internal sealed class LoginService(StoreApiClient apiClient) : ILoginService, ISingletonDependency
|
||||
{
|
||||
public Task LoginAsync(string userName, string passwordHash, CancellationToken cancellationToken = default)
|
||||
=> apiClient.Auth.LoginAsync(new LoginRequest
|
||||
{
|
||||
UserName = userName.Trim(),
|
||||
Password = passwordHash
|
||||
}, cancellationToken);
|
||||
}
|
||||
Reference in new issue
Block a user