]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8416 AuthenticationException message start with upper case
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Tue, 3 Jan 2017 15:15:36 +0000 (16:15 +0100)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 5 Jan 2017 10:11:47 +0000 (11:11 +0100)
server/sonar-server/src/main/java/org/sonar/server/authentication/BasicAuthenticator.java
server/sonar-server/src/main/java/org/sonar/server/authentication/JwtCsrfVerifier.java
server/sonar-server/src/main/java/org/sonar/server/authentication/RealmAuthenticator.java
server/sonar-server/src/main/java/org/sonar/server/authentication/UserIdentityAuthenticator.java
server/sonar-server/src/main/java/org/sonar/server/authentication/ws/LoginAction.java
server/sonar-server/src/test/java/org/sonar/server/authentication/JwtCsrfVerifierTest.java
server/sonar-server/src/test/java/org/sonar/server/authentication/RealmAuthenticatorTest.java
server/sonar-server/src/test/java/org/sonar/server/authentication/UserIdentityAuthenticatorTest.java

index d0a97a734b3f78e1453c9d04fa77042da64cb637..ea718d2f5b5f5c60c94c83422e33af70003827be 100644 (file)
@@ -77,7 +77,7 @@ public class BasicAuthenticator {
     if (semiColonPos <= 0) {
       throw AuthenticationException.newBuilder()
         .setSource(Source.local(Method.BASIC))
-        .setMessage("decoded basic auth does not contain ':'")
+        .setMessage("Decoded basic auth does not contain ':'")
         .build();
     }
     String login = basicAuthDecoded.substring(0, semiColonPos);
index 18e460a1a329a51d1a30862d376e6f4b04b95a8c..c8dd8b3e76f407f1c390788554b621d17e026f19 100644 (file)
@@ -80,10 +80,10 @@ public class JwtCsrfVerifier {
   @CheckForNull
   private static String checkCsrf(@Nullable String csrfState, @Nullable String stateInHeader) {
     if (isBlank(csrfState)) {
-      return "missing reference CSRF value";
+      return "Missing reference CSRF value";
     }
     if (!StringUtils.equals(csrfState, stateInHeader)) {
-      return "wrong CSFR in request";
+      return "Wrong CSFR in request";
     }
     return null;
   }
index 72c8588cf853112314a2d0ba579f1776898ad6fe..0a0367f1cc7c5ea8cc900054fa85352df7bbebc1 100644 (file)
@@ -105,7 +105,7 @@ public class RealmAuthenticator implements Startable {
         throw AuthenticationException.newBuilder()
           .setSource(realmEventSource(method))
           .setLogin(userLogin)
-          .setMessage("realm returned authenticate=false")
+          .setMessage("Realm returned authenticate=false")
           .build();
       }
       UserDto userDto = synchronize(userLogin, details, request, method);
index 662338394ce5bc8cdc1059b31039e193b295969b..8ad01f7f37a663f44a673cde7236f7d0e1451bfe 100644 (file)
@@ -88,7 +88,7 @@ public class UserIdentityAuthenticator {
       throw AuthenticationException.newBuilder()
         .setSource(source)
         .setLogin(user.getLogin())
-        .setMessage("user signup disabled for provider '" + provider.getKey() + "'")
+        .setMessage("User signup disabled for provider '" + provider.getKey() + "'")
         .setPublicMessage(format("'%s' users are not allowed to sign up", provider.getKey()))
         .build();
     }
@@ -98,7 +98,7 @@ public class UserIdentityAuthenticator {
       throw AuthenticationException.newBuilder()
         .setSource(source)
         .setLogin(user.getLogin())
-        .setMessage(format("email '%s' is already used", email))
+        .setMessage(format("Email '%s' is already used", email))
         .setPublicMessage(format(
           "You can't sign up because email '%s' is already used by an existing user. This means that you probably already registered with another account.",
           email))
index c7afb3f134cbc2cb57675e39a8ad9feec3299be2..0f862cd5309f49b7e8ba424acdc61f89308d37bb 100644 (file)
@@ -102,7 +102,7 @@ public class LoginAction extends ServletFilter {
       throw AuthenticationException.newBuilder()
         .setSource(Source.local(Method.FORM))
         .setLogin(login)
-        .setMessage("empty login and/or password")
+        .setMessage("Empty login and/or password")
         .build();
     }
     return credentialsAuthenticator.authenticate(login, password, request, Method.FORM);
index d3044aa63752c0eab93b1b61c09c90b59eff67cd..fc4e0b373f46111d1646f53954d07cc7f01194d4 100644 (file)
@@ -81,7 +81,7 @@ public class JwtCsrfVerifierTest {
     mockPostJavaWsRequest();
 
     thrown.expect(authenticationException().from(Source.local(Method.JWT)).withLogin(LOGIN).andNoPublicMessage());
-    thrown.expectMessage("wrong CSFR in request");
+    thrown.expectMessage("Wrong CSFR in request");
     underTest.verifyState(request, CSRF_STATE, LOGIN);
   }
 
@@ -91,7 +91,7 @@ public class JwtCsrfVerifierTest {
     mockPostJavaWsRequest();
 
     thrown.expect(authenticationException().from(Source.local(Method.JWT)).withLogin(LOGIN).andNoPublicMessage());
-    thrown.expectMessage("missing reference CSRF value");
+    thrown.expectMessage("Missing reference CSRF value");
     underTest.verifyState(request, null, LOGIN);
   }
 
@@ -101,7 +101,7 @@ public class JwtCsrfVerifierTest {
     mockPostJavaWsRequest();
 
     thrown.expect(authenticationException().from(Source.local(Method.JWT)).withLogin(LOGIN).andNoPublicMessage());
-    thrown.expectMessage("missing reference CSRF value");
+    thrown.expectMessage("Missing reference CSRF value");
     underTest.verifyState(request, "", LOGIN);
   }
 
@@ -112,7 +112,7 @@ public class JwtCsrfVerifierTest {
     when(request.getMethod()).thenReturn("POST");
 
     thrown.expect(authenticationException().from(Source.local(Method.JWT)).withLogin(LOGIN).andNoPublicMessage());
-    thrown.expectMessage("wrong CSFR in request");
+    thrown.expectMessage("Wrong CSFR in request");
     underTest.verifyState(request, CSRF_STATE, LOGIN);
   }
 
@@ -123,7 +123,7 @@ public class JwtCsrfVerifierTest {
     when(request.getMethod()).thenReturn("PUT");
 
     thrown.expect(authenticationException().from(Source.local(Method.JWT)).withLogin(LOGIN).andNoPublicMessage());
-    thrown.expectMessage("wrong CSFR in request");
+    thrown.expectMessage("Wrong CSFR in request");
     underTest.verifyState(request, CSRF_STATE, LOGIN);
   }
 
@@ -134,7 +134,7 @@ public class JwtCsrfVerifierTest {
     when(request.getMethod()).thenReturn("DELETE");
 
     thrown.expect(authenticationException().from(Source.local(Method.JWT)).withLogin(LOGIN).andNoPublicMessage());
-    thrown.expectMessage("wrong CSFR in request");
+    thrown.expectMessage("Wrong CSFR in request");
     underTest.verifyState(request, CSRF_STATE, LOGIN);
   }
 
index 1256494838ea22056bc20bb6693b133e9d0be579..bb10f2dd6ef038baa7fa7eeba61e6afc4b268e52 100644 (file)
@@ -256,7 +256,7 @@ public class RealmAuthenticatorTest {
     when(authenticator.doAuthenticate(any(Authenticator.Context.class))).thenReturn(false);
 
     expectedException.expect(authenticationException().from(Source.realm(BASIC, REALM_NAME)).withLogin(LOGIN).andNoPublicMessage());
-    expectedException.expectMessage("realm returned authenticate=false");
+    expectedException.expectMessage("Realm returned authenticate=false");
     try {
       underTest.authenticate(LOGIN, PASSWORD, request, BASIC);
     } finally {
index 767e79a4318cbe7981d417a45577ed3bc586124f..f43887d40a100dd0ec23e038c83f5479471c8662 100644 (file)
@@ -362,7 +362,7 @@ public class UserIdentityAuthenticatorTest {
     Source source = Source.realm(Method.FORM, identityProvider.getName());
 
     thrown.expect(authenticationException().from(source).withLogin(USER_IDENTITY.getLogin()).andPublicMessage("'github' users are not allowed to sign up"));
-    thrown.expectMessage("user signup disabled for provider 'github'");
+    thrown.expectMessage("User signup disabled for provider 'github'");
     underTest.authenticate(USER_IDENTITY, identityProvider, source);
   }
 
@@ -378,7 +378,7 @@ public class UserIdentityAuthenticatorTest {
       .withLogin(USER_IDENTITY.getLogin())
       .andPublicMessage("You can't sign up because email 'john@email.com' is already used by an existing user. " +
         "This means that you probably already registered with another account."));
-    thrown.expectMessage("email 'john@email.com' is already used");
+    thrown.expectMessage("Email 'john@email.com' is already used");
     underTest.authenticate(USER_IDENTITY, IDENTITY_PROVIDER, source);
   }