Bump jetty from 9.3.24 to 9.4.11 to match karaf 4.2.1

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/84df4c58
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/84df4c58
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/84df4c58

Branch: refs/heads/master
Commit: 84df4c582f95e37115280ed90fd0191107f5480c
Parents: e009248
Author: Paul Campbell <paul.campb...@cloudsoft.io>
Authored: Thu Sep 27 13:18:22 2018 +0100
Committer: Paul Campbell <paul.campb...@cloudsoft.io>
Committed: Thu Sep 27 13:18:22 2018 +0100

----------------------------------------------------------------------
 .../apache/brooklyn/core/test/HttpService.java  | 31 +++++++++++++-------
 .../launcher/WebAppContextProvider.java         |  5 ++--
 pom.xml                                         |  2 +-
 3 files changed, 24 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/84df4c58/core/src/test/java/org/apache/brooklyn/core/test/HttpService.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/test/HttpService.java 
b/core/src/test/java/org/apache/brooklyn/core/test/HttpService.java
index b2ff422..2cb53e8 100644
--- a/core/src/test/java/org/apache/brooklyn/core/test/HttpService.java
+++ b/core/src/test/java/org/apache/brooklyn/core/test/HttpService.java
@@ -28,10 +28,7 @@ import java.io.InputStream;
 import java.net.InetAddress;
 import java.security.KeyStore;
 
-import org.eclipse.jetty.security.ConstraintMapping;
-import org.eclipse.jetty.security.ConstraintSecurityHandler;
-import org.eclipse.jetty.security.HashLoginService;
-import org.eclipse.jetty.security.SecurityHandler;
+import org.eclipse.jetty.security.*;
 import org.eclipse.jetty.security.authentication.BasicAuthenticator;
 import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Server;
@@ -92,11 +89,8 @@ public class HttpService {
      * Enables basic HTTP authentication on the server.
      */
     public HttpService basicAuthentication(String username, String password) {
-        HashLoginService l = new HashLoginService();
-        l.putUser(username, Credential.getCredential(password), new 
String[]{"user"});
-        l.setName("test-realm");
-
-        Constraint constraint = new Constraint(Constraint.__BASIC_AUTH, 
"user");
+        final String userRole = "user";
+        Constraint constraint = new Constraint(Constraint.__BASIC_AUTH, 
userRole);
         constraint.setAuthenticate(true);
 
         ConstraintMapping constraintMapping = new ConstraintMapping();
@@ -105,15 +99,30 @@ public class HttpService {
 
         ConstraintSecurityHandler csh = new ConstraintSecurityHandler();
         csh.setAuthenticator(new BasicAuthenticator());
-        csh.setRealmName("test-realm");
+        final String realmName = "test-realm";
+        csh.setRealmName(realmName);
         csh.addConstraintMapping(constraintMapping);
-        csh.setLoginService(l);
+        csh.setLoginService(createLoginService(realmName, username, password, 
new String[]{userRole}));
 
         this.securityHandler = Optional.of(csh);
 
         return this;
     }
 
+    private LoginService createLoginService(
+            final String serviceName, final String username, final String 
password, final String[] roles) {
+        final HashLoginService loginService = new HashLoginService();
+        loginService.setName(serviceName);
+        loginService.setUserStore(createUserStore(username, password, roles));
+        return loginService;
+    }
+
+    private UserStore createUserStore(final String username, final String 
password, final String[] roles) {
+        final UserStore userStore = new UserStore();
+        userStore.addUser(username, Credential.getCredential(password), roles);
+        return userStore;
+    }
+
     public HttpService start() throws Exception {
         
TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), 
ROOT_WAR_PATH);
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/84df4c58/launcher/src/main/java/org/apache/brooklyn/launcher/WebAppContextProvider.java
----------------------------------------------------------------------
diff --git 
a/launcher/src/main/java/org/apache/brooklyn/launcher/WebAppContextProvider.java
 
b/launcher/src/main/java/org/apache/brooklyn/launcher/WebAppContextProvider.java
index 840e541..236bf75 100644
--- 
a/launcher/src/main/java/org/apache/brooklyn/launcher/WebAppContextProvider.java
+++ 
b/launcher/src/main/java/org/apache/brooklyn/launcher/WebAppContextProvider.java
@@ -31,7 +31,6 @@ import org.apache.brooklyn.util.core.ResourceUtils;
 import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.apache.brooklyn.util.os.Os;
 import org.apache.brooklyn.util.text.Identifiers;
-import org.eclipse.jetty.server.SessionManager;
 import org.eclipse.jetty.webapp.WebAppContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -76,7 +75,9 @@ public class WebAppContextProvider {
         // it might be better to make this brooklyn-only or base on the 
management-plane ID;
         // but i think it actually *is* per-server instance, since we don't 
cache sessions server-side,
         // so i think this is write. [Alex 2015-09]
-        context.setInitParameter(SessionManager.__SessionCookieProperty, 
SessionManager.__DefaultSessionCookie + "_" + "BROOKLYN" + 
Identifiers.makeRandomId(6));
+        final String sessionCookieProperty = 
"org.eclipse.jetty.servlet.SessionCookie";
+        final String cookieValue = "JSESSIONID_BROOKLYN" + 
Identifiers.makeRandomId(6);
+        context.setInitParameter(sessionCookieProperty, cookieValue);
         
context.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", 
"false");
         
context.setAttribute(BrooklynServiceAttributes.BROOKLYN_MANAGEMENT_CONTEXT, 
managementContext);
         for (Map.Entry<String, Object> attributeEntry : attributes.entrySet()) 
{

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/84df4c58/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 706030d..4496e0d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -165,7 +165,7 @@
         <karaf.version>4.2.1</karaf.version>
         <karaf.plugin.version>${karaf.version}</karaf.plugin.version>
         <felix.framework.version>5.6.10</felix.framework.version>
-        <jetty.version>9.3.24.v20180605</jetty.version>
+        <jetty.version>9.4.11.v20180605</jetty.version>
 
         <!-- Transitive dependencies, declared explicitly to avoid version 
mismatch -->
         <clojure.version>1.4.0</clojure.version>

Reply via email to