Skip to content

Commit 5a3c5e2

Browse files
authored
Merge pull request #627 from bcgov/yj
chore: gateway
2 parents 962e339 + 4f3ff84 commit 5a3c5e2

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

server/StrDss.Api/Authentication/KcJwtBearerEvents.cs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,30 @@ public KcJwtBearerEvents(ICurrentUser currentUser, IUserService userService, IBc
2222
_logger = logger;
2323
}
2424

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+
//}
4949

5050
public override async Task TokenValidated(TokenValidatedContext context)
5151
{

0 commit comments

Comments
 (0)