-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLog.Users.cs
More file actions
211 lines (169 loc) · 10 KB
/
Log.Users.cs
File metadata and controls
211 lines (169 loc) · 10 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
using Microsoft.Extensions.Logging;
namespace BookStore.ApiService.Infrastructure.Logging;
public static partial class Log
{
public static partial class Users
{
[LoggerMessage(
Level = LogLevel.Information,
Message = "JWT login attempt for {Email}")]
public static partial void JwtLoginAttempt(ILogger logger, string email);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Login failed: User not found for {Email}")]
public static partial void LoginFailedUserNotFound(ILogger logger, string email);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Account locked for {Email}")]
public static partial void AccountLocked(ILogger logger, string email);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Login failed: Invalid password for {Email}")]
public static partial void LoginFailedInvalidPassword(ILogger logger, string email);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Login failed: Email not confirmed for {Email}")]
public static partial void LoginFailedUnconfirmedEmail(ILogger logger, string email);
[LoggerMessage(
Level = LogLevel.Information,
Message = "JWT login successful for {Email}")]
public static partial void JwtLoginSuccessful(ILogger logger, string email);
[LoggerMessage(
Level = LogLevel.Information,
Message = "JWT registration attempt for {Email}")]
public static partial void JwtRegistrationAttempt(ILogger logger, string email);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Registration failed for {Email}: {Errors}")]
public static partial void RegistrationFailed(ILogger logger, string email, string errors);
[LoggerMessage(
Level = LogLevel.Information,
Message = "JWT registration successful for {Email}")]
public static partial void JwtRegistrationSuccessful(ILogger logger, string email);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Refresh failed: Token not found")]
public static partial void RefreshFailedTokenNotFound(ILogger logger);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Refresh failed: Token expired or invalid for user {User}")]
public static partial void RefreshFailedTokenExpiredOrInvalid(ILogger logger, string? user);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Refresh failed: Security stamp mismatch for user {User}")]
public static partial void RefreshFailedSecurityStampMismatch(ILogger logger, string? user);
// Passkeys
[LoggerMessage(
Level = LogLevel.Error,
Message = "Error extracting user ID from credential")]
public static partial void PasskeyExtractUserIdError(ILogger logger, Exception ex);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "No user ID provided in request, using fallback - login may fail")]
public static partial void PasskeyNoUserIdProvided(ILogger logger);
[LoggerMessage(
Level = LogLevel.Error,
Message = "Passkey is null after successful attestation")]
public static partial void PasskeyIsNull(ILogger logger);
[LoggerMessage(
Level = LogLevel.Error,
Message = "Error parsing credential JSON for user lookup")]
public static partial void PasskeyParseError(ILogger logger, Exception ex);
[LoggerMessage(
Level = LogLevel.Error,
Message = "Unhandled exception during passkey login")]
public static partial void PasskeyLoginUnhandledException(ILogger logger, Exception ex);
[LoggerMessage(
Level = LogLevel.Information,
Message = "Logout successful for {User}")]
public static partial void LogoutSuccessful(ILogger logger, string? user);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Passkey assertion failed. IsLockedOut: {IsLockedOut}, IsNotAllowed: {IsNotAllowed}, RequiresTwoFactor: {RequiresTwoFactor}")]
public static partial void PasskeyAssertionFailed(ILogger logger, bool isLockedOut, bool isNotAllowed, bool requiresTwoFactor);
[LoggerMessage(
Level = LogLevel.Information,
Message = "Adding passkey to existing user {Email}")]
public static partial void PasskeyAttestationAttempt(ILogger logger, string? email);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Passkey attestation failed for user {Email}: {Error}")]
public static partial void PasskeyAttestationFailed(ILogger logger, string? email, string? error);
[LoggerMessage(
Level = LogLevel.Error,
Message = "Failed to update user {Email} after adding passkey: {Errors}")]
public static partial void PasskeyUpdateUserFailed(ILogger logger, string? email, string errors);
[LoggerMessage(
Level = LogLevel.Information,
Message = "Passkey added successfully for user {Email}")]
public static partial void PasskeyRegistrationSuccessful(ILogger logger, string? email);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Invalid GUID format for user ID from {Source}: {Value}. Generating new ID.")]
public static partial void PasskeyInvalidGuidFormat(ILogger logger, string source, string value);
[LoggerMessage(
Level = LogLevel.Information,
Message = "Creating new user for passkey registration with ID {UserId} from {Source}")]
public static partial void PasskeyCreatingNewUser(ILogger logger, Guid userId, string source);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Registration failed: User ID {UserId} already exists.")]
public static partial void PasskeyRegistrationIdConflict(ILogger logger, Guid userId);
[LoggerMessage(
Level = LogLevel.Error,
Message = "Unhandled exception during passkey registration/addition")]
public static partial void PasskeyRegistrationUnhandledException(ILogger logger, Exception ex);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Email confirmation failed: User not found {UserId}")]
public static partial void ConfirmationFailedUserNotFound(ILogger logger, string userId);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Email confirmation failed: Invalid code for user {UserId}. Errors: {Errors}")]
public static partial void ConfirmationFailedInvalidCode(ILogger logger, string userId, string errors);
[LoggerMessage(
Level = LogLevel.Information,
Message = "Resend verification attempt for {Email}")]
public static partial void ResendVerificationAttempt(ILogger logger, string email);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Resend verification failed for {Email}: {Reason}")]
public static partial void ResendVerificationFailed(ILogger logger, string email, string reason);
[LoggerMessage(
Level = LogLevel.Information,
Message = "Resend verification successful for {Email}")]
public static partial void ResendVerificationSuccessful(ILogger logger, string email);
[LoggerMessage(
Level = LogLevel.Critical,
Message = "Passkey counter mismatch detected for user {Email}. Stored: {StoredCounter}, Received: {ReceivedCounter}. Possible cloned authenticator.")]
public static partial void PasskeyCounterMismatch(ILogger logger, string? email, uint storedCounter, uint receivedCounter);
[LoggerMessage(
Level = LogLevel.Critical,
Message = "Cross-tenant token theft detected for user {UserId}. Token tenant: {TokenTenantId}, Request tenant: {RequestTenantId}")]
public static partial void CrossTenantTokenTheft(ILogger logger, Guid userId, string tokenTenantId, string requestTenantId);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Passkey tenant validation failed for tenant {TenantId} on endpoint {Endpoint}")]
public static partial void PasskeyTenantValidationFailed(ILogger logger, string tenantId, string endpoint);
[LoggerMessage(
Level = LogLevel.Information,
Message = "Passkey counter validation triggered for user {Email}. Expected >= {ExpectedCounter}, Actual: {ActualCounter}")]
public static partial void PasskeyCounterValidationTriggered(ILogger logger, string? email, uint expectedCounter, uint actualCounter);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Passkey user ID conflict detected for ID {UserId} in tenant {TenantId}")]
public static partial void PasskeyUserIdConflictDetected(ILogger logger, Guid userId, string tenantId);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Anonymous cart merge skipped for user {UserId}: no valid items to merge")]
public static partial void AnonymousCartMergeSkipped(ILogger logger, Guid userId);
[LoggerMessage(
Level = LogLevel.Information,
Message = "Anonymous cart merged for user {UserId}: mergedItems={MergedItems}, mergedQuantity={MergedQuantity}")]
public static partial void AnonymousCartMerged(ILogger logger, Guid userId, int mergedItems, int mergedQuantity);
[LoggerMessage(
Level = LogLevel.Critical,
Message = "Tenant isolation violation detected in {MethodName}. Session tenant '{SessionTenantId}' does not match request tenant '{RequestTenantId}'.")]
public static partial void TenantIsolationViolation(ILogger logger, string methodName, string? sessionTenantId, string? requestTenantId);
}
}