aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit <43733395+benoit-sns@users.noreply.github.com>2018-10-10 15:09:03 +0000
committerSonarTech <sonartech@sonarsource.com>2018-10-10 20:20:59 +0200
commit7ace2cff0f951a906529fa78d25a8756b47ad550 (patch)
tree2c7337ba7b789fe4e34b2520d1683090bc3222cb
parent9a959a25ad594aad34b5edb1baf2b678b0b04053 (diff)
downloadsonarqube-7ace2cff0f951a906529fa78d25a8756b47ad550.tar.gz
sonarqube-7ace2cff0f951a906529fa78d25a8756b47ad550.zip
SONAR-10886 Set LogLevel to WARN for authentication issues (#802)
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/authentication/AuthenticationError.java4
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/authentication/InitFilterTest.java4
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/authentication/OAuth2CallbackFilterTest.java4
3 files changed, 6 insertions, 6 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/authentication/AuthenticationError.java b/server/sonar-server/src/main/java/org/sonar/server/authentication/AuthenticationError.java
index 81ccb80a258..7461ea56cc5 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/authentication/AuthenticationError.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/authentication/AuthenticationError.java
@@ -39,12 +39,12 @@ final class AuthenticationError {
}
static void handleError(Exception e, HttpServletResponse response, String message) {
- LOGGER.error(message, e);
+ LOGGER.warn(message, e);
redirectToUnauthorized(response);
}
static void handleError(HttpServletResponse response, String message) {
- LOGGER.error(message);
+ LOGGER.warn(message);
redirectToUnauthorized(response);
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/authentication/InitFilterTest.java b/server/sonar-server/src/test/java/org/sonar/server/authentication/InitFilterTest.java
index c4b4dd7d0b7..935b29d3e61 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/authentication/InitFilterTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/authentication/InitFilterTest.java
@@ -239,7 +239,7 @@ public class InitFilterTest {
underTest.doFilter(request, response, chain);
verify(response).sendRedirect("/sessions/unauthorized");
- assertThat(logTester.logs(LoggerLevel.ERROR)).containsExactlyInAnyOrder("Fail to initialize authentication with provider 'failing'");
+ assertThat(logTester.logs(LoggerLevel.WARN)).containsExactlyInAnyOrder("Fail to initialize authentication with provider 'failing'");
verifyDeleteAuthCookie();
}
@@ -254,7 +254,7 @@ public class InitFilterTest {
}
private void assertError(String expectedError) throws Exception {
- assertThat(logTester.logs(LoggerLevel.ERROR)).contains(expectedError);
+ assertThat(logTester.logs(LoggerLevel.WARN)).contains(expectedError);
verify(response).sendRedirect("/sessions/unauthorized");
assertThat(oAuth2IdentityProvider.isInitCalled()).isFalse();
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/authentication/OAuth2CallbackFilterTest.java b/server/sonar-server/src/test/java/org/sonar/server/authentication/OAuth2CallbackFilterTest.java
index b394b997901..771bfe9fa9d 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/authentication/OAuth2CallbackFilterTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/authentication/OAuth2CallbackFilterTest.java
@@ -189,7 +189,7 @@ public class OAuth2CallbackFilterTest {
underTest.doFilter(request, response, chain);
verify(response).sendRedirect("/sessions/unauthorized");
- assertThat(logTester.logs(LoggerLevel.ERROR)).containsExactlyInAnyOrder("Fail to callback authentication with 'failing'");
+ assertThat(logTester.logs(LoggerLevel.WARN)).containsExactlyInAnyOrder("Fail to callback authentication with 'failing'");
verify(oAuthRedirection).delete(eq(request), eq(response));
}
@@ -222,7 +222,7 @@ public class OAuth2CallbackFilterTest {
}
private void assertError(String expectedError) throws Exception {
- assertThat(logTester.logs(LoggerLevel.ERROR)).contains(expectedError);
+ assertThat(logTester.logs(LoggerLevel.WARN)).contains(expectedError);
verify(response).sendRedirect("/sessions/unauthorized");
assertThat(oAuth2IdentityProvider.isInitCalled()).isFalse();
}