forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wire up @authenticated when used with JAX-RS
This will be changed to use CDI at some point, but for now just make it like up with what we already have
- Loading branch information
1 parent
bffc509
commit 4ec5c0b
Showing
6 changed files
with
53 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,25 @@ public void callEchoNoAuth() { | |
.statusCode(HttpURLConnection.HTTP_UNAUTHORIZED); | ||
} | ||
|
||
@Test() | ||
public void testAuthenticatedAnnotation() { | ||
RestAssured.given() | ||
.when() | ||
.queryParam("input", "hello") | ||
.get("/endp/authenticated") | ||
.then() | ||
.statusCode(HttpURLConnection.HTTP_UNAUTHORIZED); | ||
|
||
io.restassured.response.Response response = RestAssured.given().auth() | ||
.oauth2(token) | ||
.when() | ||
.get("/endp/authenticated").andReturn(); | ||
|
||
Assertions.assertEquals(HttpURLConnection.HTTP_OK, response.getStatusCode()); | ||
String replyString = response.body().asString(); | ||
Assertions.assertEquals("[email protected]", replyString); | ||
} | ||
|
||
/** | ||
* Validate a request without an MP-JWT to unsecured endpoint has HTTP_OK with expected response | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters