From 2f238a2c77fdf9bd86d19c1078ccf26460753fba Mon Sep 17 00:00:00 2001 From: mountford Date: Thu, 3 Aug 2017 10:46:43 -0700 Subject: [PATCH] Reduce number of authentication/authorization log statements The auth logging has been useful, but it now generates a sizeable percentage of all logging, because it spits out three to five lines for every request in the system. This CL reduces that to two to three. We may eventually want to reduce it further, but this is a good start. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=164146182 --- .../registry/request/auth/RequestAuthenticator.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/java/google/registry/request/auth/RequestAuthenticator.java b/java/google/registry/request/auth/RequestAuthenticator.java index ec4332079..1245496c3 100644 --- a/java/google/registry/request/auth/RequestAuthenticator.java +++ b/java/google/registry/request/auth/RequestAuthenticator.java @@ -146,7 +146,6 @@ public class RequestAuthenticator { } break; } - logger.info("Authorized"); return Optional.of(authResult); } @@ -164,11 +163,10 @@ public class RequestAuthenticator { // App Engine internal authentication, using the queue name header case INTERNAL: // checkAuthConfig will have insured that the user policy is not USER. - logger.info("Checking internal auth"); { AuthResult authResult = appEngineInternalAuthenticationMechanism.authenticate(req); if (authResult.isAuthenticated()) { - logger.infofmt("Authenticated: %s", authResult); + logger.infofmt("Authenticated via internal auth: %s", authResult); return authResult; } } @@ -177,10 +175,10 @@ public class RequestAuthenticator { case API: // checkAuthConfig will have insured that the user policy is not IGNORED. for (AuthenticationMechanism authMechanism : apiAuthenticationMechanisms) { - logger.infofmt("Checking %s", authMechanism); AuthResult authResult = authMechanism.authenticate(req); if (authResult.isAuthenticated()) { - logger.infofmt("Authenticated: %s", authResult); + logger.infofmt( + "Authenticated via %s: %s", authMechanism.getClass().getSimpleName(), authResult); return authResult; } } @@ -188,10 +186,9 @@ public class RequestAuthenticator { // Legacy authentication via UserService case LEGACY: // checkAuthConfig will have insured that the user policy is not IGNORED. - logger.info("Checking legacy auth"); AuthResult authResult = legacyAuthenticationMechanism.authenticate(req); if (authResult.isAuthenticated()) { - logger.infofmt("Authenticated: %s", authResult); + logger.infofmt("Authenticated via legacy auth: %s", authResult); return authResult; } break;