@@ -22,30 +22,30 @@ public KcJwtBearerEvents(ICurrentUser currentUser, IUserService userService, IBc
22
22
_logger = logger ;
23
23
}
24
24
25
- public override Task Challenge ( JwtBearerChallengeContext context )
26
- {
27
- var username = context . HttpContext . User ? . Identity ? . Name ?? "Unknown" ;
28
- var ipAddress = context . HttpContext . Connection . RemoteIpAddress ;
29
- var ip = ipAddress == null ? "Unknown" : ipAddress . ToString ( ) ;
30
-
31
- if ( ! context . HttpContext . Request . Headers . ContainsKey ( "Authorization" ) )
32
- {
33
- _logger . LogWarning ( $ "[AUTH] Authentication failed for user '{ username } ' from IP address '{ ip } '. Authorization header is missing.") ;
34
- }
35
-
36
- return base . Challenge ( context ) ;
37
- }
38
-
39
- public override Task AuthenticationFailed ( AuthenticationFailedContext context )
40
- {
41
- var username = context . HttpContext . User ? . Identity ? . Name ?? "Unknown" ;
42
- var ipAddress = context . HttpContext . Connection . RemoteIpAddress ;
43
- var ip = ipAddress == null ? "Unknown" : ipAddress . ToString ( ) ;
44
-
45
- _logger . LogInformation ( $ "[AUTH] Authentication failed for user '{ username } ' from IP address '{ ip } '.") ;
46
-
47
- return base . AuthenticationFailed ( context ) ;
48
- }
25
+ // public override Task Challenge(JwtBearerChallengeContext context)
26
+ // {
27
+ // var username = context.HttpContext.User?.Identity?.Name ?? "Unknown";
28
+ // var ipAddress = context.HttpContext.Connection.RemoteIpAddress;
29
+ // var ip = ipAddress == null ? "Unknown" : ipAddress.ToString();
30
+
31
+ // if (!context.HttpContext.Request.Headers.ContainsKey("Authorization"))
32
+ // {
33
+ // _logger.LogWarning($"[AUTH] Authentication failed for user '{username}' from IP address '{ip}'. Authorization header is missing.");
34
+ // }
35
+
36
+ // return base.Challenge(context);
37
+ // }
38
+
39
+ // public override Task AuthenticationFailed(AuthenticationFailedContext context)
40
+ // {
41
+ // var username = context.HttpContext.User?.Identity?.Name ?? "Unknown";
42
+ // var ipAddress = context.HttpContext.Connection.RemoteIpAddress;
43
+ // var ip = ipAddress == null ? "Unknown" : ipAddress.ToString();
44
+
45
+ // _logger.LogInformation($"[AUTH] Authentication failed for user '{username}' from IP address '{ip}'.");
46
+
47
+ // return base.AuthenticationFailed(context);
48
+ // }
49
49
50
50
public override async Task TokenValidated ( TokenValidatedContext context )
51
51
{
0 commit comments