refator: set fingerprint expire instead session mode
This commit is contained in:
parent
dee89b278b
commit
24c75e4306
@ -40,11 +40,17 @@ public class AuthController(IOptionsSnapshot<Admin> user, AuthService auth, Pass
|
|||||||
Response.Cookies.Append(name, value, cookieOptions);
|
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("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("authentication_token", value, expires);
|
||||||
|
SetCookie("user_key", Fingerprint, expires);
|
||||||
|
}
|
||||||
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public void OnActionExecuting(ActionExecutingContext context)
|
public void OnActionExecuting(ActionExecutingContext context)
|
||||||
@ -57,7 +63,6 @@ public class AuthController(IOptionsSnapshot<Admin> user, AuthService auth, Pass
|
|||||||
if (!string.IsNullOrWhiteSpace(Fingerprint)) return;
|
if (!string.IsNullOrWhiteSpace(Fingerprint)) return;
|
||||||
|
|
||||||
Fingerprint = Guid.NewGuid().ToString().Replace("-", "");
|
Fingerprint = Guid.NewGuid().ToString().Replace("-", "");
|
||||||
SetCookie("user_key", Fingerprint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
Loading…
Reference in New Issue
Block a user