Fix stray locations where Jetty updates were missed
MODIFY
gateway/platforms/war/micro/src/main/java/io/apiman/gateway/platforms/war/micro/GatewayMicroService.java
gateway/platforms/war/micro/src/main/java/io/apiman/gateway/platforms/war/micro/GatewayMicroService.java
@@ -51,6 +51,7 @@ import javax.servlet.DispatcherType;
import org.eclipse.jetty.security.ConstraintSecurityHandler;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.security.SecurityHandler;
+import org.eclipse.jetty.security.UserStore;
import org.eclipse.jetty.security.authentication.BasicAuthenticator;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
@@ -356,8 +357,10 @@ public class GatewayMicroService {
*/
protected SecurityHandler createSecurityHandler() throws Exception {
HashLoginService l = new HashLoginService();
+ UserStore userStore = new UserStore();
+ l.setUserStore(userStore);
for (User user : Users.getUsers()) {
- l.putUser(user.getId(), Credential.getCredential(user.getPassword()), user.getRolesAsArray());
+ userStore.addUser(user.getId(), Credential.getCredential(user.getPassword()), user.getRolesAsArray());
}
l.setName("apimanrealm");

MODIFY
manager/api/micro/src/main/java/io/apiman/manager/api/micro/ManagerApiMicroService.java
manager/api/micro/src/main/java/io/apiman/manager/api/micro/ManagerApiMicroService.java
@@ -23,7 +23,6 @@ import io.apiman.common.servlet.RootResourceFilter;
import io.apiman.manager.api.micro.util.ApimanResource;
import io.apiman.manager.api.security.impl.DefaultSecurityContextFilter;
-import java.net.MalformedURLException;
import java.net.URL;
import java.util.EnumSet;
@@ -32,6 +31,7 @@ import javax.servlet.DispatcherType;
import org.eclipse.jetty.security.ConstraintSecurityHandler;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.security.SecurityHandler;
+import org.eclipse.jetty.security.UserStore;
import org.eclipse.jetty.security.authentication.BasicAuthenticator;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.HandlerCollection;
@@ -138,7 +138,7 @@ public class ManagerApiMicroService {
* @see org.eclipse.jetty.server.handler.ResourceHandler#getResource(java.lang.String)
*/
@Override
- public Resource getResource(String path) throws MalformedURLException {
+ public Resource getResource(String path) {
Resource resource = null;
if (path == null || path.equals("/") || path.equals("/index.html")) {
@@ -216,8 +216,11 @@ public class ManagerApiMicroService {
*/
protected SecurityHandler createSecurityHandler() throws Exception {
HashLoginService l = new HashLoginService();
+ // UserStore is now separate store entity and must be added to HashLoginService
+ UserStore userStore = new UserStore();
+ l.setUserStore(userStore);
for (User user : Users.getUsers()) {
- l.putUser(user.getId(), Credential.getCredential(user.getPassword()), user.getRolesAsArray());
+ userStore.addUser(user.getId(), Credential.getCredential(user.getPassword()), user.getRolesAsArray());
}
l.setName("apimanrealm");

MODIFY
manager/test/api/src/main/java/io/apiman/manager/test/server/ManagerApiTestServer.java
manager/test/api/src/main/java/io/apiman/manager/test/server/ManagerApiTestServer.java
@@ -48,6 +48,7 @@ import org.apache.commons.dbcp.BasicDataSource;
import org.eclipse.jetty.security.ConstraintSecurityHandler;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.security.SecurityHandler;
+import org.eclipse.jetty.security.UserStore;
import org.eclipse.jetty.security.authentication.BasicAuthenticator;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
@@ -321,13 +322,17 @@ public class ManagerApiTestServer {
*/
private SecurityHandler createSecurityHandler() {
HashLoginService l = new HashLoginService();
+ UserStore userStore = new UserStore();
+ l.setUserStore(userStore);
+
for (String [] userInfo : TestUsers.USERS) {
String user = userInfo[0];
String pwd = userInfo[1];
String[] roles = new String[] { "apiuser" };
- if (user.startsWith("admin"))
+ if (user.startsWith("admin")) {
roles = new String[] { "apiuser", "apiadmin"};
- l.putUser(user, Credential.getCredential(pwd), roles);
+ }
+ userStore.addUser(user, Credential.getCredential(pwd), roles);
}
l.setName("apimanrealm");

MODIFY
manager/test/api/src/test/resources/test-plan-data/import/001_import.resttest
manager/test/api/src/test/resources/test-plan-data/import/001_import.resttest
@@ -367,7 +367,7 @@ Content-Type: application/json
}
----
200
-Content-Type: text/plain;charset=UTF-8
+Content-Type: text/plain;charset=utf-8
INFO: ----------------------------
INFO: Starting apiman data import.

MODIFY
manager/test/api/src/test/resources/test-plan-data/migrate/001_import-1.2.2.Final.resttest
manager/test/api/src/test/resources/test-plan-data/migrate/001_import-1.2.2.Final.resttest
@@ -1573,7 +1573,7 @@ Content-Type: application/json
}
----
200
-Content-Type: text/plain;charset=UTF-8
+Content-Type: text/plain;charset=utf-8
INFO: Migrating export data from old version 1.2.2.Final.
INFO: Migrating User: "admin"

Fix stray locations where Jetty updates were missed