Change messages about failed authentication to be warnings instead of info messages

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155114145
This commit is contained in:
mountford 2017-05-04 12:51:54 -07:00 committed by Ben McIlwain
parent 93c2a1e4f0
commit 354e1fb8b2

View file

@ -63,13 +63,13 @@ public class RequestAuthenticator {
break; break;
case APP: case APP:
if (!authResult.isAuthenticated()) { if (!authResult.isAuthenticated()) {
logger.info("Not authorized; no authentication found"); logger.warning("Not authorized; no authentication found");
return Optional.absent(); return Optional.absent();
} }
break; break;
case USER: case USER:
if (authResult.authLevel() != AuthLevel.USER) { if (authResult.authLevel() != AuthLevel.USER) {
logger.info("Not authorized; no authenticated user"); logger.warning("Not authorized; no authenticated user");
// TODO(mountford): change this so that the caller knows to return a more helpful error // TODO(mountford): change this so that the caller knows to return a more helpful error
return Optional.absent(); return Optional.absent();
} }
@ -78,7 +78,7 @@ public class RequestAuthenticator {
switch (auth.userPolicy()) { switch (auth.userPolicy()) {
case IGNORED: case IGNORED:
if (authResult.authLevel() == AuthLevel.USER) { if (authResult.authLevel() == AuthLevel.USER) {
logger.info("Not authorized; user policy is IGNORED, but a user was found"); logger.warning("Not authorized; user policy is IGNORED, but a user was found");
return Optional.absent(); return Optional.absent();
} }
break; break;
@ -88,7 +88,7 @@ public class RequestAuthenticator {
case ADMIN: case ADMIN:
if (authResult.userAuthInfo().isPresent() if (authResult.userAuthInfo().isPresent()
&& !authResult.userAuthInfo().get().isUserAdmin()) { && !authResult.userAuthInfo().get().isUserAdmin()) {
logger.info("Not authorized; user policy is ADMIN, but the user was not an admin"); logger.warning("Not authorized; user policy is ADMIN, but the user was not an admin");
return Optional.absent(); return Optional.absent();
} }
break; break;