@@ -59,6 +59,7 @@ public void testCodeFlowNoConsent() throws IOException {
59
59
60
60
Cookie stateCookie = getStateCookie (webClient , null );
61
61
assertNotNull (stateCookie );
62
+ assertEquals (stateCookie .getName (), "q_auth_Default_test_" + getStateCookieStateParam (stateCookie ));
62
63
assertNull (stateCookie .getSameSite ());
63
64
64
65
webClient .getCookieManager ().clearCookies ();
@@ -673,9 +674,10 @@ public void testIdTokenInjectionJwtMethod() throws IOException, InterruptedExcep
673
674
WebResponse webResponse = webClient
674
675
.loadWebResponse (
675
676
new WebRequest (URI .create ("http://localhost:8081/web-app/callback-jwt-before-redirect" ).toURL ()));
676
- assertNotNull (getStateCookie (webClient , "tenant-jwt" ));
677
- assertNotNull (getStateCookieStateParam (webClient , "tenant-jwt" ));
678
- assertNull (getStateCookieSavedPath (webClient , "tenant-jwt" ));
677
+ Cookie stateCookie = getNonUniqueStateCookie (webClient , "tenant-jwt" );
678
+ assertEquals (stateCookie .getName (), "q_auth_tenant-jwt" );
679
+ assertNotNull (getStateCookieStateParam (stateCookie ));
680
+ assertNull (getStateCookieSavedPath (stateCookie ));
679
681
680
682
HtmlPage page = webClient .getPage (webResponse .getResponseHeaderValue ("location" ));
681
683
assertEquals ("Sign in to quarkus" , page .getTitleText ());
@@ -1265,15 +1267,29 @@ private Cookie getStateCookie(WebClient webClient, String tenantId) {
1265
1267
return null ;
1266
1268
}
1267
1269
1270
+ private Cookie getNonUniqueStateCookie (WebClient webClient , String tenantId ) {
1271
+ String cookieName = "q_auth" + (tenantId == null ? "_Default_test" : "_" + tenantId );
1272
+ return webClient .getCookieManager ().getCookie (cookieName );
1273
+ }
1274
+
1268
1275
private String getStateCookieStateParam (WebClient webClient , String tenantId ) {
1269
1276
return getStateCookie (webClient , tenantId ).getValue ().split ("\\ |" )[0 ];
1270
1277
}
1271
1278
1279
+ private String getStateCookieStateParam (Cookie stateCookie ) {
1280
+ return stateCookie .getValue ().split ("\\ |" )[0 ];
1281
+ }
1282
+
1272
1283
private String getStateCookieSavedPath (WebClient webClient , String tenantId ) {
1273
1284
String [] parts = getStateCookie (webClient , tenantId ).getValue ().split ("\\ |" );
1274
1285
return parts .length == 2 ? parts [1 ] : null ;
1275
1286
}
1276
1287
1288
+ private String getStateCookieSavedPath (Cookie stateCookie ) {
1289
+ String [] parts = stateCookie .getValue ().split ("\\ |" );
1290
+ return parts .length == 2 ? parts [1 ] : null ;
1291
+ }
1292
+
1277
1293
private Cookie getSessionCookie (WebClient webClient , String tenantId ) {
1278
1294
return webClient .getCookieManager ().getCookie ("q_session" + (tenantId == null ? "_Default_test" : "_" + tenantId ));
1279
1295
}
0 commit comments