Skip to content

Commit

Permalink
Merge pull request #716 from kabir/WFLY-18496-mp-jwt
Browse files Browse the repository at this point in the history
[WFLY-18496[ microprofile-jwt Quickstart CY2023Q3 enhancements
  • Loading branch information
emmartins authored Oct 2, 2023
2 parents f7c3e3f + 59a5df3 commit 59c5fad
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 148 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/quickstart_microprofile-jwt_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: WildFly microprofile-jwt Quickstart CI

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'microprofile-jwt/**'
- '.github/workflows/quickstart_ci.yml'
jobs:
call-quickstart_ci:
uses: ./.github/workflows/quickstart_ci.yml
with:
QUICKSTART_PATH: microprofile-jwt
MICROPROFILE: true
21 changes: 6 additions & 15 deletions microprofile-jwt/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ please read through the next section where the process to generate this quicksta

It is also possible to run each of these calls from the test case included in the quickstart.

include::../shared-doc/run-arquillian-tests.adoc[leveloffset=+2]
// Server Distribution Testing
include::../shared-doc/run-integration-tests-with-server-distribution.adoc[leveloffset=+2]

== Starting from Scratch

Expand Down Expand Up @@ -705,22 +706,12 @@ $ curl -H "Authorization: Bearer ey..59g" http://localhost:8080/microprofile-jwt
7 months and 19 days until your next birthday.
----

ifdef::EAPXPRelease[]
// Getting Started with OpenShift
include::../shared-doc/xp-openshift-getting-started.adoc[leveloffset=+1]
//Prepare OpenShift for Quickstart Deployment
include::../shared-doc/xp-create-project.adoc[leveloffset=+2]
// Import the Latest {xpaasproduct-shortname} Image Streams and Templates
include::../shared-doc/xp-import-imagestreams-templates.adoc[leveloffset=+2]
// Deploy the {ProductShortName} Source-to-Image (S2I) Quickstart to OpenShift
include::../shared-doc/xp-deploy-project.adoc[leveloffset=+2]
// Post deployment tasks
include::../shared-doc/xp-post-deployment-tasks.adoc[leveloffset=+2]
endif::[]

//Bootable JAR
// Bootable JAR
include::../shared-doc/build-and-run-the-quickstart-with-bootable-jar.adoc[leveloffset=+1]

// OpenShift
include::../shared-doc/build-and-run-the-quickstart-with-openshift.adoc[leveloffset=+1]

== Conclusion

As demonstrated within this Quickstart the MicroProfile JWT specification provides an easy way to secure deployments without needing
Expand Down
6 changes: 6 additions & 0 deletions microprofile-jwt/charts/helm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build:
uri: https://github.com/wildfly/quickstart.git
ref: main
contextDir: microprofile-jwt
deploy:
replicas: 1
153 changes: 58 additions & 95 deletions microprofile-jwt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,17 @@
</licenses>

<properties>
<!-- The versions for BOMs, Dependencies and Plugins -->
<version.com.nimbusds.jose.jwt>8.5.1.redhat-00001</version.com.nimbusds.jose.jwt>
<version.glassfish.json>1.1.6</version.glassfish.json>
<version.microprofile.bom>30.0.0.Beta1</version.microprofile.bom>
<version.server.bom>30.0.0.Beta1</version.server.bom>
<version.server.bootable-jar>30.0.0.Beta1</version.server.bootable-jar>
<version.wildfly-jar.maven.plugin>10.0.0.Final</version.wildfly-jar.maven.plugin>
<version.jkube.maven.plugin>1.0.1</version.jkube.maven.plugin>
<jkube.generator.from>registry.redhat.io/ubi8/openjdk-11:latest</jkube.generator.from>
<!-- the version for the Server -->
<version.server>30.0.0.Beta1</version.server>
<!-- The versions for BOMs, Packs and Plugins -->
<version.bom.ee>${version.server}</version.bom.ee>
<version.bom.microprofile>${version.server}</version.bom.microprofile>
<version.pack.cloud>4.0.0.Final</version.pack.cloud>
<version.plugin.wildfly>4.2.0.Final</version.plugin.wildfly>
<version.plugin.wildfly-jar>10.0.0.Final</version.plugin.wildfly-jar>
<!-- The versions for other dependencies and plugin -->
<version.com.nimbusds.jose-jwt>8.5.1.redhat-00001</version.com.nimbusds.jose-jwt>
<version.org.glassfish.jakarta.json>1.1.6</version.org.glassfish.jakarta.json>
</properties>

<repositories>
Expand Down Expand Up @@ -114,15 +116,15 @@
<dependency>
<groupId>org.wildfly.bom</groupId>
<artifactId>wildfly-ee-with-tools</artifactId>
<version>${version.server.bom}</version>
<version>${version.bom.ee}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- importing the microprofile BOM adds MicroProfile specs -->
<dependency>
<groupId>org.wildfly.bom</groupId>
<artifactId>wildfly-microprofile</artifactId>
<version>${version.microprofile.bom}</version>
<version>${version.bom.microprofile}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -175,7 +177,7 @@
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>${version.com.nimbusds.jose.jwt}</version>
<version>${version.com.nimbusds.jose-jwt}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -201,23 +203,37 @@
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.json</artifactId>
<version>${version.glassfish.json}</version>
<version>${version.org.glassfish.jakarta.json}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>${version.plugin.wildfly}</version>
</plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-jar-maven-plugin</artifactId>
<version>${version.plugin.wildfly-jar}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<configuration>
<!-- adds versions properties as attributes for substitutions in README.adoc source blocks -->
<attributes>
<versionServerBom>${version.server.bom}</versionServerBom>
<versionMicroprofileBom>${version.microprofile.bom}</versionMicroprofileBom>
<versionGlassfishJson>${version.glassfish.json}</versionGlassfishJson>
<versionComNimbusdsJoseJwt>${version.com.nimbusds.jose.jwt}</versionComNimbusdsJoseJwt>
<versionServerBom>${version.bom.ee}</versionServerBom>
<versionMicroprofileBom>${version.bom.microprofile}</versionMicroprofileBom>
<versionGlassfishJson>${version.org.glassfish.jakarta.json}</versionGlassfishJson>
<versionComNimbusdsJoseJwt>${version.com.nimbusds.jose-jwt}</versionComNimbusdsJoseJwt>
</attributes>
</configuration>
</plugin>
Expand All @@ -232,12 +248,11 @@
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-jar-maven-plugin</artifactId>
<version>${version.wildfly-jar.maven.plugin}</version>
<configuration>
<feature-pack-location>wildfly@maven(org.jboss.universe:community-universe)#${version.server.bootable-jar}</feature-pack-location>
<feature-pack-location>wildfly@maven(org.jboss.universe:community-universe)#${version.server}</feature-pack-location>
<layers>
<layer>jaxrs-server</layer>
<layer>microprofile-platform</layer>
<layer>microprofile-jwt</layer>
</layers>
<plugin-options>
<jboss-fork-embedded>true</jboss-fork-embedded>
Expand All @@ -254,25 +269,28 @@
</plugins>
</build>
</profile>

<profile>
<id>bootable-jar-openshift</id>
<id>openshift</id>
<build>
<plugins>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-jar-maven-plugin</artifactId>
<version>${version.wildfly-jar.maven.plugin}</version>
<artifactId>wildfly-maven-plugin</artifactId>
<configuration>
<!-- would be something like org.jboss.eap:wildfly-galleon-pack:${version.wildfly} for XP 2.0 -->
<feature-pack-location>wildfly@maven(org.jboss.universe:community-universe)#${version.server.bootable-jar}</feature-pack-location>
<feature-packs>
<feature-pack>
<location>org.wildfly:wildfly-galleon-pack:${version.server}</location>
</feature-pack>
<feature-pack>
<location>org.wildfly.cloud:wildfly-cloud-galleon-pack:${version.pack.cloud}</location>
</feature-pack>
</feature-packs>
<layers>
<layer>jaxrs-server</layer>
<layer>microprofile-platform</layer>
<layer>cloud-server</layer>
<layer>microprofile-jwt</layer>
</layers>
<plugin-options>
<jboss-fork-embedded>true</jboss-fork-embedded>
</plugin-options>
<cloud/>
<filename>ROOT.war</filename>
</configuration>
<executions>
<execution>
Expand All @@ -282,90 +300,35 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>openshift-maven-plugin</artifactId>
<version>${version.jkube.maven.plugin}</version>
<executions>
<execution>
<goals>
<goal>resource</goal>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<enricher>
<config>
<jkube-service>
<type>NodePort</type>
</jkube-service>
</config>
</enricher>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- An optional Arquillian testing profile that executes tests in your JBoss EAP instance.
This profile will start a new JBoss EAP instance, and execute the test, shutting it down when done.
Run with: mvn clean verify -Parq-managed -->
<id>arq-managed</id>
<dependencies>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version.failsafe.plugin}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<!-- An optional Arquillian testing profile that executes tests in a remote JBoss EAP instance.
Run with: mvn clean verify -Parq-remote -->
<id>arq-remote</id>
<dependencies>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<id>integration-testing</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version.failsafe.plugin}</version>
<configuration>
<includes>
<include>**/BasicRuntimeIT</include>
<include>**/JWTClientIT</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.wildfly.quickstarts.mpjwt;

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.junit.Test;

import java.io.IOException;
import java.net.URISyntaxException;

import static org.junit.Assert.assertEquals;
import static org.wildfly.quickstarts.mpjwt.TestUtils.HELLO_WORLD;
import static org.wildfly.quickstarts.mpjwt.TestUtils.ROOT_PATH;
import static org.wildfly.quickstarts.mpjwt.TestUtils.getServerHost;

public class BasicRuntimeIT {

private final CloseableHttpClient httpClient = HttpClientBuilder.create().build();
@Test
public void testHTTPEndpointIsAvailable() throws IOException, InterruptedException, URISyntaxException {
HttpGet httpGet = new HttpGet(getServerHost() + ROOT_PATH + HELLO_WORLD);
CloseableHttpResponse httpResponse = httpClient.execute(httpGet);

assertEquals("Successful call", 200, httpResponse.getStatusLine().getStatusCode());

httpResponse.close();

}
}
Loading

0 comments on commit 59c5fad

Please sign in to comment.