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#27336 from sberyozkin/oidc_session_expir…
…es_in_fix Deprecate OidcSession#expiresIn and add new methods
- Loading branch information
Showing
4 changed files
with
48 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
import io.quarkus.test.junit.QuarkusTest; | ||
import io.restassured.RestAssured; | ||
import io.smallrye.jwt.util.KeyUtils; | ||
import io.vertx.core.json.JsonObject; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Pedro Igor</a> | ||
|
@@ -256,10 +257,18 @@ public void testCodeFlowForceHttpsRedirectUriWithQueryAndPkce() throws Exception | |
URI endpointLocationWithoutQueryUri = URI.create(endpointLocationWithoutQuery); | ||
assertEquals("code=b", endpointLocationWithoutQueryUri.getRawQuery()); | ||
|
||
page = webClient.getPage(endpointLocationWithoutQueryUri.toURL()); | ||
assertEquals("tenant-https:reauthenticated?code=b", page.getBody().asText()); | ||
Cookie sessionCookie = getSessionCookie(webClient, "tenant-https_test"); | ||
assertNotNull(sessionCookie); | ||
JsonObject idToken = OidcUtils.decodeJwtContent(sessionCookie.getValue().split("\\|")[0]); | ||
String expiresAt = idToken.getInteger("exp").toString(); | ||
page = webClient.getPage(endpointLocationWithoutQueryUri.toURL()); | ||
String response = page.getBody().asText(); | ||
assertTrue( | ||
response.startsWith("tenant-https:reauthenticated?code=b&expiresAt=" + expiresAt + "&expiresInDuration=")); | ||
Integer duration = Integer.valueOf(response.substring(response.length() - 1)); | ||
assertTrue(duration > 1 && duration < 5); | ||
sessionCookie = getSessionCookie(webClient, "tenant-https_test"); | ||
assertNotNull(sessionCookie); | ||
webClient.getCookieManager().clearCookies(); | ||
} | ||
} | ||
|