mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-12 18:07:22 +01:00
fix server tokens probably
This commit is contained in:
parent
96dd499923
commit
e4a6657391
1 changed files with 5 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using System.Globalization;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
|
|
@ -44,12 +45,15 @@ public class ServerTokenGenerator
|
|||
{
|
||||
new Claim(MareClaimTypes.Uid, _configuration.CurrentValue.ShardName),
|
||||
new Claim(MareClaimTypes.Internal, "true"),
|
||||
new Claim(MareClaimTypes.Expires, DateTime.Now.AddYears(1).Ticks.ToString(CultureInfo.InvariantCulture))
|
||||
}),
|
||||
SigningCredentials = new SigningCredentials(authSigningKey, SecurityAlgorithms.HmacSha256Signature),
|
||||
Expires = DateTime.Now.AddYears(1)
|
||||
};
|
||||
|
||||
var handler = new JwtSecurityTokenHandler();
|
||||
var rawData = handler.CreateJwtSecurityToken(token).RawData;
|
||||
var jwt = handler.CreateJwtSecurityToken(token);
|
||||
var rawData = jwt.RawData;
|
||||
|
||||
_tokenDictionary[signingKey] = rawData;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue