Skip to content

Commit 16cf3d7

Browse files
authored
Merge pull request #432 from xstefank/wfly-13528
WFLY-13528 No response on default endpoint that JBDS opens upon deplo…
2 parents 585ce5d + 501b29a commit 16cf3d7

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

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

344344
[source]
345345
----
346-
$ curl http://localhost:8080/microprofile-jwt/rest/Sample/helloworld
346+
$ curl http://localhost:8080/microprofile-jwt/Sample/helloworld
347347
Hello World
348348
----
349349

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

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

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

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

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

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

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

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

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

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

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)