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.
Merge pull request quarkusio#4221 from stuartwdouglas/authenticated
Wire up @authenticated when used with JAX-RS
- Loading branch information
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