feat: add generate access token

This commit is contained in:
Polianin Nikita 2024-05-29 05:51:03 +03:00
parent 43011457d6
commit f3063c5322

View File

@ -6,12 +6,14 @@ using System;
namespace Mirea.Api.Security.Services;
public class AuthService(ICacheService cache)
public class AuthService(ICacheService cache, IAccessToken accessTokenService)
{
public TimeSpan Lifetime { private get; init; }
private static string GenerateRefreshToken() => Guid.NewGuid().ToString().Replace("-", "") +
GeneratorKey.GenerateString(32);
private (string Token, DateTime ExpireIn) GenerateAccessToken(string userId) =>
accessTokenService.GenerateToken(userId);
private static string GetAuthCacheKey(string fingerprint) => $"{fingerprint}_auth_token";