You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2018/04/30 14:34:03 UTC
[2/3] tomee git commit: Backport MicroProfile from fb_tomee8 branch
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/principal/JWTCallerPrincipal.java
----------------------------------------------------------------------
diff --git a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/principal/JWTCallerPrincipal.java b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/principal/JWTCallerPrincipal.java
new file mode 100644
index 0000000..d8e3c4c
--- /dev/null
+++ b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/principal/JWTCallerPrincipal.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.tomee.microprofile.jwt.principal;
+
+
+import org.eclipse.microprofile.jwt.JsonWebToken;
+
+import java.util.Optional;
+
+/**
+ * An abstract CallerPrincipal implementation that provides access to the JWT claims that are required by
+ * the microprofile token.
+ */
+public abstract class JWTCallerPrincipal implements JsonWebToken {
+
+ private String name;
+
+ /**
+ * Create a JWTCallerPrincipal with the caller's name
+ *
+ * @param name - caller's name
+ */
+ public JWTCallerPrincipal(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Generate a human readable version of the caller principal and associated JWT.
+ *
+ * @param showAll - should all claims associated with the JWT be displayed or should only those defined in the
+ * JsonWebToken interface be displayed.
+ * @return human readable presentation of the caller principal and associated JWT.
+ */
+ public abstract String toString(final boolean showAll);
+
+ public <T> Optional<T> claim(final String claimName) {
+ final T claim = (T) getClaim(claimName);
+ return Optional.ofNullable(claim);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/principal/JWTCallerPrincipalFactory.java
----------------------------------------------------------------------
diff --git a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/principal/JWTCallerPrincipalFactory.java b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/principal/JWTCallerPrincipalFactory.java
new file mode 100644
index 0000000..e7ebcd6
--- /dev/null
+++ b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/principal/JWTCallerPrincipalFactory.java
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.tomee.microprofile.jwt.principal;
+
+import org.apache.tomee.microprofile.jwt.ParseException;
+import org.apache.tomee.microprofile.jwt.config.JWTAuthContextInfo;
+
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ServiceLoader;
+
+/**
+ * The factory class that provides the token string to JWTCallerPrincipal parsing for a given implementation.
+ */
+public abstract class JWTCallerPrincipalFactory {
+
+ private static JWTCallerPrincipalFactory instance;
+
+ /**
+ * Obtain the JWTCallerPrincipalFactory that has been set or by using the ServiceLoader pattern.
+ *
+ * @return the factory instance
+ * @see #setInstance(JWTCallerPrincipalFactory)
+ */
+ public static JWTCallerPrincipalFactory instance() {
+ if (instance == null) {
+ synchronized (JWTCallerPrincipalFactory.class) {
+ if (instance != null) {
+ return instance;
+ }
+
+ ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ @Override
+ public ClassLoader run() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ if (cl == null) {
+ cl = JWTCallerPrincipalFactory.class.getClassLoader();
+ }
+
+ JWTCallerPrincipalFactory newInstance = loadSpi(cl);
+
+ if (newInstance == null && cl != JWTCallerPrincipalFactory.class.getClassLoader()) {
+ cl = JWTCallerPrincipalFactory.class.getClassLoader();
+ newInstance = loadSpi(cl);
+ }
+ if (newInstance == null) {
+ throw new IllegalStateException("No JWTCallerPrincipalFactory implementation found!");
+ }
+
+ instance = newInstance;
+ }
+ }
+
+ return instance;
+ }
+
+ /**
+ * Look for a JWTCallerPrincipalFactory service implementation using the ServiceLoader.
+ *
+ * @param cl - the ClassLoader to pass into the {@link ServiceLoader#load(Class, ClassLoader)} method.
+ * @return the JWTCallerPrincipalFactory if found, null otherwise
+ */
+ private static JWTCallerPrincipalFactory loadSpi(ClassLoader cl) {
+ if (cl == null) {
+ return null;
+ }
+
+ // start from the root CL and go back down to the TCCL
+ JWTCallerPrincipalFactory instance = loadSpi(cl.getParent());
+
+ if (instance == null) {
+ ServiceLoader<JWTCallerPrincipalFactory> sl = ServiceLoader.load(JWTCallerPrincipalFactory.class, cl);
+ URL u = cl.getResource("/META-INF/services/org.apache.tomee.microprofile.jwt.JWTCallerPrincipalFactory");
+ System.out.printf("JWTCallerPrincipalFactory, cl=%s, u=%s, sl=%s\n", cl, u, sl);
+ try {
+ for (JWTCallerPrincipalFactory spi : sl) {
+ if (instance != null) {
+ throw new IllegalStateException(
+ "Multiple JWTCallerPrincipalFactory implementations found: "
+ + spi.getClass().getName() + " and "
+ + instance.getClass().getName());
+ } else {
+ System.out.printf("sl=%s, loaded=%s\n", sl, spi);
+ instance = spi;
+ }
+ }
+
+ } catch (final Throwable e) {
+ System.err.printf("Warning: %s\n", e.getMessage());
+ }
+ }
+ return instance;
+ }
+
+ /**
+ * Set the instance. It is used by OSGi environment where service loader pattern is not supported.
+ *
+ * @param resolver the instance to use.
+ */
+ public static void setInstance(final JWTCallerPrincipalFactory resolver) {
+ instance = resolver;
+ }
+
+ /**
+ * Parse the given bearer token string into a JWTCallerPrincipal instance.
+ *
+ * @param token - the bearer token provided for authorization
+ * @return A JWTCallerPrincipal representation for the token.
+ * @throws ParseException on parse or verification failure.
+ */
+ public abstract JWTCallerPrincipal parse(final String token, final JWTAuthContextInfo authContextInfo) throws ParseException;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/mp-jwt/src/main/resources/META-INF/org.apache.openejb.extension
----------------------------------------------------------------------
diff --git a/mp-jwt/src/main/resources/META-INF/org.apache.openejb.extension b/mp-jwt/src/main/resources/META-INF/org.apache.openejb.extension
new file mode 100644
index 0000000..9734019
--- /dev/null
+++ b/mp-jwt/src/main/resources/META-INF/org.apache.openejb.extension
@@ -0,0 +1 @@
+org.apache.tomee.microprofile.jwt.jaxrs.MPJWPProviderRegistration
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/mp-jwt/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
----------------------------------------------------------------------
diff --git a/mp-jwt/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/mp-jwt/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
new file mode 100644
index 0000000..d5eea47
--- /dev/null
+++ b/mp-jwt/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
@@ -0,0 +1 @@
+org.apache.tomee.microprofile.jwt.cdi.MPJWTCDIExtension
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/mp-jwt/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer
----------------------------------------------------------------------
diff --git a/mp-jwt/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer b/mp-jwt/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer
new file mode 100644
index 0000000..100e625
--- /dev/null
+++ b/mp-jwt/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer
@@ -0,0 +1 @@
+org.apache.tomee.microprofile.jwt.MPJWTInitializer
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/mp-jwt/src/main/resources/META-INF/services/org.apache.tomee.microprofile.jwt.principal.JWTCallerPrincipalFactory
----------------------------------------------------------------------
diff --git a/mp-jwt/src/main/resources/META-INF/services/org.apache.tomee.microprofile.jwt.principal.JWTCallerPrincipalFactory b/mp-jwt/src/main/resources/META-INF/services/org.apache.tomee.microprofile.jwt.principal.JWTCallerPrincipalFactory
new file mode 100644
index 0000000..21c9831
--- /dev/null
+++ b/mp-jwt/src/main/resources/META-INF/services/org.apache.tomee.microprofile.jwt.principal.JWTCallerPrincipalFactory
@@ -0,0 +1 @@
+org.apache.tomee.microprofile.jwt.principal.DefaultJWTCallerPrincipalFactory
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f979e53..05fb362 100644
--- a/pom.xml
+++ b/pom.xml
@@ -94,8 +94,8 @@
<properties>
<tomee.version>${project.version}</tomee.version>
- <maven.compiler.source>1.7</maven.compiler.source>
- <maven.compiler.target>1.7</maven.compiler.target>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
<!-- To easily change the javaee api version -->
<version.javaee-api>7.0-1</version.javaee-api>
@@ -125,7 +125,7 @@
<openejb.osgi.dynamic.import>${openejb.osgi.dynamic.import.pkg}</openejb.osgi.dynamic.import>
<openejb.osgi.symbolic.name>${project.groupId}.${project.artifactId}</openejb.osgi.symbolic.name>
- <batchee.version>0.4-incubating</batchee.version>
+ <batchee.version>0.4-incubating</batchee.version>
<version.arquillian>1.1.13.Final</version.arquillian>
<version.shrinkwrap.descriptor>2.0.0</version.shrinkwrap.descriptor>
@@ -193,6 +193,9 @@
<!-- arquillian related -->
<version.arquillian.bom>1.1.13.Final</version.arquillian.bom>
<version.shrinkwrap.resolver.bom>2.1.0</version.shrinkwrap.resolver.bom>
+
+ <mp-jwt.version>1.0</mp-jwt.version>
+ <mp-jwt-tck.version>${mp-jwt.version}</mp-jwt-tck.version>
</properties>
<build>
@@ -364,8 +367,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
- <source>1.7</source>
- <target>1.7</target>
+ <source>1.8</source>
+ <target>1.8</target>
</configuration>
</plugin>
<plugin>
@@ -508,6 +511,7 @@
<module>gradle</module>
<module>container</module>
<module>server</module>
+ <module>mp-jwt</module>
<module>examples</module>
<module>assembly</module>
<module>tck</module>
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tck/microprofile-tck/config/pom.xml
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/config/pom.xml b/tck/microprofile-tck/config/pom.xml
new file mode 100644
index 0000000..40c5bb5
--- /dev/null
+++ b/tck/microprofile-tck/config/pom.xml
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>microprofile-tck</artifactId>
+ <version>7.0.5-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>microprofile-config-tck</artifactId>
+ <name>OpenEJB :: TCK :: MicroProfile Config TCK</name>
+
+ <properties>
+ <microprofile.config.version>1.2</microprofile.config.version>
+ </properties>
+
+ <!-- TODO - see ServerClassConverter: requires a fix in geronimo-config-impl to use the Thread ClassLoader in ClassConverter. -->
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkCount>1</forkCount>
+ <reuseForks>true</reuseForks>
+ <dependenciesToScan>
+ <dependency>org.eclipse.microprofile.config:microprofile-config-tck</dependency>
+ </dependenciesToScan>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <!-- debug libs -->
+ <dependency>
+ <groupId>org.apache.geronimo.config</groupId>
+ <artifactId>geronimo-config-impl</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>tomee-catalina</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- distro -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apache-tomee</artifactId>
+ <version>${project.version}</version>
+ <type>zip</type>
+ <classifier>microprofile</classifier>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- tck stack -->
+ <dependency>
+ <groupId>org.eclipse.microprofile.config</groupId>
+ <artifactId>microprofile-config-api</artifactId>
+ <version>${microprofile.config.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.microprofile.config</groupId>
+ <artifactId>microprofile-config-tck</artifactId>
+ <version>${microprofile.config.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>6.9.9</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>arquillian-tomee-remote</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.testng</groupId>
+ <artifactId>arquillian-testng-core</artifactId>
+ <version>${version.arquillian}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-api-maven</artifactId>
+ <version>2.2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
+ <version>2.2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-spi</artifactId>
+ <version>2.2.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/ConfigurationBean.java
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/ConfigurationBean.java b/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/ConfigurationBean.java
new file mode 100644
index 0000000..3193ad9
--- /dev/null
+++ b/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/ConfigurationBean.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.openejb.tck.microprofile.config;
+
+import org.eclipse.microprofile.config.ConfigProvider;
+
+public class ConfigurationBean {
+ public String getConfig() {
+ return ConfigProvider.getConfig().getValue("config.test", String.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigTCKArchiveProcessor.java
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigTCKArchiveProcessor.java b/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigTCKArchiveProcessor.java
new file mode 100644
index 0000000..dcee75d
--- /dev/null
+++ b/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigTCKArchiveProcessor.java
@@ -0,0 +1,38 @@
+package org.apache.openejb.tck.microprofile.config;
+
+import static org.apache.openejb.loader.JarLocation.jarLocation;
+
+import org.eclipse.microprofile.config.tck.converters.UpperCaseDuckConverter;
+import org.hamcrest.object.HasToString;
+import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
+import org.jboss.arquillian.test.spi.TestClass;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+
+import java.io.File;
+
+public class MicroProfileConfigTCKArchiveProcessor implements ApplicationArchiveProcessor {
+ private File hamcrest;
+
+ @Override
+ public void process(final Archive<?> archive, final TestClass testClass) {
+ if (archive instanceof WebArchive) {
+ final WebArchive war = WebArchive.class.cast(archive);
+
+ // TODO - this could be fixed in the TCK by adding UpperCaseDuckConverter into org.eclipse.microprofile.config.tck.ConverterTest
+ JavaArchive configJar = ShrinkWrap
+ .create(JavaArchive.class, "config-tck-additional.jar")
+ .addClass(UpperCaseDuckConverter.class)
+ ;
+
+ war.addAsLibraries(configJar);
+
+ if (hamcrest == null) {
+ hamcrest = jarLocation(HasToString.class);
+ }
+ war.addAsLibrary(hamcrest);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigTCKExtension.java
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigTCKExtension.java b/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigTCKExtension.java
new file mode 100644
index 0000000..e30ece7
--- /dev/null
+++ b/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigTCKExtension.java
@@ -0,0 +1,11 @@
+package org.apache.openejb.tck.microprofile.config;
+
+import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
+import org.jboss.arquillian.core.spi.LoadableExtension;
+
+public class MicroProfileConfigTCKExtension implements LoadableExtension {
+ @Override
+ public void register(final ExtensionBuilder extensionBuilder) {
+ extensionBuilder.service(ApplicationArchiveProcessor.class, MicroProfileConfigTCKArchiveProcessor.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tck/microprofile-tck/config/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/config/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/tck/microprofile-tck/config/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
new file mode 100644
index 0000000..8644cce
--- /dev/null
+++ b/tck/microprofile-tck/config/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
@@ -0,0 +1 @@
+org.apache.openejb.tck.microprofile.config.MicroProfileConfigTCKExtension
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tck/microprofile-tck/config/src/test/resources/arquillian.xml
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/config/src/test/resources/arquillian.xml b/tck/microprofile-tck/config/src/test/resources/arquillian.xml
new file mode 100644
index 0000000..ecddd0c
--- /dev/null
+++ b/tck/microprofile-tck/config/src/test/resources/arquillian.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<arquillian xmlns="http://jboss.org/schema/arquillian"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://jboss.org/schema/arquillian
+ http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+ <container qualifier="tomee-remote" default="true">
+ <configuration>
+ <property name="httpPort">-1</property>
+ <property name="ajpPort">-1</property>
+ <property name="stopPort">-1</property>
+ <property name="classifier">microprofile</property>
+ <property name="conf">src/test/conf</property>
+ <property name="dir">target/tomee</property>
+ <property name="appWorkingDir">target/workdir</property>
+ <property name="cleanOnStartUp">true</property>
+ <property name="properties">
+ config.test = SUCCESS
+ org.apache.geronimo.config.configsource.SystemPropertyConfigSource.copy = false
+ </property>
+ </configuration>
+ </container>
+</arquillian>
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tck/microprofile-tck/jwt/pom.xml
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/jwt/pom.xml b/tck/microprofile-tck/jwt/pom.xml
new file mode 100644
index 0000000..5377985
--- /dev/null
+++ b/tck/microprofile-tck/jwt/pom.xml
@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>microprofile-tck</artifactId>
+ <version>7.0.5-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>microprofile-jwt-tck</artifactId>
+ <name>OpenEJB :: TCK :: MicroProfile JWT TCK</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>mp-jwt</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>tomee-catalina</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- distro -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apache-tomee</artifactId>
+ <version>${project.version}</version>
+ <type>zip</type>
+ <classifier>microprofile</classifier>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- This is the MP-JWT TCK base extension and utility classes -->
+ <dependency>
+ <groupId>org.eclipse.microprofile.jwt</groupId>
+ <artifactId>microprofile-jwt-auth-tck</artifactId>
+ <version>${mp-jwt-tck.version}</version>
+ </dependency>
+
+ <!-- This is the actual MP-JWT TCK test classes -->
+ <dependency>
+ <groupId>org.eclipse.microprofile.jwt</groupId>
+ <artifactId>microprofile-jwt-auth-tck</artifactId>
+ <version>${mp-jwt-tck.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>6.9.9</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>arquillian-tomee-remote</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.testng</groupId>
+ <artifactId>arquillian-testng-core</artifactId>
+ <version>${version.arquillian}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-api-maven</artifactId>
+ <version>2.2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
+ <version>2.2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-spi</artifactId>
+ <version>2.2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-client</artifactId>
+ <version>${cxf.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.10</version>
+ <executions>
+ <execution>
+ <id>copy-tck-test-suite-file</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.eclipse.microprofile.jwt</groupId>
+ <artifactId>microprofile-jwt-auth-tck</artifactId>
+ <type>test-jar</type>
+ <overWrite>true</overWrite>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.17</version>
+ <configuration>
+ <suiteXmlFiles>
+ <!-- TCK does not deliver the xml file for the moment -->
+ <suiteXmlFile>${project.build.directory}/test-classes/dev.xml</suiteXmlFile>
+ </suiteXmlFiles>
+ <systemProperties>
+ <!--<property>-->
+ <!--<name>validation.provider</name>-->
+ <!--<value>${validation.provider}</value>-->
+ <!--</property>-->
+ </systemProperties>
+ <parallel>methods</parallel>
+ <threadCount>4</threadCount>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>2.17</version>
+ <executions>
+ <execution>
+ <id>generate-test-report</id>
+ <phase>test</phase>
+ <goals>
+ <goal>report-only</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <outputDirectory>${project.build.directory}/surefire-reports</outputDirectory>
+ <outputName>test-report</outputName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tck/microprofile-tck/jwt/src/main/java/org/apache/tomee/microprofile/jwt/JWTAuthContextInfoProvider.java
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/jwt/src/main/java/org/apache/tomee/microprofile/jwt/JWTAuthContextInfoProvider.java b/tck/microprofile-tck/jwt/src/main/java/org/apache/tomee/microprofile/jwt/JWTAuthContextInfoProvider.java
new file mode 100644
index 0000000..bf0a07f
--- /dev/null
+++ b/tck/microprofile-tck/jwt/src/main/java/org/apache/tomee/microprofile/jwt/JWTAuthContextInfoProvider.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.tomee.microprofile.jwt;
+
+import org.apache.tomee.microprofile.jwt.config.JWTAuthContextInfo;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Produces;
+import java.security.KeyFactory;
+import java.security.NoSuchAlgorithmException;
+import java.security.interfaces.RSAPublicKey;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.Base64;
+import java.util.Optional;
+
+@Dependent
+public class JWTAuthContextInfoProvider {
+
+ @Produces
+ Optional<JWTAuthContextInfo> getOptionalContextInfo() throws NoSuchAlgorithmException, InvalidKeySpecException {
+ JWTAuthContextInfo contextInfo = new JWTAuthContextInfo();
+
+ // todo use MP Config to load the configuration
+ contextInfo.setIssuedBy("https://server.example.com");
+
+ final String pemEncoded = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlivFI8qB4D0y2jy0CfEq" +
+ "Fyy46R0o7S8TKpsx5xbHKoU1VWg6QkQm+ntyIv1p4kE1sPEQO73+HY8+Bzs75XwR" +
+ "TYL1BmR1w8J5hmjVWjc6R2BTBGAYRPFRhor3kpM6ni2SPmNNhurEAHw7TaqszP5e" +
+ "UF/F9+KEBWkwVta+PZ37bwqSE4sCb1soZFrVz/UT/LF4tYpuVYt3YbqToZ3pZOZ9" +
+ "AX2o1GCG3xwOjkc4x0W7ezbQZdC9iftPxVHR8irOijJRRjcPDtA6vPKpzLl6CyYn" +
+ "sIYPd99ltwxTHjr3npfv/3Lw50bAkbT4HeLFxTx4flEoZLKO/g0bAoV2uqBhkA9x" +
+ "nQIDAQAB";
+ byte[] encodedBytes = Base64.getDecoder().decode(pemEncoded);
+
+ final X509EncodedKeySpec spec = new X509EncodedKeySpec(encodedBytes);
+ final KeyFactory kf = KeyFactory.getInstance("RSA");
+ final RSAPublicKey pk = (RSAPublicKey) kf.generatePublic(spec);
+
+ contextInfo.setSignerKey(pk);
+
+ return Optional.of(contextInfo);
+ }
+
+ @Produces
+ JWTAuthContextInfo getContextInfo() throws InvalidKeySpecException, NoSuchAlgorithmException {
+ return getOptionalContextInfo().get();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tck/microprofile-tck/jwt/src/main/java/org/apache/tomee/microprofile/jwt/TCKTokenParser.java
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/jwt/src/main/java/org/apache/tomee/microprofile/jwt/TCKTokenParser.java b/tck/microprofile-tck/jwt/src/main/java/org/apache/tomee/microprofile/jwt/TCKTokenParser.java
new file mode 100644
index 0000000..ae563ec
--- /dev/null
+++ b/tck/microprofile-tck/jwt/src/main/java/org/apache/tomee/microprofile/jwt/TCKTokenParser.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.tomee.microprofile.jwt;
+
+import org.apache.tomee.microprofile.jwt.config.JWTAuthContextInfo;
+import org.apache.tomee.microprofile.jwt.principal.DefaultJWTCallerPrincipalFactory;
+import org.apache.tomee.microprofile.jwt.principal.JWTCallerPrincipalFactory;
+import org.eclipse.microprofile.jwt.JsonWebToken;
+import org.eclipse.microprofile.jwt.tck.util.ITokenParser;
+
+import java.security.PublicKey;
+import java.security.interfaces.RSAPublicKey;
+
+/**
+ * MP-JWT TCK harness class to parse a token string
+ */
+public class TCKTokenParser implements ITokenParser {
+
+ @Override
+ public JsonWebToken parse(final String bearerToken, final String issuer, final PublicKey publicKey) throws Exception {
+ final JWTAuthContextInfo authContextInfo = new JWTAuthContextInfo((RSAPublicKey) publicKey, issuer);
+ final JWTCallerPrincipalFactory factory = DefaultJWTCallerPrincipalFactory.instance();
+ return factory.parse(bearerToken, authContextInfo);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tck/microprofile-tck/jwt/src/test/java/org/apache/tomee/microprofile/jwt/AppDeploymentExtension.java
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/jwt/src/test/java/org/apache/tomee/microprofile/jwt/AppDeploymentExtension.java b/tck/microprofile-tck/jwt/src/test/java/org/apache/tomee/microprofile/jwt/AppDeploymentExtension.java
new file mode 100644
index 0000000..f5f2183
--- /dev/null
+++ b/tck/microprofile-tck/jwt/src/test/java/org/apache/tomee/microprofile/jwt/AppDeploymentExtension.java
@@ -0,0 +1,77 @@
+package org.apache.tomee.microprofile.jwt;
+
+import com.nimbusds.jose.JWSSigner;
+import org.apache.openejb.loader.JarLocation;
+import org.eclipse.microprofile.jwt.tck.TCKConstants;
+import org.eclipse.microprofile.jwt.tck.util.TokenUtils;
+import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription;
+import org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator;
+import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
+import org.jboss.arquillian.container.test.spi.client.deployment.DeploymentScenarioGenerator;
+import org.jboss.arquillian.core.spi.LoadableExtension;
+import org.jboss.arquillian.test.spi.TestClass;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.Node;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+
+import java.net.URL;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Logger;
+
+public class AppDeploymentExtension implements LoadableExtension {
+ @Override
+ public void register(final ExtensionBuilder extensionBuilder) {
+ extensionBuilder.service(DeploymentScenarioGenerator.class, SimpleDeploymentScenarioGenerator.class);
+ extensionBuilder.service(ApplicationArchiveProcessor.class, MPJWTTCKArchiveProcess.class);
+ }
+
+ public static class SimpleDeploymentScenarioGenerator implements DeploymentScenarioGenerator {
+
+ private final DeploymentScenarioGenerator standard = new AnnotationDeploymentScenarioGenerator();
+ private final DeploymentDescription emptyTestWebApp;
+
+ public SimpleDeploymentScenarioGenerator() {
+ emptyTestWebApp = new DeploymentDescription("mp-jwt-tck.war",
+ ShrinkWrap
+ .create(WebArchive.class, "mp-jwt-tck.war")
+ .addAsLibrary(JarLocation.jarLocation(TokenUtils.class))
+ .addAsLibrary(JarLocation.jarLocation(JWSSigner.class))
+ .addAsLibrary(JarLocation.jarLocation(TCKConstants.class).getAbsolutePath().replace("-tests.jar", "-test-sources.jar"))
+ .add(EmptyAsset.INSTANCE, "WEB-INF/beans.xml"));
+ }
+
+
+ @Override
+ public List<DeploymentDescription> generate(final TestClass testClass) {
+ final List<DeploymentDescription> stdDeploymentDescriptions = standard.generate(testClass);
+
+ if (stdDeploymentDescriptions != null && !stdDeploymentDescriptions.isEmpty()) {
+ return stdDeploymentDescriptions;
+ }
+
+ return Collections.singletonList(emptyTestWebApp);
+ }
+ }
+
+ /**
+ * An ApplicationArchiveProcessor for the MP-JWT TCK if needed
+ * With the current implementation we don't need to do anything
+ */
+ public static class MPJWTTCKArchiveProcess implements ApplicationArchiveProcessor {
+ private static Logger log = Logger.getLogger(MPJWTTCKArchiveProcess.class.getName());
+
+ @Override
+ public void process(final Archive<?> appArchive, final TestClass testClass) {
+ if (!(appArchive instanceof WebArchive)) {
+ return;
+ }
+ final WebArchive war = WebArchive.class.cast(appArchive);
+ war.addClass(JWTAuthContextInfoProvider.class);
+
+ log.info("Augmented war: \n"+war.toString(true));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tck/microprofile-tck/jwt/src/test/resources/META-INF/services/org.eclipse.microprofile.jwt.tck.util.ITokenParser
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/jwt/src/test/resources/META-INF/services/org.eclipse.microprofile.jwt.tck.util.ITokenParser b/tck/microprofile-tck/jwt/src/test/resources/META-INF/services/org.eclipse.microprofile.jwt.tck.util.ITokenParser
new file mode 100644
index 0000000..4dcc059
--- /dev/null
+++ b/tck/microprofile-tck/jwt/src/test/resources/META-INF/services/org.eclipse.microprofile.jwt.tck.util.ITokenParser
@@ -0,0 +1 @@
+org.apache.tomee.microprofile.jwt.TCKTokenParser
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tck/microprofile-tck/jwt/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/jwt/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/tck/microprofile-tck/jwt/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
new file mode 100644
index 0000000..98a4867
--- /dev/null
+++ b/tck/microprofile-tck/jwt/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
@@ -0,0 +1 @@
+org.apache.tomee.microprofile.jwt.AppDeploymentExtension
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tck/microprofile-tck/jwt/src/test/resources/arquillian.xml
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/jwt/src/test/resources/arquillian.xml b/tck/microprofile-tck/jwt/src/test/resources/arquillian.xml
new file mode 100644
index 0000000..8e7a66b
--- /dev/null
+++ b/tck/microprofile-tck/jwt/src/test/resources/arquillian.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<arquillian
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://jboss.org/schema/arquillian
+ http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+ <container qualifier="tomee" default="true">
+ <configuration>
+ <property name="catalina_opts">-Xmx512m -XX:MaxPermSize=512m</property>
+ <property name="httpPort">-1</property>
+ <property name="stopPort">-1</property>
+ <property name="ajpPort">-1</property>
+ <property name="classifier">microprofile</property>
+ <property name="debug">false</property>
+ <property name="dir">target/tomee-tck</property>
+ <property name="appWorkingDir">target/tck-workdir</property>
+ <property name="simpleLog">true</property>
+ <property name="properties"></property>
+ </configuration>
+ </container>
+</arquillian>
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tck/microprofile-tck/jwt/src/test/resources/dev.xml
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/jwt/src/test/resources/dev.xml b/tck/microprofile-tck/jwt/src/test/resources/dev.xml
new file mode 100644
index 0000000..00741d1
--- /dev/null
+++ b/tck/microprofile-tck/jwt/src/test/resources/dev.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+ -->
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+<suite name="microprofile-jwt-auth-FullTCK" verbose="1" preserve-order="true" configfailurepolicy="continue" >
+
+ <!-- The required base JAX-RS and CDI based tests that all MP-JWT implementations
+ must pass.
+ -->
+
+ <test name="base-tests" verbose="10">
+ <groups>
+ <define name="base-groups">
+ <include name="arquillian" description="Arquillian internal"/>
+ <include name="utils" description="Utility tests"/>
+ <include name="jwt" description="Base JsonWebToken tests"/>
+ <include name="jaxrs" description="JAX-RS invocation tests"/>
+ <include name="cdi" description="Base CDI injection of ClaimValues"/>
+ <include name="cdi-json" description="CDI injection of JSON-P values"/>
+ <include name="cdi-provider" description="CDI injection of javax.inject.Provider values"/>
+ </define>
+ <define name="excludes">
+ <include name="debug" description="Internal debugging tests" />
+ </define>
+ <run>
+ <include name="base-groups" />
+ <exclude name="excludes" />
+ </run>
+ </groups>
+ <classes>
+ <class name="org.eclipse.microprofile.jwt.tck.parsing.TokenValidationTest" />
+ <class name="org.eclipse.microprofile.jwt.tck.util.TokenUtilsTest" />
+ <class name="org.eclipse.microprofile.jwt.tck.parsing.TestTokenClaimTypesTest" />
+ <class name="org.eclipse.microprofile.jwt.tck.container.jaxrs.UnsecuredPingTest" />
+ <class name="org.eclipse.microprofile.jwt.tck.container.jaxrs.RequiredClaimsTest" />
+ <class name="org.eclipse.microprofile.jwt.tck.container.jaxrs.PrimitiveInjectionTest" />
+ <class name="org.eclipse.microprofile.jwt.tck.container.jaxrs.ClaimValueInjectionTest" />
+ <class name="org.eclipse.microprofile.jwt.tck.container.jaxrs.JsonValueInjectionTest" />
+ <class name="org.eclipse.microprofile.jwt.tck.container.jaxrs.ProviderInjectionTest" />
+ <class name="org.eclipse.microprofile.jwt.tck.container.jaxrs.InvalidTokenTest" />
+ <class name="org.eclipse.microprofile.jwt.tck.container.jaxrs.RolesAllowedTest" />
+ <class name="org.eclipse.microprofile.jwt.tck.container.jaxrs.RolesAllowedTest" />
+ <!--
+ -->
+ </classes>
+ </test>
+
+ <test name="extended-tests" verbose="10">
+ <groups>
+ <define name="extended-groups">
+ <include name="arquillian" description="Arquillian internal"/>
+ <include name="ejb-optional" description="EJB container integration tests"/>
+ <include name="jacc-optional" description="JACC API integration tests"/>
+ <include name="servlet-optional" description="Servlet container integration tests"/>
+ <include name="ee-security-optional" description="Java EE security feature tests"/>
+ </define>
+ <define name="excludes">
+ <include name="debug" description="Internal debugging tests" />
+ </define>
+ <run>
+ <include name="extended-groups" />
+ <exclude name="excludes" />
+ </run>
+ </groups>
+ <classes>
+ <class name="org.eclipse.microprofile.jwt.tck.container.ejb.EjbTest" >
+ <methods>
+ <!-- Excluded cause we never really enforce ACC context for EJB Calls in TomEE -->
+ <exclude name="getSubjectClass"/>
+ </methods>
+ </class>
+
+ <class name="org.eclipse.microprofile.jwt.tck.container.servlet.ServletTest" />
+ <class name="org.eclipse.microprofile.jwt.tck.container.jacc.SubjectTest" />
+ <!--
+ -->
+ </classes>
+ </test>
+</suite>
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tck/microprofile-tck/pom.xml
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/pom.xml b/tck/microprofile-tck/pom.xml
new file mode 100644
index 0000000..f3c528f
--- /dev/null
+++ b/tck/microprofile-tck/pom.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>tck</artifactId>
+ <version>7.0.5-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>microprofile-tck</artifactId>
+ <packaging>pom</packaging>
+ <name>OpenEJB :: TCK :: MicroProfile</name>
+
+ <modules>
+ <module>config</module>
+ <module>jwt</module>
+ </modules>
+
+</project>
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tck/pom.xml
----------------------------------------------------------------------
diff --git a/tck/pom.xml b/tck/pom.xml
index 774c80b..8a672f4 100644
--- a/tck/pom.xml
+++ b/tck/pom.xml
@@ -36,6 +36,7 @@
<module>cdi-embedded</module>
<module>cdi-tomee</module>
<module>bval-tomee</module>
+ <module>microprofile-tck</module>
<!-- TODO: either really use this module or delete it -->
<module>bval-embedded</module>
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tomee/apache-tomee/pom.xml
----------------------------------------------------------------------
diff --git a/tomee/apache-tomee/pom.xml b/tomee/apache-tomee/pom.xml
index 9cc3790..4484905 100644
--- a/tomee/apache-tomee/pom.xml
+++ b/tomee/apache-tomee/pom.xml
@@ -36,6 +36,7 @@
<webprofile.work-dir>${project.build.directory}/webprofile-work-dir</webprofile.work-dir>
<plus.work-dir>${project.build.directory}/plus-work-dir</plus.work-dir>
<plume.work-dir>${project.build.directory}/plume-work-dir</plume.work-dir>
+ <microprofile.work-dir>${project.build.directory}/microprofile-work-dir</microprofile.work-dir>
</properties>
<dependencies>
@@ -91,6 +92,13 @@
<type>war</type>
<scope>provided</scope>
</dependency>
+ <dependency> <!-- to be sure to have it -->
+ <groupId>${project.groupId}</groupId>
+ <artifactId>tomee-microprofile-webapp</artifactId>
+ <version>${project.version}</version>
+ <type>war</type>
+ <scope>provided</scope>
+ </dependency>
<!-- needed for EJBContainer impl so scope compile -->
<dependency>
@@ -225,6 +233,25 @@
</artifactItems>
</configuration>
</execution>
+ <execution>
+ <id>copy-tomcat-for-microprofile</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat</artifactId>
+ <version>${tomcat.version}</version>
+ <type>zip</type>
+ <outputDirectory>${microprofile.work-dir}</outputDirectory>
+ <destFileName>apache-tomcat-${tomcat.version}.zip</destFileName>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
</executions>
</plugin>
@@ -323,6 +350,22 @@
</source>
</configuration>
</execution>
+ <execution>
+ <id>execute-microprofile-installer</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <properties>
+ <tomee.workdir>${microprofile.work-dir}</tomee.workdir>
+ <tomee.webapp>tomee-microprofile-webapp</tomee.webapp>
+ </properties>
+ <source>
+ new commands.SetupCommand(pom: this, log: log, project: project, ant: ant, properties: properties).execute()
+ </source>
+ </configuration>
+ </execution>
</executions>
</plugin>
@@ -375,6 +418,21 @@
<goal>single</goal>
</goals>
</execution>
+ <execution>
+ <id>microprofile</id>
+ <phase>package</phase>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/tomee-microprofile.xml</descriptor>
+ </descriptors>
+ <attach>false</attach>
+ <appendAssemblyId>false</appendAssemblyId>
+ <finalName>apache-tomee-microprofile-${project.version}</finalName>
+ </configuration>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
</executions>
</plugin>
@@ -420,6 +478,16 @@
<type>tar.gz</type>
<classifier>plume</classifier>
</artifact>
+ <artifact>
+ <file>${project.build.directory}/apache-tomee-microprofile-${project.version}.zip</file>
+ <type>zip</type>
+ <classifier>microprofile</classifier>
+ </artifact>
+ <artifact>
+ <file>${project.build.directory}/apache-tomee-microprofile-${project.version}.tar.gz</file>
+ <type>tar.gz</type>
+ <classifier>microprofile</classifier>
+ </artifact>
</artifacts>
</configuration>
</execution>
@@ -428,4 +496,4 @@
</plugins>
</build>
-</project>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tomee/apache-tomee/src/main/assembly/tomee-microprofile.xml
----------------------------------------------------------------------
diff --git a/tomee/apache-tomee/src/main/assembly/tomee-microprofile.xml b/tomee/apache-tomee/src/main/assembly/tomee-microprofile.xml
new file mode 100644
index 0000000..7c2d074
--- /dev/null
+++ b/tomee/apache-tomee/src/main/assembly/tomee-microprofile.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+
+<!-- $Rev: 576067 $ $Date: 2007-09-16 03:17:08 -0700 (Sun, 16 Sep 2007) $ -->
+
+<assembly>
+ <id>tomee-microprofile</id>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>${microprofile.work-dir}/apache-tomcat-${tomcat.version}</directory>
+ <outputDirectory>/apache-tomee-microprofile-${project.version}</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <excludes>
+ <exclude>LICENSE</exclude>
+ <exclude>NOTICE</exclude>
+ <exclude>**/bin/**/*</exclude>
+ <exclude>**/lib/tomcat-annotations-api*.jar</exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/target/maven-shared-archive-resources/META-INF/</directory>
+ <outputDirectory>/apache-tomee-microprofile-${project.version}</outputDirectory>
+ <includes>
+ <include>LICENSE</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/src/main/resources/META-INF/microprofile/</directory>
+ <outputDirectory>/apache-tomee-microprofile-${project.version}</outputDirectory>
+ <includes>
+ <include>*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/target/classes</directory>
+ <outputDirectory>/apache-tomee-microprofile-${project.version}/bin</outputDirectory>
+ <includes>
+ <include>service.*</include>
+ <include>TomEE.*</include>
+ <include>tomee.bat</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/target/classes</directory>
+ <outputDirectory>/apache-tomee-microprofile-${project.version}/bin</outputDirectory>
+ <includes>
+ <include>*.sh</include>
+ </includes>
+ <fileMode>0755</fileMode>
+ </fileSet>
+ <fileSet>
+ <directory>${microprofile.work-dir}/apache-tomcat-${tomcat.version}</directory>
+ <outputDirectory>/apache-tomee-microprofile-${project.version}</outputDirectory>
+ <includes>
+ <include>**/bin/**/*</include>
+ </includes>
+ <fileMode>0755</fileMode>
+ </fileSet>
+ </fileSets>
+</assembly>
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tomee/pom.xml
----------------------------------------------------------------------
diff --git a/tomee/pom.xml b/tomee/pom.xml
index 2a299cf..c92e163 100644
--- a/tomee/pom.xml
+++ b/tomee/pom.xml
@@ -47,6 +47,7 @@
<module>tomee-plume-webapp</module>
<module>tomee-webservices</module>
<module>tomee-embedded</module>
+ <module>tomee-microprofile-webapp</module>
<module>apache-tomee</module>
<module>tomee-util</module>
<module>tomee-juli</module>
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tomee/tomee-microprofile-webapp/pom.xml
----------------------------------------------------------------------
diff --git a/tomee/tomee-microprofile-webapp/pom.xml b/tomee/tomee-microprofile-webapp/pom.xml
new file mode 100644
index 0000000..30f29d2
--- /dev/null
+++ b/tomee/tomee-microprofile-webapp/pom.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+
+<!-- $Rev: 600338 $ $Date: 2007-12-02 09:08:04 -0800 (Sun, 02 Dec 2007) $ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <artifactId>tomee</artifactId>
+ <groupId>org.apache.tomee</groupId>
+ <version>7.0.5-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>tomee-microprofile-webapp</artifactId>
+ <name>OpenEJB :: TomEE :: MicroProfile Webapp</name>
+ <packaging>war</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+ <microprofile.config.api.version>1.3-SNAPSHOT</microprofile.config.api.version>
+ <microprofile.config.impl.version>1.2-SNAPSHOT</microprofile.config.impl.version>
+
+ <microprofile.jwt.api.version>1.1-SNAPSHOT</microprofile.jwt.api.version>
+ <microprofile.jwt.impl.version>${project.version}</microprofile.jwt.impl.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>tomee-webapp</artifactId>
+ <version>${project.version}</version>
+ <type>war</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.microprofile.config</groupId>
+ <artifactId>microprofile-config-api</artifactId>
+ <version>${microprofile.config.api.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.config</groupId>
+ <artifactId>geronimo-config-impl</artifactId>
+ <version>${microprofile.config.impl.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.microprofile.jwt</groupId>
+ <artifactId>microprofile-jwt-auth-api</artifactId>
+ <version>${microprofile.jwt.api.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>mp-jwt</artifactId>
+ <version>${microprofile.jwt.impl.version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>war</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>src/main/assembly/war.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/tomee/blob/c456f4be/tomee/tomee-microprofile-webapp/src/main/assembly/war.xml
----------------------------------------------------------------------
diff --git a/tomee/tomee-microprofile-webapp/src/main/assembly/war.xml b/tomee/tomee-microprofile-webapp/src/main/assembly/war.xml
new file mode 100644
index 0000000..9a7ba10
--- /dev/null
+++ b/tomee/tomee-microprofile-webapp/src/main/assembly/war.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<assembly>
+ <id>war</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>target/maven-shared-archive-resources</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}</directory>
+ <includes>
+ <include>README.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/src/main/webapp</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/target/classes</directory>
+ <outputDirectory>/</outputDirectory>
+ <excludes>
+ <exclude>org/**</exclude>
+ <exclude>META-INF/LICENSE</exclude>
+ <exclude>META-INF/NOTICE</exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/target/classes</directory>
+ <outputDirectory>WEB-INF/classes</outputDirectory>
+ <excludes>
+ <exclude>META-INF/LICENSE</exclude>
+ <exclude>META-INF/NOTICE</exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.build.directory}/${project.artifactId}-${project.version}/</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>WEB-INF/web.xml</include>
+ <include>WEB-INF/classes/**</include>
+ <include>**/*.html</include>
+ <include>**/*.css</include>
+ <include>**/*.js</include>
+ <include>lib/*.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ <scope>runtime</scope>
+ <excludes>
+ <!-- provided -->
+ <exclude>org.apache.tomcat:*</exclude>
+ <!-- wars and pom -->
+ <exclude>*:war</exclude>
+ <exclude>*:pom</exclude>
+ </excludes>
+ </dependencySet>
+ <dependencySet>
+ <outputDirectory>WEB-INF/lib</outputDirectory>
+ <scope>runtime</scope>
+ <includes>
+ <include>org.apache.tomee:tomee-loader</include>
+ <include>org.codehaus.swizzle:swizzle-stream</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
+