feat: add generate access token
This commit is contained in:
parent
43011457d6
commit
f3063c5322
@ -6,12 +6,14 @@ using System;
|
|||||||
|
|
||||||
namespace Mirea.Api.Security.Services;
|
namespace Mirea.Api.Security.Services;
|
||||||
|
|
||||||
public class AuthService(ICacheService cache)
|
public class AuthService(ICacheService cache, IAccessToken accessTokenService)
|
||||||
{
|
{
|
||||||
public TimeSpan Lifetime { private get; init; }
|
public TimeSpan Lifetime { private get; init; }
|
||||||
|
|
||||||
private static string GenerateRefreshToken() => Guid.NewGuid().ToString().Replace("-", "") +
|
private static string GenerateRefreshToken() => Guid.NewGuid().ToString().Replace("-", "") +
|
||||||
GeneratorKey.GenerateString(32);
|
GeneratorKey.GenerateString(32);
|
||||||
|
private (string Token, DateTime ExpireIn) GenerateAccessToken(string userId) =>
|
||||||
|
accessTokenService.GenerateToken(userId);
|
||||||
|
|
||||||
private static string GetAuthCacheKey(string fingerprint) => $"{fingerprint}_auth_token";
|
private static string GetAuthCacheKey(string fingerprint) => $"{fingerprint}_auth_token";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user