refator: set fingerprint expire instead session mode

This commit is contained in:
Polianin Nikita 2024-08-24 02:26:11 +03:00
parent dee89b278b
commit 24c75e4306

View File

@ -40,11 +40,17 @@ public class AuthController(IOptionsSnapshot<Admin> user, AuthService auth, Pass
Response.Cookies.Append(name, value, cookieOptions);
}
private void SetRefreshToken(string value, DateTimeOffset? expires = null) =>
private void SetRefreshToken(string value, DateTimeOffset? expires = null)
{
SetCookie("refresh_token", value, expires);
SetCookie("user_key", Fingerprint, expires);
}
private void SetFirstToken(string value, DateTimeOffset? expires = null) =>
private void SetFirstToken(string value, DateTimeOffset? expires = null)
{
SetCookie("authentication_token", value, expires);
SetCookie("user_key", Fingerprint, expires);
}
[ApiExplorerSettings(IgnoreApi = true)]
public void OnActionExecuting(ActionExecutingContext context)
@ -57,7 +63,6 @@ public class AuthController(IOptionsSnapshot<Admin> user, AuthService auth, Pass
if (!string.IsNullOrWhiteSpace(Fingerprint)) return;
Fingerprint = Guid.NewGuid().ToString().Replace("-", "");
SetCookie("user_key", Fingerprint);
}
[ApiExplorerSettings(IgnoreApi = true)]