Commits

Sebastian Sdorra  committed 0400054

fix bug with passwords which contains a colon

  • Participants
  • Parent commits e24b638
  • Branches issue-516

Comments (0)

Files changed (1)

File scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/web/HgHookCallbackServlet.java

 
       if (Util.isNotEmpty(credentials))
       {
-        String[] credentialsArray = credentials.split(":");
+        int index = credentials.indexOf(':');
 
-        if (credentialsArray.length >= 2)
+        if (index > 0 && index < credentials.length())
         {
           Subject subject = SecurityUtils.getSubject();
 
-          subject.login(Tokens.createAuthenticationToken(request,
-            credentialsArray[0], credentialsArray[1]));
+          //J-
+          subject.login(
+            Tokens.createAuthenticationToken(
+              request, 
+              credentials.substring(0, index), 
+              credentials.substring(index + 1)
+            )
+          );
+          //J+
+        }
+        else
+        {
+          logger.error("could not find delimiter");
         }
       }
     }