diff --git a/Security/Common/Domain/Caching/OAuthUserExtension.cs b/Security/Common/Domain/Caching/OAuthUserExtension.cs index 344663b..de0578a 100644 --- a/Security/Common/Domain/Caching/OAuthUserExtension.cs +++ b/Security/Common/Domain/Caching/OAuthUserExtension.cs @@ -5,5 +5,8 @@ internal class OAuthUserExtension public string? Message { get; set; } public bool IsSuccess { get; set; } public required OAuthProvider? Provider { get; set; } + public string? UserAgent { get; set; } = null; + public string? Ip { get; set; } = null; + public string? Fingerprint { get; set; } = null; public OAuthUser? User { get; set; } } \ No newline at end of file diff --git a/Security/Services/OAuthService.cs b/Security/Services/OAuthService.cs index 814052d..cddeea3 100644 --- a/Security/Services/OAuthService.cs +++ b/Security/Services/OAuthService.cs @@ -369,8 +369,6 @@ public class OAuthService(ILogger logger, Dictionary logger, Dictionary {ProvidedFingerprint}, " + + "UserAgent: {ExpectedUserAgent} -> {ProvidedUserAgent}, " + + "Ip: {ExpectedUserIp} -> {ProvidedIp}", + token, + result.Fingerprint, + requestInfo.Fingerprint, + result.UserAgent, + requestInfo.UserAgent, + result.Ip, + requestInfo.Ip); + + await cache.RemoveAsync(token, cancellation); + + return (null, "Invalid or expired token.", false, null); + } + + await cache.RemoveAsync(tokenFailedKey, cancellation); + + result.Ip = requestInfo.Ip; + result.UserAgent = requestInfo.UserAgent; + result.Fingerprint = requestInfo.Fingerprint; + return (result.User, result.Message, result.IsSuccess, result.Provider); } } \ No newline at end of file