Skip to content

Commit 501b29a

Browse files
committed
WFLY-13528 No response on default endpoint that JBDS opens upon deployment in microprofile-* QS
1 parent b69abce commit 501b29a

File tree

20 files changed

+198
-31
lines changed

20 files changed

+198
-31
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.wildfly.quickstarts.microprofile.config;
2+
3+
import javax.ws.rs.GET;
4+
import javax.ws.rs.Path;
5+
import javax.ws.rs.Produces;
6+
import javax.ws.rs.core.MediaType;
7+
8+
@Path("/")
9+
public class RootResource {
10+
11+
@GET
12+
@Produces(MediaType.TEXT_PLAIN)
13+
public String getRootResponse() {
14+
return "MicroProfile Config quickstart deployed successfully. You can find the available operations in the included README file.";
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.wildfly.quickstarts.microprofile.faulttolerance;
2+
3+
import javax.ws.rs.GET;
4+
import javax.ws.rs.Path;
5+
import javax.ws.rs.Produces;
6+
import javax.ws.rs.core.MediaType;
7+
8+
@Path("/")
9+
public class RootResource {
10+
11+
@GET
12+
@Produces(MediaType.TEXT_PLAIN)
13+
public String getRootResponse() {
14+
return "MicroProfile Fault Tolerance quickstart deployed successfully. You can find the available operations in the included README file.";
15+
}
16+
}

microprofile-health/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@
4242
<artifactId>microprofile-config-api</artifactId>
4343
<scope>provided</scope>
4444
</dependency>
45+
<!-- Import the Jakarta REST API, we use provided scope as the API is included in the server -->
46+
<dependency>
47+
<groupId>org.jboss.spec.javax.ws.rs</groupId>
48+
<artifactId>jboss-jaxrs-api_2.1_spec</artifactId>
49+
<scope>provided</scope>
50+
</dependency>
4551

4652
<!-- Needed for running tests (you may also use TestNG) -->
4753
<dependency>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package org.wildfly.quickstarts.microprofile.health;
2+
3+
import javax.ws.rs.ApplicationPath;
4+
import javax.ws.rs.core.Application;
5+
6+
@ApplicationPath("/")
7+
public class JaxRsApplication extends Application {
8+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.wildfly.quickstarts.microprofile.health;
2+
3+
import javax.ws.rs.GET;
4+
import javax.ws.rs.Path;
5+
import javax.ws.rs.Produces;
6+
import javax.ws.rs.core.MediaType;
7+
8+
@Path("/")
9+
public class RootResource {
10+
11+
@GET
12+
@Produces(MediaType.TEXT_PLAIN)
13+
public String getRootResponse() {
14+
return "MicroProfile Health quickstart deployed successfully. You can find the available operations in the included README file.";
15+
}
16+
}

microprofile-jwt/README.adoc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ An unauthenticated call can be made to one of the deployed endpoints using the f
6161

6262
[source]
6363
----
64-
$ curl http://localhost:8080/microprofile-jwt/rest/Sample/helloworld
64+
$ curl http://localhost:8080/microprofile-jwt/Sample/helloworld
6565
Hello anonymous
6666
----
6767

@@ -83,7 +83,7 @@ A call can now be made to the first endpoint using the generated JWT token withi
8383

8484
[source]
8585
----
86-
$ curl -H "Authorization: Bearer eyJ...59g" http://localhost:8080/microprofile-jwt/rest/Sample/helloworld
86+
$ curl -H "Authorization: Bearer eyJ...59g" http://localhost:8080/microprofile-jwt/Sample/helloworld
8787
Hello testUser
8888
----
8989

@@ -92,7 +92,7 @@ called using the following command: -
9292

9393
[source]
9494
----
95-
$ curl -H "Authorization: Bearer ey..rg" http://localhost:8080/microprofile-jwt/rest/Sample/subscription
95+
$ curl -H "Authorization: Bearer ey..rg" http://localhost:8080/microprofile-jwt/Sample/subscription
9696
hello + testUser, hasJWT: true
9797
----
9898

@@ -109,15 +109,15 @@ JWT Claims - {"sub":"testUser","upn":"testUser","iss":"quickstart-jwt-issuer","a
109109
Generated JWT Token
110110
eyJraWQiOiJUZXN0IEtleSIsInR5cCI6Imp3dCIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiJ0ZXN0VXNlciIsInVwbiI6InRlc3RVc2VyIiwiaXNzIjoicXVpY2tzdGFydC1qd3QtaXNzdWVyIiwiYXVkIjoiand0LWF1ZGllbmNlIiwiZ3JvdXBzIjpbIkVjaG9lciJdLCJiaXJ0aGRhdGUiOiIyMDE3LTA5LTE1IiwianRpIjoiNDM0Njg3NGYtZWI0OC00ZDg0LWFiNTEtYzZlZmQxY2QyMmQ1IiwiaWF0IjoxNTgwMTM2OTcwLCJleHAiOjE1ODAxNTEzNzB9.NjWlGGi5iB2PW-g_fs74EgwiyOrgRSsHDym5PS7H3o6T3aEb3ZnMmx7W9uhT_pXvpAL_fboXxy7WMQHukGb_ywtxAmTlA7ecrsia-O9EYV2Gr1ZhlQ9kYVERwZdo5lFqphMvERJ1tClTR3Jk37tpu54HVgFquhUEXlEcldOSeRbYHF9fkiVD6_UPR9bfphhCdwzIbeDVnBJ3FuRl_ZuSxWCoWaRSLPGjuR3JzMlUWkRV8RXhRLTkFRgNowOx_uFFK6q7_aOVqQaHixRqT4ULcO9WiA7f6Up0NMscvq-aT3VFw64qEmn2S8pfX7PpSuAB71Z7w0dwhf4qx3iYklfAPw
111111
112-
$ curl -H "Authorization: Bearer ey..rg" http://localhost:8080/microprofile-jwt/rest/Sample/subscription
112+
$ curl -H "Authorization: Bearer ey..rg" http://localhost:8080/microprofile-jwt/Sample/subscription
113113
Access forbidden: role not allowed
114114
----
115115

116116
The quickstart also contains an endpoint that makes use of the `birthdate` claim to calculate how long until the callers birthday, this can be called using a token which contains the `Subscriber` group.
117117

118118
[source]
119119
----
120-
$ curl -H "Authorization: Bearer ey..rg" http://localhost:8080/microprofile-jwt/rest/Sample/birthday
120+
$ curl -H "Authorization: Bearer ey..rg" http://localhost:8080/microprofile-jwt/Sample/birthday
121121
7 months and 19 days until your next birthday.
122122
----
123123

@@ -291,7 +291,7 @@ import javax.ws.rs.core.Application;
291291
292292
import org.eclipse.microprofile.auth.LoginConfig;
293293
294-
@ApplicationPath("/rest")
294+
@ApplicationPath("/")
295295
@LoginConfig(authMethod="MP-JWT", realmName="MP JWT Realm")
296296
public class App extends Application {}
297297
----
@@ -342,7 +342,7 @@ The endpoint can now be called using the following command: -
342342

343343
[source]
344344
----
345-
$ curl http://localhost:8080/microprofile-jwt/rest/Sample/helloworld
345+
$ curl http://localhost:8080/microprofile-jwt/Sample/helloworld
346346
Hello World
347347
----
348348

@@ -383,7 +383,7 @@ As before, deploy and call the endpoint.
383383
----
384384
$ mvn package wildfly:deploy
385385
386-
$ curl http://localhost:8080/microprofile-jwt/rest/Sample/helloworld
386+
$ curl http://localhost:8080/microprofile-jwt/Sample/helloworld
387387
Hello anonymous
388388
----
389389

@@ -546,7 +546,7 @@ import javax.ws.rs.core.Application;
546546
547547
import org.eclipse.microprofile.auth.LoginConfig;
548548
549-
@ApplicationPath("/rest")
549+
@ApplicationPath("/")
550550
@LoginConfig(authMethod="MP-JWT", realmName="MP JWT Realm")
551551
public class App extends Application {}
552552
----
@@ -566,15 +566,15 @@ As before, deploy and call the endpoint.
566566
----
567567
$ mvn package wildfly:deploy
568568
569-
$ curl http://localhost:8080/microprofile-jwt/rest/Sample/helloworld
569+
$ curl http://localhost:8080/microprofile-jwt/Sample/helloworld
570570
Hello anonymous
571571
----
572572

573573
A new token can now be generated using the TokenUtility created previously and the token passed in as we call the endpoint.
574574

575575
[source]
576576
----
577-
$ curl -H "Authorization: Bearer eyJ...59g" http://localhost:8080/microprofile-jwt/rest/Sample/helloworld
577+
$ curl -H "Authorization: Bearer eyJ...59g" http://localhost:8080/microprofile-jwt/Sample/helloworld
578578
Hello testUser
579579
----
580580

@@ -640,15 +640,15 @@ Using a recently generated token the new endpoint can be called.
640640

641641
[source]
642642
----
643-
$ curl -H "Authorization: Bearer ey..rg" http://localhost:8080/microprofile-jwt/rest/Sample/subscription
643+
$ curl -H "Authorization: Bearer ey..rg" http://localhost:8080/microprofile-jwt/Sample/subscription
644644
hello + testUser, hasJWT: true
645645
----
646646

647647
If a token is now generated without including the “Subscriber” group access should be denied to the endpoint.
648648

649649
[source]
650650
----
651-
$ curl -H "Authorization: Bearer ey..Pw" http://localhost:8080/microprofile-jwt/rest/Sample/subscription
651+
$ curl -H "Authorization: Bearer ey..Pw" http://localhost:8080/microprofile-jwt/Sample/subscription
652652
Access forbidden: role not allowed
653653
----
654654

@@ -713,7 +713,7 @@ Using a recently generated token the new endpoint can be called.
713713

714714
[source]
715715
----
716-
$ curl -H "Authorization: Bearer ey..rg" http://localhost:8080/microprofile-jwt/rest/Sample/birthday
716+
$ curl -H "Authorization: Bearer ey..rg" http://localhost:8080/microprofile-jwt/Sample/birthday
717717
7 months and 19 days until your next birthday.
718718
----
719719

microprofile-jwt/src/main/java/org/wildfly/quickstarts/mpjwt/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323

2424
import org.eclipse.microprofile.auth.LoginConfig;
2525

26-
@ApplicationPath("/rest")
26+
@ApplicationPath("/")
2727
@LoginConfig(authMethod="MP-JWT", realmName="MP JWT Realm")
2828
public class App extends Application {}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.wildfly.quickstarts.mpjwt;
2+
3+
import javax.ws.rs.GET;
4+
import javax.ws.rs.Path;
5+
import javax.ws.rs.Produces;
6+
import javax.ws.rs.core.MediaType;
7+
8+
@Path("/")
9+
public class RootResource {
10+
11+
@GET
12+
@Produces(MediaType.TEXT_PLAIN)
13+
public String getRootResponse() {
14+
return "MicroProfile JWT quickstart deployed successfully. You can find the available operations in the included README file.";
15+
}
16+
}

microprofile-jwt/src/test/java/org/wildfly/quickstarts/mpjwt/JWTClientIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
@RunAsClient
5353
public class JWTClientIT {
5454

55-
private static final String ROOT_PATH = "/rest/Sample/";
55+
private static final String ROOT_PATH = "/Sample/";
5656
private static final String HELLO_WORLD = "helloworld";
5757
private static final String SUBSCRIPTION = "subscription";
5858
private static final String BIRTHDAY = "birthday";
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.wildfly.quickstarts.microprofile.metrics;
2+
3+
import javax.ws.rs.GET;
4+
import javax.ws.rs.Path;
5+
import javax.ws.rs.Produces;
6+
import javax.ws.rs.core.MediaType;
7+
8+
@Path("/")
9+
public class RootResource {
10+
11+
@GET
12+
@Produces(MediaType.TEXT_PLAIN)
13+
public String getRootResponse() {
14+
return "MicroProfile Metrics quickstart deployed successfully. You can find the available operations in the included README file.";
15+
}
16+
}

0 commit comments

Comments
 (0)