]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10886 Set LogLevel to WARN for authentication issues (#802)
authorBenoit <43733395+benoit-sns@users.noreply.github.com>
Wed, 10 Oct 2018 15:09:03 +0000 (15:09 +0000)
committerSonarTech <sonartech@sonarsource.com>
Wed, 10 Oct 2018 18:20:59 +0000 (20:20 +0200)
server/sonar-server/src/main/java/org/sonar/server/authentication/AuthenticationError.java
server/sonar-server/src/test/java/org/sonar/server/authentication/InitFilterTest.java
server/sonar-server/src/test/java/org/sonar/server/authentication/OAuth2CallbackFilterTest.java

index 81ccb80a258ec6f90a5d50112a025628802a5497..7461ea56cc5f5bf0eb77cf985bc55577b8825b8f 100644 (file)
@@ -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);
   }
 
index c4b4dd7d0b79db901e61714db3e6f8379a625e6e..935b29d3e6182711837088b64e8e9940b5f3a403 100644 (file)
@@ -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();
   }
index b394b99790124732da38139484c2c3a840d38414..771bfe9fa9d66da71867337f8a0954cee6df409f 100644 (file)
@@ -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();
   }