身份验证
This commit is contained in:
17
Hotfix/Api/Helper/ApiJwtHelper.cs
Normal file
17
Hotfix/Api/Helper/ApiJwtHelper.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Text;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
|
||||
namespace NBF;
|
||||
|
||||
public static class ApiJwtHelper
|
||||
{
|
||||
public const string Issuer = "GameServer";
|
||||
public const string Audience = "GameClient";
|
||||
public const string Secret = "YourSuperSecretKeyForJwtTokenGeneration123!";
|
||||
public static readonly TimeSpan TokenLifetime = TimeSpan.FromDays(1);
|
||||
|
||||
public static SymmetricSecurityKey CreateSigningKey()
|
||||
{
|
||||
return new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Secret));
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,14 @@ public static class DingTalkHelper
|
||||
{
|
||||
private static readonly HttpClient _httpClient = new HttpClient();
|
||||
|
||||
public static async Task SendCAPTCHA(string code)
|
||||
public static async Task SendCAPTCHA(string account, string code)
|
||||
{
|
||||
DingTalkMarkdownData dingTalkTestData = new DingTalkMarkdownData
|
||||
{
|
||||
markdown = new DingTalkMarkdownItem
|
||||
{
|
||||
title = "NB验证码",
|
||||
text = $"验证码:{code}"
|
||||
text = $"账号:{account}\n验证码:{code}"
|
||||
}
|
||||
};
|
||||
await SendMessageAsync("23457f9c93ac0ae909e1cbf8bcfeb7e0573968ac2d4c4b2c3a961b2f0c9247cb", dingTalkTestData);
|
||||
|
||||
Reference in New Issue
Block a user