diff --git a/boost-common/src/main/java/org/microshed/boost/common/boosters/JDBCBoosterConfig.java b/boost-common/src/main/java/org/microshed/boost/common/boosters/JDBCBoosterConfig.java index d560c7af..16cdd8cd 100644 --- a/boost-common/src/main/java/org/microshed/boost/common/boosters/JDBCBoosterConfig.java +++ b/boost-common/src/main/java/org/microshed/boost/common/boosters/JDBCBoosterConfig.java @@ -122,11 +122,13 @@ public Properties getDatasourceProperties() { // Verify correct property configuration if (dependency.contains(DERBY_GROUP_ID)) { - // If there's no DB name and there's no server name then we can create an embedded DB at a default location - if ((!datasourceProperties.containsKey(BoostProperties.DATASOURCE_DATABASE_NAME)) && - (!datasourceProperties.containsKey(BoostProperties.DATASOURCE_SERVER_NAME))) { + // If there's no DB name and there's no server name then we can create an + // embedded DB at a default location + if ((!datasourceProperties.containsKey(BoostProperties.DATASOURCE_DATABASE_NAME)) + && (!datasourceProperties.containsKey(BoostProperties.DATASOURCE_SERVER_NAME))) { datasourceProperties.put(BoostProperties.DATASOURCE_DATABASE_NAME, DERBY_DB); - // Though we want to auto-create our default location DB, I guess if someone already specified a property will honor it + // Though we want to auto-create our default location DB, I guess if someone + // already specified a property will honor it // even though not sure how useful that would be. if (!datasourceProperties.containsKey(BoostProperties.DATASOURCE_CREATE_DATABASE)) { datasourceProperties.put(BoostProperties.DATASOURCE_CREATE_DATABASE, "create"); diff --git a/boost-common/src/main/java/org/microshed/boost/common/boosters/MPJWTBoosterConfig.java b/boost-common/src/main/java/org/microshed/boost/common/boosters/MPJWTBoosterConfig.java index fa480abd..c50424ca 100644 --- a/boost-common/src/main/java/org/microshed/boost/common/boosters/MPJWTBoosterConfig.java +++ b/boost-common/src/main/java/org/microshed/boost/common/boosters/MPJWTBoosterConfig.java @@ -13,7 +13,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; - +import java.util.Properties; import org.microshed.boost.common.BoostException; import org.microshed.boost.common.BoostLoggerI; import org.microshed.boost.common.boosters.AbstractBoosterConfig.BoosterCoordinates; @@ -22,12 +22,35 @@ @BoosterCoordinates(AbstractBoosterConfig.BOOSTERS_GROUP_ID + ":mp-jwt") public class MPJWTBoosterConfig extends AbstractBoosterConfig { + protected Properties boostMPProperties; + // assuming properties will be configured with underscore + private final static String JWT_ISSUER = "mp_jwt_verify_issuer"; + private final static String JWT_PUBLIC_KEY = "mp_jwt_verify_publickey"; + private final static String JWT_PUBLIC_KEY_LOCATION = "mp_jwt_verify_publickey_location"; + public MPJWTBoosterConfig(BoosterConfigParams params, BoostLoggerI logger) throws BoostException { super(params.getProjectDependencies().get(getCoordinates(MPJWTBoosterConfig.class))); + + boostMPProperties = new Properties(); + Properties inputProp = params.getBoostProperties(); + String issuer = inputProp.getProperty(JWT_ISSUER); + String publicKey = inputProp.getProperty(JWT_PUBLIC_KEY); + String publicKeyLoc = inputProp.getProperty(JWT_PUBLIC_KEY_LOCATION); + logger.info("Issuer = " + issuer); + logger.info("public key = " + publicKey); + logger.info("public key loc = " + publicKeyLoc); + if (issuer != null) + boostMPProperties.setProperty(JWT_ISSUER, issuer); + if (publicKey != null) + boostMPProperties.setProperty(JWT_PUBLIC_KEY, publicKey); + else if (publicKeyLoc != null) + boostMPProperties.setProperty(JWT_PUBLIC_KEY_LOCATION, publicKeyLoc); + } @Override public List getDependencies() { return new ArrayList(); } + } diff --git a/boost-common/src/main/java/org/microshed/boost/common/config/BoostProperties.java b/boost-common/src/main/java/org/microshed/boost/common/config/BoostProperties.java index c363589a..2e2b8d28 100644 --- a/boost-common/src/main/java/org/microshed/boost/common/config/BoostProperties.java +++ b/boost-common/src/main/java/org/microshed/boost/common/config/BoostProperties.java @@ -21,6 +21,7 @@ public final class BoostProperties { // Boost specific public static final String BOOST_PROP_PREFIX = "boost_"; + public static final String BOOST_PROP_MP_PREFIX = "mp_"; // HTTP Endpoint properties public static final String ENDPOINT_HOST = "boost_http_host"; @@ -64,10 +65,8 @@ public static Properties getConfiguredBoostProperties(Properties projectProperti // system properties (set at command line) for (Map.Entry entry : projectProperties.entrySet()) { - if (entry.getKey().toString().startsWith(BOOST_PROP_PREFIX)) { - - // logger.debug("Found boost property: " + - // entry.getKey() + ":" + entry.getValue()); + if (entry.getKey().toString().startsWith(BOOST_PROP_PREFIX) + || entry.getKey().toString().startsWith(BOOST_PROP_MP_PREFIX)) { boostProperties.put(entry.getKey(), entry.getValue()); } diff --git a/boost-common/src/main/java/org/microshed/boost/common/config/BoosterConfigParams.java b/boost-common/src/main/java/org/microshed/boost/common/config/BoosterConfigParams.java index 76adbac9..e64960ca 100644 --- a/boost-common/src/main/java/org/microshed/boost/common/config/BoosterConfigParams.java +++ b/boost-common/src/main/java/org/microshed/boost/common/config/BoosterConfigParams.java @@ -15,18 +15,18 @@ public class BoosterConfigParams { - Map projectDependencies; + Map projectDependencies; Properties boostProperties; public BoosterConfigParams(Map projectDependencies, Properties boostProperties) { - this.projectDependencies = projectDependencies; - this.boostProperties = boostProperties; + this.projectDependencies = projectDependencies; + this.boostProperties = boostProperties; } - + public Map getProjectDependencies() { return this.projectDependencies; } - + public Properties getBoostProperties() { return this.boostProperties; } diff --git a/boost-common/src/main/java/org/microshed/boost/common/runtimes/RuntimeI.java b/boost-common/src/main/java/org/microshed/boost/common/runtimes/RuntimeI.java index 0a8cf869..f1b9dc32 100644 --- a/boost-common/src/main/java/org/microshed/boost/common/runtimes/RuntimeI.java +++ b/boost-common/src/main/java/org/microshed/boost/common/runtimes/RuntimeI.java @@ -13,15 +13,15 @@ import org.microshed.boost.common.BoostException; public abstract interface RuntimeI { - + public void doPackage() throws BoostException; - + public void doDebug(boolean clean) throws BoostException; - + public void doRun(boolean clean) throws BoostException; - + public void doStart(boolean clean, int verifyTimeout, int serverStartTimeout) throws BoostException; - + public void doStop() throws BoostException; } diff --git a/boost-maven/boost-maven-plugin/src/it/test-jdbc-db2/src/test/java/it/Db2PropertiesIT.java b/boost-maven/boost-maven-plugin/src/it/test-jdbc-db2/src/test/java/it/Db2PropertiesIT.java index d299a68d..ff2d01a0 100644 --- a/boost-maven/boost-maven-plugin/src/it/test-jdbc-db2/src/test/java/it/Db2PropertiesIT.java +++ b/boost-maven/boost-maven-plugin/src/it/test-jdbc-db2/src/test/java/it/Db2PropertiesIT.java @@ -48,6 +48,7 @@ public void checkPropertiesTest() throws Exception { // AES hashed password changes so we're just going to look for the // aes flag. + assertTrue("Incorrect boost_db_password found in generated config", LibertyConfigFileUtils .findVariableInXml(variablesXml, DATASOURCE_PASSWORD).contains(AES_HASHED_PASSWORD_FLAG)); } diff --git a/boost-maven/boost-maven-plugin/src/it/test-jdbc-db2/src/test/java/utils/LibertyConfigFileUtils.java b/boost-maven/boost-maven-plugin/src/it/test-jdbc-db2/src/test/java/utils/LibertyConfigFileUtils.java index 1972f2b2..affdfdd9 100644 --- a/boost-maven/boost-maven-plugin/src/it/test-jdbc-db2/src/test/java/utils/LibertyConfigFileUtils.java +++ b/boost-maven/boost-maven-plugin/src/it/test-jdbc-db2/src/test/java/utils/LibertyConfigFileUtils.java @@ -28,23 +28,22 @@ public class LibertyConfigFileUtils { - public static String findVariableInXml(String variablesXmlPath, String variableName) - throws Exception { + public static String findVariableInXml(String variablesXmlPath, String variableName) throws Exception { String variableValue = null; - + File variablesXml = new File(variablesXmlPath); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(variablesXml); Element serverRoot = doc.getDocumentElement(); - + List variablesList = getDirectChildrenByTag(serverRoot, "variable"); for (Element variable : variablesList) { - if (variableName.equals(variable.getAttribute("name"))) { - variableValue = variable.getAttribute("defaultValue"); - } + if (variableName.equals(variable.getAttribute("name"))) { + variableValue = variable.getAttribute("defaultValue"); + } } return variableValue; diff --git a/boost-maven/boost-maven-plugin/src/it/test-mp-health-2.0/src/main/java/io/openliberty/guides/inventory/InventoryUtils.java b/boost-maven/boost-maven-plugin/src/it/test-mp-health-2.0/src/main/java/io/openliberty/guides/inventory/InventoryUtils.java index aea4f197..dad000fe 100644 --- a/boost-maven/boost-maven-plugin/src/it/test-mp-health-2.0/src/main/java/io/openliberty/guides/inventory/InventoryUtils.java +++ b/boost-maven/boost-maven-plugin/src/it/test-mp-health-2.0/src/main/java/io/openliberty/guides/inventory/InventoryUtils.java @@ -67,8 +67,7 @@ public void handleProcessingException(ProcessingException ex) { * - port number. * @param path * - Note that the path needs to start with a slash!!! - * @return String representation of the URI to the system properties - * service. + * @return String representation of the URI to the system properties service. */ // end::doc[] public static String buildUrl(String protocol, String host, int port, String path) { diff --git a/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/pom.xml b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/pom.xml new file mode 100755 index 00000000..94c75ecc --- /dev/null +++ b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/pom.xml @@ -0,0 +1,260 @@ + + 4.0.0 + boost + test-mpJwt-1.1 + 1.0-SNAPSHOT + war + + + + + + sonatype-nexus-snapshots + Sonatype Nexus Snapshots + https://oss.sonatype.org/content/repositories/snapshots/ + + true + + + false + + + + + + + jitpack.io + https://jitpack.io + + + mavenCentral + https://repo.maven.apache.org/maven2 + + + + + UTF-8 + UTF-8 + 1.8 + 1.8 + ${project.build.testOutputDirectory}/truststore/public.key + http://openliberty.io + + + + + + + org.microshed.boost.boms + mp20-bom + @pom.version@ + pom + import + + + + + + + + + + + org.microshed.boost.boosters + jaxrs + + + org.microshed.boost.boosters + jsonp + + + org.microshed.boost.boosters + cdi + + + org.microshed.boost.boosters + mp-config + + + org.microshed.boost.boosters + mp-jwt + + + + + org.glassfish + javax.json + 1.0.4 + test + + + org.apache.cxf + cxf-rt-rs-client + 3.2.6 + test + + + junit + junit + 4.12 + test + + + + org.springframework + spring-context + 4.3.9.RELEASE + test + + + com.github.dev-tools-for-enterprise-java + system-test + v0.1-alpha + test + + + + org.bitbucket.b_c + jose4j + 0.6.5 + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.8 + + + generate-resources + generate-resources + + + + + + + + + run + + + + + + + org.microshed.boost + boost-maven-plugin + @pom.version@ + + + + package + + + + test-start-server + pre-integration-test + + start + + + + test-stop-server + post-integration-test + + stop + + + + + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 3.0.0-M1 + + + integration-test + integration-test + + integration-test + + + + + ${mp_jwt_verify_publickey_location} + ${mp_jwt_verify_issuer} + + + + + verify-results + + verify + + + + + ${project.build.directory}/test-reports/microprofile-jwt/failsafe-summary.xml + ${project.build.directory}/test-reports/microprofile-jwt + + + + + + + ol + + + boostRuntime + ol + + + + + org.microshed.boost.runtimes + openliberty + + + + + wlp + + + boostRuntime + wlp + + + + + org.microshed.boost.runtimes + wlp + + + + + tomee + + + boostRuntime + tomee + + + + + org.microshed.boost.runtimes + tomee + + + + + diff --git a/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/main/java/io/openliberty/guides/inventory/JwtResource.java b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/main/java/io/openliberty/guides/inventory/JwtResource.java new file mode 100644 index 00000000..526fe34c --- /dev/null +++ b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/main/java/io/openliberty/guides/inventory/JwtResource.java @@ -0,0 +1,73 @@ +// tag::copyright[] +/******************************************************************************* + * Copyright (c) 2018 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - Initial implementation + *******************************************************************************/ +// end::copyright[] +// tag::jwt[] +package io.openliberty.guides.inventory; + +import java.util.Set; +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Context; +import org.eclipse.microprofile.jwt.JsonWebToken; +import javax.annotation.security.RolesAllowed; +import javax.ws.rs.core.SecurityContext; +import java.security.Principal; + +@RequestScoped +@Path("jwt") +public class JwtResource { + // The JWT of the current caller. Since this is a request scoped resource, the + // JWT will be injected for each JAX-RS request. The injection is performed by + // the mpJwt-1.1 feature. + @Inject + private JsonWebToken jwtPrincipal; + + @GET + @RolesAllowed({ "admin", "user" }) + @Path("/username") + public Response getJwtUsername() { + System.out.println("Returning JWT User Name"); + return Response.ok(this.jwtPrincipal.getName()).build(); + } + + @GET + @RolesAllowed({ "admin", "user" }) + @Path("/groups") + public Response getJwtGroups(@Context SecurityContext securityContext) { + Set groups = null; + Principal user = securityContext.getUserPrincipal(); + if (user instanceof JsonWebToken) { + JsonWebToken jwt = (JsonWebToken) user; + groups = jwt.getGroups(); + } + return Response.ok(groups.toString()).build(); + } + + @GET + @RolesAllowed({ "admin" }) + @Path("/customClaim") + public Response getCustomClaim(@Context SecurityContext securityContext) { + if (securityContext.isUserInRole("admin")) { + String customClaim = jwtPrincipal.getClaim("customClaim"); + return Response.ok(customClaim).build(); + } else { + System.out.println("Error user is not in role admin"); + return Response.status(Response.Status.FORBIDDEN).build(); + } + + } + +} +// end::jwt[] diff --git a/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/main/java/io/openliberty/guides/inventory/JwtResourceApplication.java b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/main/java/io/openliberty/guides/inventory/JwtResourceApplication.java new file mode 100755 index 00000000..2ea6d71a --- /dev/null +++ b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/main/java/io/openliberty/guides/inventory/JwtResourceApplication.java @@ -0,0 +1,22 @@ +// tag::copyright[] +/** + * ***************************************************************************** + * Copyright (c) 2018 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + *

Contributors: IBM Corporation - Initial implementation + * ***************************************************************************** + */ +// end::copyright[] +package io.openliberty.guides.inventory; + +// JAX-RS + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +@ApplicationPath("inventory") +public class JwtResourceApplication extends Application { +} diff --git a/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/main/webapp/WEB-INF/web.xml b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..a3823f10 --- /dev/null +++ b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,10 @@ + + + Liberty Project + + + index.html + + \ No newline at end of file diff --git a/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/main/webapp/index.html b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/main/webapp/index.html new file mode 100644 index 00000000..74ec6c74 --- /dev/null +++ b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/main/webapp/index.html @@ -0,0 +1,78 @@ + + + +

Welcome to your Liberty Application

+

Thanks for generating this project using the app accelerator. Please see below for some extra information on each of the technologies you chose

+ +
+

REST

+

+ For the complete feature documentation, see the jaxrs-2.0 + feature description in IBM Knowledge Center. +

+
+ +
+

MicroProfile

+

+ The MicroProfile project is an open + community with the aim of optimizing Enterprise Java for a microservices + architecture. MicroProfile will be evolving with guidance from the community. +

+

+ For the complete feature documentation, see the + microProfile-1.0 + feature description in IBM Knowledge Center. +

+

+ If you want to share your thoughts you can post straight to the + MicroProfile Google group. +

+
+
+
+ + diff --git a/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/test/java/it/jwt/JwtIT.java b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/test/java/it/jwt/JwtIT.java new file mode 100644 index 00000000..3a44e815 --- /dev/null +++ b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/test/java/it/jwt/JwtIT.java @@ -0,0 +1,116 @@ +// tag::copyright[] +/******************************************************************************* + * Copyright (c) 2018 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - Initial implementation + *******************************************************************************/ +// end::copyright[] +// tag::test[] +package it; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import org.junit.Test; +import org.junit.Before; +import jwt.util.TestUtils; +import jwt.util.JwtVerifier; +import jwt.util.JwtBuilder; + +import java.io.File; +import java.net.URL; +import java.net.URLClassLoader; + +public class JwtIT { + + private final String TESTNAME = "TESTUSER"; + private final String INV_JWT = "/inventory/jwt"; + + String baseUrl; + + String authHeader; + + String unauthHeader; + + @Before + public void setup() throws Exception { + // These tests is being temporarily skipped when running on TomEE + // until the failures are addressed. + String runtime = System.getProperty("boostRuntime"); + org.junit.Assume.assumeTrue("ol".equals(runtime) || "wlp".equals(runtime)); + String port = System.getProperty("boost_http_port"); + baseUrl = "http://localhost:" + port; + + JwtVerifier jwtvf = new JwtVerifier(); + // create header that should be authorized + authHeader = "Bearer " + jwtvf.createJwt(TESTNAME, "groups=admin"); + // create header that should NOT be authorized + unauthHeader = "Bearer " + jwtvf.createJwt(TESTNAME, "groups=user"); + + String mpPublicKeyLocation = System.getProperty("testcase.publickey.location"); + String mpIssuer = System.getProperty("testcase.issuer"); + + if (mpPublicKeyLocation != null) + JwtBuilder.storePublicKey(mpPublicKeyLocation); + else + throw new Exception("public key location is null"); + } + + /* + * @Test public void testIssuer() { this.testJwtGetIssuer(true); } + */ + + @Test + public void testSuiteGetName() { + this.testJwtGetName(true); + } + + @Test + public void testSuiteGetCustomClaim() { + this.testJwtGetCustomClaim(true); + } + + @Test + public void testSuiteGetCustomClaimUnauthorized() { + this.testJwtGetCustomClaim(false); + } + + public void testJwtGetName(boolean userAuthorized) { + String jwtUrl = baseUrl + INV_JWT + "/username"; + System.out.println("jwtURL = " + jwtUrl); + System.out.println("authHeader = " + authHeader); + Response jwtResponse = TestUtils.processRequest(jwtUrl, "GET", null, authHeader); + + assertEquals("HTTP response code should have been " + Status.OK.getStatusCode() + ".", + Status.OK.getStatusCode(), jwtResponse.getStatus()); + + String responseName = jwtResponse.readEntity(String.class); + + assertEquals("The test name and jwt token name should match", TESTNAME, responseName); + + } + + public void testJwtGetCustomClaim(boolean userAuthorized) { + String jwtUrl = baseUrl + INV_JWT + "/customClaim"; + if (userAuthorized) { + Response jwtResponse = TestUtils.processRequest(jwtUrl, "GET", null, authHeader); + assertEquals("HTTP response code should have been " + Status.OK.getStatusCode() + ".", + Status.OK.getStatusCode(), jwtResponse.getStatus()); + } else { + Response jwtResponse = TestUtils.processRequest(jwtUrl, "GET", null, unauthHeader); + assertEquals("HTTP response code should have been " + Status.FORBIDDEN.getStatusCode() + ".", + Status.FORBIDDEN.getStatusCode(), jwtResponse.getStatus()); + } + + } + +} +// end::test[] diff --git a/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/test/java/it/jwt/util/JwtBuilder.java b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/test/java/it/jwt/util/JwtBuilder.java new file mode 100644 index 00000000..a2b94f4f --- /dev/null +++ b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/test/java/it/jwt/util/JwtBuilder.java @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2019 IBM Corporation and others +* +* See the NOTICE file(s) distributed with this work for additional +* information regarding copyright ownership. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* You may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package jwt.util; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.security.Key; + +import org.jose4j.base64url.SimplePEMEncoder; +import org.jose4j.jwk.RsaJsonWebKey; +import org.jose4j.jwk.RsaJwkGenerator; +import org.jose4j.jws.AlgorithmIdentifiers; +import org.jose4j.jws.JsonWebSignature; +import org.jose4j.jwt.JwtClaims; +import org.jose4j.jwt.MalformedClaimException; +import org.jose4j.lang.JoseException; + +/** + * Build JWT's for use with Rest clients. The public and private keys will be + * statically initialized and reused until this class goes away. + * + * @author brutif + */ +public class JwtBuilder { + + public static final String MP_JWT_PUBLIC_KEY = "mp_jwt_verify_publickey"; + public static final String MP_JWT_ISSUER = "mp_jwt_verify_issuer"; + + private static final String BEGIN_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----"; + private static final String END_PUBLIC_KEY = "-----END PUBLIC KEY-----"; + + private JwtClaims claims = null; + private JsonWebSignature jws = null; + static RsaJsonWebKey rsajwk = null; + static JwtBuilder me = null; + + // init the single public:private key pair that we will re-use. + private static void init() { + if (rsajwk != null) { + return; + } + try { + rsajwk = RsaJwkGenerator.generateJwk(2048); + rsajwk.setKeyId("keyid"); + } catch (Exception e) { + e.printStackTrace(System.out); + } + } + + public static String getPublicKey() { + init(); + return pemEncode(rsajwk.getPublicKey()); + } + + private static String pemEncode(Key publicKey) { + byte[] encoded = publicKey.getEncoded(); // X509 SPKI + return BEGIN_PUBLIC_KEY + "\r\n" + SimplePEMEncoder.encode(encoded) + END_PUBLIC_KEY; + } + + public static void storePublicKey(String location) throws IOException, Exception { + init(); + if (location != null) { + System.out.println("storePublicKey entry: location=" + location); + BufferedWriter pubKeyWriter = new BufferedWriter(new FileWriter(location)); + pubKeyWriter.write(pemEncode(rsajwk.getPublicKey())); + pubKeyWriter.flush(); + pubKeyWriter.close(); + } else { + throw new Exception("public key location is null"); + } + } + + public static String buildJwt(String subject, String issuer, String[] claims) + throws JoseException, MalformedClaimException { + me = new JwtBuilder(); + init(); + me.claims = new JwtClaims(); + me.jws = new JsonWebSignature(); + + me.jws.setKeyIdHeaderValue(rsajwk.getKeyId()); + me.jws.setAlgorithmHeaderValue(AlgorithmIdentifiers.RSA_USING_SHA256); + // The JWT is signed using the private key, get the key we'll use every time. + me.jws.setKey(rsajwk.getPrivateKey()); + if (subject != null) { + me.claims.setClaim("sub", subject); + me.claims.setClaim("upn", subject); + } + me.claims.setIssuer(issuer); + me.claims.setExpirationTimeMinutesInTheFuture(60); + setClaims(claims); + if (me.claims.getIssuedAt() == null) { + me.claims.setIssuedAtToNow(); + } + me.jws.setPayload(me.claims.toJson()); + return me.jws.getCompactSerialization(); + } + + private static void setClaims(String[] claims) throws MalformedClaimException { + for (String claim : claims) { + if (!claim.contains("=")) + throw new MalformedClaimException( + "Claim did not contain an equals sign (=). Each claim must be of the form 'key=value'"); + int loc = claim.indexOf('='); + String claimName = claim.substring(0, loc); + Object claimValue = claim.substring(loc + 1); + claimValue = handleArrays((String) claimValue); + setClaim(claimName, claimValue); + } + } + + private static Object handleArrays(String claimValue) { + if (!claimValue.contains(",")) { + return claimValue; + } + String[] elements = claimValue.split(","); + return elements; + } + + private static void setClaim(String name, Object value) { + me.claims.setClaim(name, value); + } +} diff --git a/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/test/java/it/jwt/util/JwtVerifier.java b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/test/java/it/jwt/util/JwtVerifier.java new file mode 100755 index 00000000..fb2c2d13 --- /dev/null +++ b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/test/java/it/jwt/util/JwtVerifier.java @@ -0,0 +1,132 @@ +// ****************************************************************************** +// Copyright (c) 2017 IBM Corporation and others. +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// which accompanies this distribution, and is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// Contributors: +// IBM Corporation - initial API and implementation +// ****************************************************************************** +package jwt.util; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.io.FileInputStream; +import java.io.StringReader; +import java.math.BigInteger; +import java.security.GeneralSecurityException; +import java.security.KeyFactory; +import java.security.KeyStore; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.Signature; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.RSAPublicKeySpec; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; +import java.util.StringTokenizer; +import javax.json.Json; +import javax.json.JsonArray; +import javax.json.JsonArrayBuilder; +import javax.json.JsonObject; +import javax.json.JsonReader; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation.Builder; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import org.apache.cxf.common.util.Base64Exception; +import org.apache.cxf.common.util.Base64Utility; +import org.junit.Assert; + +import java.security.Key; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +import org.jose4j.base64url.SimplePEMEncoder; +import org.jose4j.jwk.RsaJsonWebKey; +import org.jose4j.jwk.RsaJwkGenerator; +import org.jose4j.jws.AlgorithmIdentifiers; +import org.jose4j.jws.JsonWebSignature; +import org.jose4j.jwt.JwtClaims; +import org.jose4j.jwt.MalformedClaimException; +import org.jose4j.lang.JoseException; + +public class JwtVerifier { + + // The algorithm used to sign the JWT. + private static final String JWT_ALGORITHM = "SHA256withRSA"; + + private static final String DEFAULT_JWT_ISSUER = "http://openliberty.io"; + + private static final String JWT_ISSUER = System.getProperty("testcase.issuer", DEFAULT_JWT_ISSUER); + // The hostname we'll use in our tests. The hostname of the backend service. + private static final String libertyHostname = "localhost"; + + // The SSL port we'll use in our tests. The ssl port of the backend service. + private static final String libertySslPort = "5050"; + + private static String keystorePath; + + private static final String secret = "secret"; + + /** + * Make a microprofile-compliant JWT with the correct secret key. + * + * @return A base 64 encoded JWT. + */ + public String createJwt(String username, String groups) throws GeneralSecurityException, IOException, Exception { + if (username != null && groups != null) { + String[] claims = new String[2]; + claims[0] = groups; + claims[1] = "customClaim=Custom"; + return JwtBuilder.buildJwt(username, JWT_ISSUER, claims); + } else { + throw new Exception("group or user name is null"); + } + + } + + /** Create a groups array to put in the JWT. */ + private static JsonArray getGroupArray(Set groups) { + JsonArrayBuilder arrayBuilder = Json.createArrayBuilder(); + + if (groups != null) { + for (String group : groups) { + arrayBuilder.add(group); + } + } + + return arrayBuilder.build(); + } + + public static JsonObject toJsonObj(String json) { + JsonReader jReader = Json.createReader(new StringReader(json)); + return jReader.readObject(); + } + + private Response processRequest(String url, String method, String payload, String authHeader) { + Client client = ClientBuilder.newClient(); + WebTarget target = client.target(url); + Builder builder = target.request(); + builder.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); + if (authHeader != null) { + builder.header(HttpHeaders.AUTHORIZATION, authHeader); + } + return (payload != null) ? builder.build(method, Entity.json(payload)).invoke() + : builder.build(method).invoke(); + } +} diff --git a/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/test/java/it/jwt/util/TestUtils.java b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/test/java/it/jwt/util/TestUtils.java new file mode 100644 index 00000000..345d2f87 --- /dev/null +++ b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1-sysprop/src/test/java/it/jwt/util/TestUtils.java @@ -0,0 +1,47 @@ +// tag::copyright[] +/** + * ***************************************************************************** + * Copyright (c) 2018 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + *

Contributors: IBM Corporation - Initial implementation + * ***************************************************************************** + */ +// end::copyright[] +package jwt.util; + +import java.io.StringReader; +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.JsonReader; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation.Builder; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +public class TestUtils { + + public static Response processRequest(String url, String method, String payload, String authHeader) { + Client client = ClientBuilder.newClient(); + WebTarget target = client.target(url); + Builder builder = target.request(); + builder.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); + if (authHeader != null) { + builder.header(HttpHeaders.AUTHORIZATION, authHeader); + } + return (payload != null) ? builder.build(method, Entity.json(payload)).invoke() + : builder.build(method).invoke(); + } + + public static JsonObject toJsonObj(String json) { + JsonReader jReader = Json.createReader(new StringReader(json)); + return jReader.readObject(); + } + +} diff --git a/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1/pom.xml b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1/pom.xml index 609ee7c9..5e990d52 100755 --- a/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1/pom.xml +++ b/boost-maven/boost-maven-plugin/src/it/test-mp-jwt-1.1/pom.xml @@ -2,7 +2,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 org.microshed.boost - test-mpJwt-1.1 + test-mpJwt-1.1-sysprop 1.0-SNAPSHOT war @@ -207,6 +207,7 @@ ${project.build.testOutputDirectory}/truststore/public.key + http://openliberty.io diff --git a/boost-maven/boost-maven-plugin/src/it/test-mp-rest-client-1.2/src/main/java/io/openliberty/guides/inventory/client/SystemClient.java b/boost-maven/boost-maven-plugin/src/it/test-mp-rest-client-1.2/src/main/java/io/openliberty/guides/inventory/client/SystemClient.java index 22edda32..cc9dccb8 100644 --- a/boost-maven/boost-maven-plugin/src/it/test-mp-rest-client-1.2/src/main/java/io/openliberty/guides/inventory/client/SystemClient.java +++ b/boost-maven/boost-maven-plugin/src/it/test-mp-rest-client-1.2/src/main/java/io/openliberty/guides/inventory/client/SystemClient.java @@ -25,7 +25,8 @@ // tag::annotations[] @Dependent -@RegisterRestClient(baseUri="http://localhost:9000/system") // Doesn't fit well with using a "boost property", something to look at more. +@RegisterRestClient(baseUri = "http://localhost:9000/system") // Doesn't fit well with using a "boost property", + // something to look at more. @RegisterProvider(UnknownUrlExceptionMapper.class) @RegisterProvider(value = PropertiesReader.class, priority = 2000) @Path("/properties") diff --git a/boost-maven/boost-maven-plugin/src/it/test-mp-rest-client-1.3/src/main/java/io/openliberty/guides/inventory/InventoryManager.java b/boost-maven/boost-maven-plugin/src/it/test-mp-rest-client-1.3/src/main/java/io/openliberty/guides/inventory/InventoryManager.java index b32a575d..33907909 100644 --- a/boost-maven/boost-maven-plugin/src/it/test-mp-rest-client-1.3/src/main/java/io/openliberty/guides/inventory/InventoryManager.java +++ b/boost-maven/boost-maven-plugin/src/it/test-mp-rest-client-1.3/src/main/java/io/openliberty/guides/inventory/InventoryManager.java @@ -56,13 +56,13 @@ public class InventoryManager { Logger LOG = Logger.getLogger(InventoryManager.class.getName()); /** - * This is the port we're going to use for the dynamically-build invocation - * of the system resource on the "back-end" port, so we don't want to - * confuse it with the HTTP port that this InventoryManager instance is - * running under, but rather use a totally new configuration property. + * This is the port we're going to use for the dynamically-build invocation of + * the system resource on the "back-end" port, so we don't want to confuse it + * with the HTTP port that this InventoryManager instance is running under, but + * rather use a totally new configuration property. * - * This allows us to invoke the back-end service on a remote host, like we - * can with the MP RestClient invocation + * This allows us to invoke the back-end service on a remote host, like we can + * with the MP RestClient invocation */ // private final String DEFAULT_PORT = // System.getProperty("default.http.port"); diff --git a/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/plugin/AbstractMojo.java b/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/plugin/AbstractMojo.java index 06e21bc7..981af945 100644 --- a/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/plugin/AbstractMojo.java +++ b/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/plugin/AbstractMojo.java @@ -93,8 +93,8 @@ public void execute() throws MojoExecutionException { init(); BoostLogger boostLogger = new BoostLogger(getLog()); // TODO move this into getRuntimeInstance() - this.dependencies = MavenProjectUtil.getAllDependencies(project, repoSystem, repoSession, remoteRepos, boostLogger); - + this.dependencies = MavenProjectUtil.getAllDependencies(project, repoSystem, repoSession, remoteRepos, + boostLogger); List compileClasspathJars = new ArrayList(); @@ -107,9 +107,9 @@ public void execute() throws MojoExecutionException { } URL[] urlsForClassLoader = pathUrls.toArray(new URL[pathUrls.size()]); this.projectClassLoader = new URLClassLoader(urlsForClassLoader, this.getClass().getClassLoader()); - + boostProperties = BoostProperties.getConfiguredBoostProperties(project.getProperties(), boostLogger); - + boosterConfigs = BoosterConfigurator.getBoosterConfigs(compileClasspathJars, projectClassLoader, dependencies, boostProperties, boostLogger); @@ -119,11 +119,11 @@ public void execute() throws MojoExecutionException { } protected RuntimeI getRuntimeInstance() throws MojoExecutionException { - + RuntimeI runtime = null; - - RuntimeParams params = new RuntimeParams(boosterConfigs, boostProperties, getExecutionEnvironment(), project, getLog(), - repoSystem, repoSession, remoteRepos, getMavenDependencyPlugin()); + + RuntimeParams params = new RuntimeParams(boosterConfigs, boostProperties, getExecutionEnvironment(), project, + getLog(), repoSystem, repoSession, remoteRepos, getMavenDependencyPlugin()); try { ServiceLoader runtimes = ServiceLoader.load(RuntimeI.class, projectClassLoader); if (!runtimes.iterator().hasNext()) { @@ -141,7 +141,7 @@ protected RuntimeI getRuntimeInstance() throws MojoExecutionException { | NoSuchMethodException e) { throw new MojoExecutionException("Error while looking for Boost runtime."); } - + return runtime; } diff --git a/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/plugin/PackageMojo.java b/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/plugin/PackageMojo.java index f3d3dc1f..95c1525b 100644 --- a/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/plugin/PackageMojo.java +++ b/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/plugin/PackageMojo.java @@ -23,7 +23,7 @@ */ @Mojo(name = "package", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME) public class PackageMojo extends AbstractMojo { - + @Override public void execute() throws MojoExecutionException { super.execute(); diff --git a/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/plugin/RunMojo.java b/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/plugin/RunMojo.java index 8768de1a..527eda22 100644 --- a/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/plugin/RunMojo.java +++ b/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/plugin/RunMojo.java @@ -31,7 +31,7 @@ public class RunMojo extends AbstractMojo { @Override public void execute() throws MojoExecutionException { super.execute(); - + try { this.getRuntimeInstance().doRun(clean); } catch (BoostException e) { diff --git a/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/runtimes/RuntimeParams.java b/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/runtimes/RuntimeParams.java index 9f97e831..337e8310 100644 --- a/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/runtimes/RuntimeParams.java +++ b/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/runtimes/RuntimeParams.java @@ -36,9 +36,9 @@ public class RuntimeParams { Plugin mavenDepPlugin; String projectBuildDir; - public RuntimeParams(List boosterConfigs, Properties boostProperties, ExecutionEnvironment env, MavenProject project, - Log log, RepositorySystem repoSystem, RepositorySystemSession repoSession, - List remoteRepos, Plugin mavenDepPlugin) { + public RuntimeParams(List boosterConfigs, Properties boostProperties, + ExecutionEnvironment env, MavenProject project, Log log, RepositorySystem repoSystem, + RepositorySystemSession repoSession, List remoteRepos, Plugin mavenDepPlugin) { this.log = log; this.boosterConfigs = boosterConfigs; this.boostProperties = boostProperties; @@ -58,7 +58,7 @@ public Log getLog() { public List getBoosterConfigs() { return this.boosterConfigs; } - + public Properties getBoostProperties() { return this.boostProperties; } diff --git a/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/utils/BoostLogger.java b/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/utils/BoostLogger.java index 643ab7b5..11066a02 100644 --- a/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/utils/BoostLogger.java +++ b/boost-maven/boost-maven-plugin/src/main/java/org/microshed/boost/maven/utils/BoostLogger.java @@ -18,11 +18,11 @@ public class BoostLogger implements BoostLoggerI { private org.apache.maven.plugin.logging.Log log; - + public org.apache.maven.plugin.logging.Log getLog() { return log; } - + public BoostLogger(org.apache.maven.plugin.logging.Log log) { this.log = log; } diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/LibertyRuntime.java b/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/LibertyRuntime.java index c85076a3..72a8c539 100644 --- a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/LibertyRuntime.java +++ b/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/LibertyRuntime.java @@ -167,8 +167,9 @@ private void generateServerConfig(List boosterConfigs) th } /** - * Assumes a non-WAR packaging type (like JAR) has a WAR dependency. - * We assume there's only 1 but don't check, just return the first one. + * Assumes a non-WAR packaging type (like JAR) has a WAR dependency. We assume + * there's only 1 but don't check, just return the first one. + * * @return * @throws BoostException */ @@ -177,7 +178,7 @@ private String getWarName() throws BoostException { String retVal = null; if (project.getPackaging().equals(ConfigConstants.WAR_PKG_TYPE)) { retVal = project.getBuild().getFinalName(); - } else { + } else { // JAR package "release", get WAR from dependency for (Artifact artifact : project.getArtifacts()) { // first WAR @@ -193,7 +194,7 @@ private String getWarName() throws BoostException { throw new BoostException(msg); } } - + return retVal; } @@ -218,7 +219,7 @@ private void generateLibertyServerConfig(List boosterConf String httpsPort = (String) boostProperties.getOrDefault(BoostProperties.ENDPOINT_HTTPS_PORT, "9443"); libertyConfig.addHttpsPort(httpsPort); - + String warName = getWarName(); libertyConfig.addApplication(warName); diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/LibertyServerConfigGenerator.java b/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/LibertyServerConfigGenerator.java index de1f4844..68349ebc 100644 --- a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/LibertyServerConfigGenerator.java +++ b/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/LibertyServerConfigGenerator.java @@ -16,15 +16,23 @@ import java.io.File; import java.io.IOException; import java.io.InputStreamReader; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.BufferedWriter; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; +import java.util.Enumeration; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; +import java.util.stream.Stream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -67,6 +75,8 @@ public class LibertyServerConfigGenerator { private Document variablesXml; private Element variablesRoot; + private static final String ENVIRONMENT_FILE = "/server.env"; + private Set featuresAdded; public LibertyServerConfigGenerator(String serverPath, String encryptionKey, BoostLoggerI logger) @@ -139,8 +149,7 @@ public void addFeatures(List features) { } /** - * Write the server.xml and bootstrap.properties to the server config - * directory + * Write the server.xml and bootstrap.properties to the server config directory * * @throws TransformerException * @throws IOException @@ -372,4 +381,80 @@ public void addElementWithAttributes(String elementName, Map att serverRoot.appendChild(element); } + /* + * Set environment variables in the server.env file. Check to see if something + * is there first and merge the contents. No checks are made for collisions. + */ + public void addEnvironemntVariables(Properties props) throws IOException { + + logger.info("addEnvironemntVariables Begin"); + Properties allProps = null; + InputStream bootstrapIn; + OutputStream bootstrapOut; + CustomProperties finalProps = null; + + try { + bootstrapIn = new FileInputStream(serverPath + ENVIRONMENT_FILE); + allProps.load(bootstrapIn); + bootstrapIn.close(); + } catch (Exception e) { + logger.info("addEnvironemntVariables .. No " + ENVIRONMENT_FILE + " found."); + } + if (allProps != null) { + props = mergeProperties(allProps, props); + } + + logger.info("addEnvironemntVariables Writing " + ENVIRONMENT_FILE); + bootstrapOut = new FileOutputStream(serverPath + ENVIRONMENT_FILE); + + finalProps = new CustomProperties(); + for (Enumeration keys = props.keys(); keys.hasMoreElements();) { + Object key = keys.nextElement(); + Object value = props.get(key); + finalProps.put(key, value); + } + + finalProps.store(bootstrapOut, null); + bootstrapOut.close(); + + } + + /* + * merge one or more properties files. + */ + private Properties mergeProperties(Properties... properties) { + return Stream.of(properties).collect(Properties::new, Map::putAll, Map::putAll); + } + + /* + * Need this class to allow storing of properties without escaping special + * characters. Normal properties.store(ouputStream) will escape ":" so if the + * property started as http://openliberty.io it will be stored i as + * http\://openliberty.io This will cause issuers not to match when the server + * runs... + */ + private class CustomProperties extends Properties { + private static final long serialVersionUID = 1L; + + /* + * private CustomProperties(Properties props) { super(props); } + */ + @Override + public void store(OutputStream out, String comments) throws IOException { + customStore0(new BufferedWriter(new OutputStreamWriter(out)), comments, true); + } + + private void customStore0(BufferedWriter bw, String comments, boolean escUnicode) throws IOException { + bw.newLine(); + synchronized (this) { + for (Enumeration e = keys(); e.hasMoreElements();) { + String key = (String) e.nextElement(); + String val = (String) get(key); + bw.write(key + "=" + val); + bw.newLine(); + } + } + bw.flush(); + } + } } diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyBeanValidationBoosterConfig.java b/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyBeanValidationBoosterConfig.java index 3366b787..4890cf7c 100644 --- a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyBeanValidationBoosterConfig.java +++ b/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyBeanValidationBoosterConfig.java @@ -21,8 +21,7 @@ public class LibertyBeanValidationBoosterConfig extends BeanValidationBoosterConfig implements LibertyBoosterI { - public LibertyBeanValidationBoosterConfig(BoosterConfigParams params, BoostLoggerI logger) - throws BoostException { + public LibertyBeanValidationBoosterConfig(BoosterConfigParams params, BoostLoggerI logger) throws BoostException { super(params, logger); } diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyBoosterI.java b/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyBoosterI.java index d35d5e91..b1ee23e4 100644 --- a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyBoosterI.java +++ b/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyBoosterI.java @@ -16,5 +16,6 @@ public interface LibertyBoosterI { public String getFeature(); + public void addServerConfig(LibertyServerConfigGenerator libertyServerConfigGenerator) throws BoostException; } \ No newline at end of file diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyCDIBoosterConfig.java b/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyCDIBoosterConfig.java index 95410319..61356cb7 100644 --- a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyCDIBoosterConfig.java +++ b/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyCDIBoosterConfig.java @@ -31,13 +31,12 @@ public String getFeature() { } if (getVersion().startsWith(CDI_VERSION_12)) { return CDI_12; - } - else { + } else { return null; } } public void addServerConfig(LibertyServerConfigGenerator libertyServerConfigGenerator) { - + } } \ No newline at end of file diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyJSONPBoosterConfig.java b/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyJSONPBoosterConfig.java index 2e72176d..9c6094ac 100644 --- a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyJSONPBoosterConfig.java +++ b/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyJSONPBoosterConfig.java @@ -29,8 +29,7 @@ public LibertyJSONPBoosterConfig(BoosterConfigParams params, BoostLoggerI logger public String getFeature() { if (getVersion().startsWith(JSONP_VERSION_10)) { return JSONP_10; - } - else if (getVersion().startsWith(JSONP_VERSION_11)) { + } else if (getVersion().startsWith(JSONP_VERSION_11)) { return JSONP_11; } return null; diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyMPJWTBoosterConfig.java b/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyMPJWTBoosterConfig.java index 7932b88f..c2057427 100644 --- a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyMPJWTBoosterConfig.java +++ b/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/org/microshed/boost/runtimes/openliberty/boosters/LibertyMPJWTBoosterConfig.java @@ -14,7 +14,6 @@ import static org.microshed.boost.common.config.ConfigConstants.MPJWT_11; import java.util.Map; - import org.microshed.boost.common.BoostException; import org.microshed.boost.common.BoostLoggerI; import org.microshed.boost.common.boosters.MPJWTBoosterConfig; @@ -37,7 +36,15 @@ public String getFeature() { } @Override - public void addServerConfig(LibertyServerConfigGenerator libertyServerConfigGenerator) { + public void addServerConfig(LibertyServerConfigGenerator libertyServerConfigGenerator) throws BoostException { + + try { + if (!!!boostMPProperties.isEmpty()) + libertyServerConfigGenerator.addEnvironemntVariables(boostMPProperties); + + } catch (Exception e) { + throw new BoostException("Error when configuring mp-jwt " + e.toString()); + } } diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/BeanValidationBoosterTest.java b/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/BeanValidationBoosterTest.java index 0ca92a3e..3a42e5f9 100644 --- a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/BeanValidationBoosterTest.java +++ b/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/BeanValidationBoosterTest.java @@ -50,8 +50,8 @@ public void testBeanValidationBoosterFeature_20() throws Exception { LibertyServerConfigGenerator serverConfig = new LibertyServerConfigGenerator( outputDir.getRoot().getAbsolutePath(), null, logger); - Map dependencies = BoosterUtil - .createDependenciesWithBoosterAndVersion(LibertyBeanValidationBoosterConfig.class, "2.0-0.2.2-SNAPSHOT"); + Map dependencies = BoosterUtil.createDependenciesWithBoosterAndVersion( + LibertyBeanValidationBoosterConfig.class, "2.0-0.2.2-SNAPSHOT"); BoosterConfigParams params = new BoosterConfigParams(dependencies, new Properties()); diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/JDBCBoosterTest.java b/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/JDBCBoosterTest.java index 52cdb244..9e7b3f71 100644 --- a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/JDBCBoosterTest.java +++ b/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/JDBCBoosterTest.java @@ -46,8 +46,8 @@ public class JDBCBoosterTest { BoostLoggerI logger = CommonLogger.getInstance(); /** - * Test that the jdbc-4.1 feature is added as the default when the Java - * compiler target is set to less than 7 (1.6) + * Test that the jdbc-4.1 feature is added as the default when the Java compiler + * target is set to less than 7 (1.6) * * @throws ParserConfigurationException * @throws TransformerException @@ -71,7 +71,7 @@ public void testAddJdbcBoosterFeature_SE_16() throws Exception { BoosterConfigParams params = new BoosterConfigParams(BoosterUtil.getJDBCDependency(), new Properties()); LibertyJDBCBoosterConfig libJDBCConfig = new LibertyJDBCBoosterConfig(params, logger); - + serverConfig.addFeature(libJDBCConfig.getFeature()); serverConfig.writeToServer(); @@ -83,8 +83,8 @@ public void testAddJdbcBoosterFeature_SE_16() throws Exception { } /** - * Test that the jdbc-4.1 feature is added when the Java compiler target is - * 1.7 booster + * Test that the jdbc-4.1 feature is added when the Java compiler target is 1.7 + * booster * * @throws ParserConfigurationException * @throws TransformerException @@ -101,7 +101,7 @@ public void testAddJdbcBoosterFeature_SE_17() throws Exception { BoosterConfigParams params = new BoosterConfigParams(BoosterUtil.getJDBCDependency(), new Properties()); LibertyJDBCBoosterConfig libJDBCConfig = new LibertyJDBCBoosterConfig(params, logger); - + serverConfig.addFeature(libJDBCConfig.getFeature()); serverConfig.writeToServer(); @@ -113,8 +113,8 @@ public void testAddJdbcBoosterFeature_SE_17() throws Exception { } /** - * Test that the jdbc-4.1 feature is added when the Java compiler target is - * 7 booster + * Test that the jdbc-4.1 feature is added when the Java compiler target is 7 + * booster * * @throws ParserConfigurationException * @throws TransformerException @@ -143,8 +143,8 @@ public void testAddJdbcBoosterFeature_SE_7() throws Exception { } /** - * Test that the jdbc-4.2 feature is added when the Java compiler target is - * 1.8 booster + * Test that the jdbc-4.2 feature is added when the Java compiler target is 1.8 + * booster * * @throws ParserConfigurationException * @throws TransformerException @@ -173,8 +173,8 @@ public void testAddJdbcBoosterFeature_SE_18() throws Exception { } /** - * Test that the jdbc-4.2 feature is added when the Java compiler target is - * 8 booster + * Test that the jdbc-4.2 feature is added when the Java compiler target is 8 + * booster * * @throws ParserConfigurationException * @throws TransformerException @@ -203,8 +203,8 @@ public void testAddJdbcBoosterFeature_SE_8() throws Exception { } /** - * Test that the jdbc-4.2 feature is added when the Java compiler target is - * 9 booster + * Test that the jdbc-4.2 feature is added when the Java compiler target is 9 + * booster * * @throws ParserConfigurationException * @throws TransformerException @@ -233,8 +233,8 @@ public void testAddJdbcBoosterFeature_SE9() throws Exception { } /** - * Test that the jdbc-4.3 feature is added when the Java compiler target is - * 11 booster + * Test that the jdbc-4.3 feature is added when the Java compiler target is 11 + * booster * * @throws ParserConfigurationException * @throws TransformerException diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/MPFaultToleranceBoosterTest.java b/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/MPFaultToleranceBoosterTest.java index b95ed39f..853b0090 100644 --- a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/MPFaultToleranceBoosterTest.java +++ b/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/MPFaultToleranceBoosterTest.java @@ -50,8 +50,8 @@ public void testMPFaultToleranceBoosterFeature11() throws Exception { LibertyServerConfigGenerator serverConfig = new LibertyServerConfigGenerator( outputDir.getRoot().getAbsolutePath(), null, logger); - Map dependencies = BoosterUtil - .createDependenciesWithBoosterAndVersion(LibertyMPFaultToleranceBoosterConfig.class, "1.1-0.2.2-SNAPSHOT"); + Map dependencies = BoosterUtil.createDependenciesWithBoosterAndVersion( + LibertyMPFaultToleranceBoosterConfig.class, "1.1-0.2.2-SNAPSHOT"); BoosterConfigParams params = new BoosterConfigParams(dependencies, new Properties()); LibertyMPFaultToleranceBoosterConfig libMPFTConfig = new LibertyMPFaultToleranceBoosterConfig(params, logger); @@ -78,8 +78,8 @@ public void testMPFaultToleranceBoosterFeature20() throws Exception { LibertyServerConfigGenerator serverConfig = new LibertyServerConfigGenerator( outputDir.getRoot().getAbsolutePath(), null, logger); - Map dependencies = BoosterUtil - .createDependenciesWithBoosterAndVersion(LibertyMPFaultToleranceBoosterConfig.class, "2.0-0.2.2-SNAPSHOT"); + Map dependencies = BoosterUtil.createDependenciesWithBoosterAndVersion( + LibertyMPFaultToleranceBoosterConfig.class, "2.0-0.2.2-SNAPSHOT"); BoosterConfigParams params = new BoosterConfigParams(dependencies, new Properties()); LibertyMPFaultToleranceBoosterConfig libMPFTConfig = new LibertyMPFaultToleranceBoosterConfig(params, logger); diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/MPHealthBoosterTest.java b/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/MPHealthBoosterTest.java index 3accc429..2ea9e55b 100644 --- a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/MPHealthBoosterTest.java +++ b/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/MPHealthBoosterTest.java @@ -40,8 +40,8 @@ public class MPHealthBoosterTest { BoostLoggerI logger = CommonLogger.getInstance(); /** - * Test that the mpHealth-1.0 feature is added to server.xml when the - * booster version is set to 1.0-0.2.2-SNAPSHOT + * Test that the mpHealth-1.0 feature is added to server.xml when the booster + * version is set to 1.0-0.2.2-SNAPSHOT * */ @Test @@ -68,8 +68,8 @@ public void testMPHealthBoosterFeature10() throws Exception { } /** - * Test that the mpHealth-2.0 feature is added to server.xml when the - * MPHealth booster version is set to 2.0-0.2.2-SNAPSHOT + * Test that the mpHealth-2.0 feature is added to server.xml when the MPHealth + * booster version is set to 2.0-0.2.2-SNAPSHOT * */ @Test diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/MPMetricsBoosterTest.java b/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/MPMetricsBoosterTest.java index 8c12740d..608cf488 100644 --- a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/MPMetricsBoosterTest.java +++ b/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/boosters/MPMetricsBoosterTest.java @@ -40,8 +40,8 @@ public class MPMetricsBoosterTest { BoostLoggerI logger = CommonLogger.getInstance(); /** - * Test that the mpMetrics-1.1 feature is added to server.xml when the - * MPMetrics booster version is set to 1.1-0.2.2-SNAPSHOT + * Test that the mpMetrics-1.1 feature is added to server.xml when the MPMetrics + * booster version is set to 1.1-0.2.2-SNAPSHOT * */ @Test @@ -68,8 +68,8 @@ public void testMPMetricsBoosterFeature11() throws Exception { } /** - * Test that the mpMetrics-2.0 feature is added to server.xml when the - * MPMetrics booster version is set to 2.0-0.2.2-SNAPSHOT + * Test that the mpMetrics-2.0 feature is added to server.xml when the MPMetrics + * booster version is set to 2.0-0.2.2-SNAPSHOT * */ @Test diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/config/LibertyServerConfigGeneratorTest.java b/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/config/LibertyServerConfigGeneratorTest.java index f55e98b3..ac5512a8 100644 --- a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/config/LibertyServerConfigGeneratorTest.java +++ b/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/config/LibertyServerConfigGeneratorTest.java @@ -79,8 +79,8 @@ public void testAddSpringFeature() throws ParserConfigurationException, Transfor } /** - * Test that the server.xml and boostrap.properties are fully configured - * with the Derby datasource + * Test that the server.xml and boostrap.properties are fully configured with + * the Derby datasource * * @throws ParserConfigurationException * @throws TransformerException @@ -165,8 +165,8 @@ public void testAddDatasource_Derby() throws Exception { } /** - * Test that the server.xml and boostrap.properties are fully configured - * with the DB2 datasource + * Test that the server.xml and boostrap.properties are fully configured with + * the DB2 datasource * * @throws ParserConfigurationException * @throws TransformerException @@ -251,8 +251,8 @@ public void testAddDatasource_DB2() throws Exception { } /** - * Test that the server.xml and boostrap.properties are fully configured - * with the MySQL datasource + * Test that the server.xml and boostrap.properties are fully configured with + * the MySQL datasource * * @throws ParserConfigurationException * @throws TransformerException @@ -336,8 +336,8 @@ public void testAddJdbcBoosterConfig_MySQL() throws Exception { } /** - * Test that the server.xml and boostrap.properties are fully configured - * with the MySQL datasource + * Test that the server.xml and boostrap.properties are fully configured with + * the MySQL datasource * * @throws ParserConfigurationException * @throws TransformerException diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/utils/CommonLogger.java b/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/utils/CommonLogger.java index 0008dd20..6a73859c 100644 --- a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/utils/CommonLogger.java +++ b/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/utils/CommonLogger.java @@ -14,7 +14,7 @@ import org.microshed.boost.common.BoostLoggerI; public class CommonLogger implements BoostLoggerI { - + private static CommonLogger logger = null; public static CommonLogger getInstance() { diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/utils/ConfigFileUtils.java b/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/utils/ConfigFileUtils.java index 51373ba8..5e747217 100644 --- a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/utils/ConfigFileUtils.java +++ b/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/org/microshed/boost/runtimes/utils/ConfigFileUtils.java @@ -53,23 +53,22 @@ public static boolean findStringInServerXml(String serverXMLPath, String stringT return found; } - public static String findVariableInXml(String variablesXmlPath, String variableName) - throws Exception { + public static String findVariableInXml(String variablesXmlPath, String variableName) throws Exception { String variableValue = null; - + File variablesXml = new File(variablesXmlPath); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(variablesXml); Element serverRoot = doc.getDocumentElement(); - + List variablesList = getDirectChildrenByTag(serverRoot, "variable"); for (Element variable : variablesList) { - if (variableName.equals(variable.getAttribute("name"))) { - variableValue = variable.getAttribute("defaultValue"); - } + if (variableName.equals(variable.getAttribute("name"))) { + variableValue = variable.getAttribute("defaultValue"); + } } return variableValue; diff --git a/boost-maven/boost-runtimes/runtime-tomee/src/main/java/org/microshed/boost/runtimes/tomee/TomeeRuntime.java b/boost-maven/boost-runtimes/runtime-tomee/src/main/java/org/microshed/boost/runtimes/tomee/TomeeRuntime.java index 641ded68..35cb2658 100644 --- a/boost-maven/boost-runtimes/runtime-tomee/src/main/java/org/microshed/boost/runtimes/tomee/TomeeRuntime.java +++ b/boost-maven/boost-runtimes/runtime-tomee/src/main/java/org/microshed/boost/runtimes/tomee/TomeeRuntime.java @@ -58,7 +58,7 @@ public TomeeRuntime() { } public TomeeRuntime(RuntimeParams params) { - this.boosterConfigs = params.getBoosterConfigs(); + this.boosterConfigs = params.getBoosterConfigs(); this.boostProperties = params.getBoostProperties(); this.env = params.getEnv(); @@ -96,7 +96,7 @@ private void createTomeeServer() throws MojoExecutionException { private void configureTomeeServer(List boosterConfigurators) throws Exception { try { TomeeServerConfigGenerator tomeeConfig = new TomeeServerConfigGenerator(configDir, - BoostLogger.getSystemStreamLogger()); + BoostLogger.getSystemStreamLogger()); tomeeConfig.addJarsDirToSharedLoader(); // Configure HTTP endpoint diff --git a/boost-maven/boost-runtimes/runtime-tomee/src/main/java/org/microshed/boost/runtimes/tomee/boosters/TomeeMPRestClientBoosterConfig.java b/boost-maven/boost-runtimes/runtime-tomee/src/main/java/org/microshed/boost/runtimes/tomee/boosters/TomeeMPRestClientBoosterConfig.java index f9e295c0..d6f0f59c 100644 --- a/boost-maven/boost-runtimes/runtime-tomee/src/main/java/org/microshed/boost/runtimes/tomee/boosters/TomeeMPRestClientBoosterConfig.java +++ b/boost-maven/boost-runtimes/runtime-tomee/src/main/java/org/microshed/boost/runtimes/tomee/boosters/TomeeMPRestClientBoosterConfig.java @@ -31,4 +31,3 @@ public List getDependencies() { return deps; } } -