update auth for refresh tokens and token invalidation

This commit is contained in:
voltsrage
2026-06-26 04:32:01 +08:00
parent 9777a335c5
commit abb33de5c1
20 changed files with 1183 additions and 12 deletions
@@ -0,0 +1,22 @@
public enum AuthAuditEventType
{
UserLogout,
TokenRefreshed
}
public static class AuthAuditEventTypeExtensions
{
public static string ToDbString(this AuthAuditEventType t) => t switch
{
AuthAuditEventType.UserLogout => "USER_LOGOUT",
AuthAuditEventType.TokenRefreshed => "TOKEN_REFRESHED",
_ => throw new ArgumentOutOfRangeException(nameof(t))
};
public static AuthAuditEventType FromDbString(string v) => v switch
{
"USER_LOGOUT" => AuthAuditEventType.UserLogout,
"TOKEN_REFRESHED" => AuthAuditEventType.TokenRefreshed,
_ => throw new ArgumentOutOfRangeException(nameof(v), $"Unknown auth audit event type: '{v}'")
};
}