From 80d1a2d1553d236a754893048df2e2978f33fc79 Mon Sep 17 00:00:00 2001 From: Sergey Beryozkin Date: Thu, 12 Dec 2024 14:07:44 +0000 Subject: [PATCH] Generate certificates in the OIDC integration test --- integration-tests/oidc-mtls/pom.xml | 52 +++++++-------- integration-tests/oidc/pom.xml | 27 ++++++++ .../src/main/resources/application.properties | 15 +++-- .../src/main/resources/client-keystore.p12 | Bin 2712 -> 0 bytes .../src/main/resources/client-truststore.p12 | Bin 1254 -> 0 bytes .../src/main/resources/server-keystore.p12 | Bin 2712 -> 0 bytes .../src/main/resources/server-truststore.p12 | Bin 1238 -> 0 bytes .../oidc/src/main/resources/upconfig.json | 60 ------------------ .../AbstractBearerTokenAuthorizationTest.java | 4 +- ...KeycloakXTestResourceLifecycleManager.java | 4 +- .../it/keycloak/WebsocketOidcTestCase.java | 4 +- .../keycloak/client/KeycloakTestClient.java | 5 +- 12 files changed, 74 insertions(+), 97 deletions(-) delete mode 100644 integration-tests/oidc/src/main/resources/client-keystore.p12 delete mode 100644 integration-tests/oidc/src/main/resources/client-truststore.p12 delete mode 100644 integration-tests/oidc/src/main/resources/server-keystore.p12 delete mode 100644 integration-tests/oidc/src/main/resources/server-truststore.p12 delete mode 100644 integration-tests/oidc/src/main/resources/upconfig.json diff --git a/integration-tests/oidc-mtls/pom.xml b/integration-tests/oidc-mtls/pom.xml index 719118f28efca..7b6b331e319be 100644 --- a/integration-tests/oidc-mtls/pom.xml +++ b/integration-tests/oidc-mtls/pom.xml @@ -87,32 +87,32 @@ - io.smallrye.certs - smallrye-certificate-generator-maven-plugin - - - generate-test-resources - - generate - - - - - - - oidc - - PEM - PKCS12 - - password - backend-service - 2 - true - - - - + io.smallrye.certs + smallrye-certificate-generator-maven-plugin + + + generate-test-resources + + generate + + + + + + + oidc + + PEM + PKCS12 + + password + backend-service + 2 + true + + + + maven-surefire-plugin diff --git a/integration-tests/oidc/pom.xml b/integration-tests/oidc/pom.xml index ff0b6fdd56069..e63f4b8707ff2 100644 --- a/integration-tests/oidc/pom.xml +++ b/integration-tests/oidc/pom.xml @@ -132,6 +132,33 @@ + + io.smallrye.certs + smallrye-certificate-generator-maven-plugin + + + generate-test-resources + + generate + + + + + + + oidc + + PEM + PKCS12 + + password + backend-service + 2 + true + + + + diff --git a/integration-tests/oidc/src/main/resources/application.properties b/integration-tests/oidc/src/main/resources/application.properties index d8b1ec529ad7c..e4552113a34b4 100644 --- a/integration-tests/oidc/src/main/resources/application.properties +++ b/integration-tests/oidc/src/main/resources/application.properties @@ -1,23 +1,24 @@ quarkus.keycloak.devservices.create-realm=false quarkus.keycloak.devservices.start-command=start --https-client-auth=required --hostname-strict=false --https-key-store-file=/etc/server-keystore.p12 --https-trust-store-file=/etc/server-truststore.p12 --https-trust-store-password=password --spi-user-profile-declarative-user-profile-config-file=/opt/keycloak/upconfig.json -quarkus.keycloak.devservices.resource-aliases.keystore=server-keystore.p12 -quarkus.keycloak.devservices.resource-aliases.truststore=server-truststore.p12 +quarkus.keycloak.devservices.resource-aliases.keystore=target/certificates/oidc-keystore.p12 +quarkus.keycloak.devservices.resource-aliases.truststore=target/certificates/oidc-server-truststore.p12 quarkus.keycloak.devservices.resource-mappings.keystore=/etc/server-keystore.p12 quarkus.keycloak.devservices.resource-mappings.truststore=/etc/server-truststore.p12 quarkus.oidc.token.principal-claim=email -quarkus.oidc.tls.verification=required -quarkus.oidc.tls.trust-store-file=client-truststore.p12 +quarkus.oidc.tls.verification=certificate-validation +quarkus.oidc.tls.trust-store-file=target/certificates/oidc-client-truststore.p12 quarkus.oidc.tls.trust-store-password=password -quarkus.oidc.tls.key-store-file=client-keystore.p12 +quarkus.oidc.tls.key-store-file=target/certificates/oidc-client-keystore.p12 quarkus.oidc.tls.key-store-password=password %tls-registry.quarkus.oidc.tls.tls-configuration-name=oidc-tls -%tls-registry.quarkus.tls.oidc-tls.key-store.jks.path=client-keystore.p12 +%tls-registry.quarkus.tls.oidc-tls.key-store.jks.path=target/certificates/oidc-client-keystore.p12 %tls-registry.quarkus.tls.oidc-tls.key-store.jks.password=password -%tls-registry.quarkus.tls.oidc-tls.trust-store.jks.path=client-truststore.p12 +%tls-registry.quarkus.tls.oidc-tls.trust-store.jks.path=target/certificates/oidc-client-truststore.p12 %tls-registry.quarkus.tls.oidc-tls.trust-store.jks.password=password +%tls-registry.quarkus.tls.oidc-tls.hostname-verification-algorithm=NONE %tls-registry.quarkus.oidc.tls.verification= %tls-registry.quarkus.oidc.tls.trust-store-file= %tls-registry.quarkus.oidc.tls.trust-store-password= diff --git a/integration-tests/oidc/src/main/resources/client-keystore.p12 b/integration-tests/oidc/src/main/resources/client-keystore.p12 deleted file mode 100644 index 11df9af88cd7347c52c3133b1bb4c06dad923695..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2712 zcma);S5y-U5{A=57bWywq?bT~fFPkrk=_OAEfhhDkWi!rM4ALNAP7=adR2;wg=VgB zVS&(5YJwomP^5SfT=(oA@7br_hdFcR`{$p>{|u7AL;?Z9NCJ~Kj8Qh#IQ5Vf2nUuC zn3Ny{Cb?f&3Q2%A{+9$Tg%F@czwm=!bsxt39~TP~5L8Bh>imLQNbGM1lojcORR4Qq zLCQf8M#sk!4QP18x4T5PAS2J%rC%FMduYs@83TIDl%vGdjyRSUy=S)Y3b)>E z=%zK=sHH|6fer&MG7OYy+1fi>T`s(xVt#@n_Odo8Jwh%qSqKZ%MrC^KBGr=A2vf5w)o*say&^3=x5d( z^)(re`{4=C!tQmYWxGy4>*dror#xOi(^=nir}vKiGT#JXm+#gX0}&J-hs$)2&eLA3 zzf@7=Y9A3Hc8NsB%J{zCEQs^3)B8FD4p+`)jOo~x#faE!QhYlEXP&E?JXVamyq`dB z-}l{&z>s3LN+KPt`-lFNbEw%Sz%;L&^xgS%knqY_>YX@PAf64ve{;utwfLgHRYSCK zl;!(ay%+e6X<@zByeYSMZ^(gXaqSm|F+Ka9qi@bm1(S(qV`<0paZYFf0yy|~)4PHy zZY?JB;p|4qtk^5Y(9A!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t2uu6d;TJ!s_RXoeA61g+ahA05Iop7C&D6Gxy!xkXz?&T)hHP@JHLvBD!zc| z!D7dx`O~E|Y9!htw-Fw;ebe8Xi@2f8kTtEfysFQFMNfP|gtC)8YW8z9m|Q|Vl9(Pl zXt}5o=Xo4;F(-Y2@n3+=?m>nDIY2|f#qgIuQzUB*7NTZpM=*F2#b-zqS6KxPbW_o@ z-aUqo@xzYf!KKX^m1mQRIrg5og{e8TJ=*UUz$T@GhIrT}9)YK0>~9Cf+>D|doS_|D z_m}8bgO2wUU$_9gQ(Y>**85=4KE^3?RlDskh>r=~3p<%Y{jAa+_JGgj=1NrFz&oLV z<&Yny%}i(Olv--sj4k;+Kc-`^St2n9eyzGzcV=H4W&eak3Mh!KhT39-MP qwxepiM~_piATagJKoH_BJJWocem#<+MT=|gTC-O<$szxWn12FO&)xd~ diff --git a/integration-tests/oidc/src/main/resources/client-truststore.p12 b/integration-tests/oidc/src/main/resources/client-truststore.p12 deleted file mode 100644 index 8a9cefe2f5506a9e6d069666946da65f351d4567..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1254 zcmV&LNQU+thDZTr0|Wso1Q1EXmy!{sQ9w3$<)7P>Xu5!c1K@J*PH6I8x0{Pqqka29-_=BO z=b(@l@pPC&eDCB!F|Vr@xBU>H>ssax#V`Ea#uT4<0l7(j&&+ z>8N96Q;doS{2X3WsXJd^NtCP4Q-Yz!Gqj`SfCf@>{p|Gq_gqVjFWYDEMT&k7raXg7 zblF(bQRA{x_%Pu5q6xhMbXbTrt;7ja!JQ8 zAaTlr$1OjfM^D#jf@BkQwT#cnpC40 zv{lhfs4vrR!Ym&>$a6ZT$T4_l#%37GsLM-?q15}F5Jv)Sug_?wy~?v~68F2@!+qS{3fk00m6d3hhWgn&(6|k13G%H;tv|F)sJUx8c>Fmuz(7pxp$F{{%8b8Cxw8&Gr5JbEcL@wz$QvmQyfZ z2+fQ$0v}Hjfd2gJ!xD;>1-T&^d00_i$<;uioOQ?%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f-QAc(m{&;#wDkK(jjp!fDgbC;0^HmCn6>Pn1V_I5I!8q&GD$xS>>~5&M2uP zHI&tqkras6?;>`#EDFToKq7#EfP)YJ#{vE?Oa~8n+c2`?j#Pt$YvJ?y*tGRyp8pS~ zwL0~N&0q1K6g8uj`oP)HdTP0n_fdcAKJO}G|_Rd zDAGZRraBbGm$&HIb~R@^=rRpKPEN>REpTqMt$$y~I7o^^62-bp)~vJh4o{rah*aI& z{t|qG)0)~^!q4lD+-B>X<+ni>GFL>lODM~u%^lTkhF8ct<6=c8&pP!VJ*HVGVaC0s zwU)o91s+5PFY_uq-_6m}2E5oGfY0nVdj!c*FEKB}ZokEo?Q?-MHq6t}9hT^f+~t+-DjDpJ_LEM!vJMg_j^kC`{O z;}3Z39`cmc6daIk8XV#<>*e8najU}<^f+(wR{I-(t=oh(19z((9`PzOIWozi3*VoI zjYQ=Ip3+=xsc3n$n)^}SN}~7g@Ve)7#?&qUsi+MysWUCas38&J?qAR-@+m;}RAXRM z!SNR5j*SP?32q@yC1&lf(rDR*9?fgad^O)tqpDY{gwoDWkkHOq9#NaIkWKoFmhc3G zJQrFBYA8x#A74$)sO|j>&RaUf_|j*-CnX`pS|QK9Zz%8Q8Gdo@dUyC%ZSa${#YG`S z54qSQLW|9Jcq%!Tz=m_nc9A3SQ>TMDW!|aM=4M(Lc3J7OZ*4DFR>uxUEV>S-H&9;J z-+weqbCbOv}Pn)=Xl!=8cbMQjN=b03N{loJ_T^4CAOTfIM5ZkBQJmzRx>EI z1D2zhRdOQlEQ{7I(t~5)TrhOCBXi@G`B7(bE}{RjJ(Av zK{!Z{*5Jses)$298KtLz}a`Z`NFDB5-f6~#h$z?>tk2mTg r(6pTGb=TNS6F-FhTQ7)!_{}K}lhHeo`E|*eIZ$)GePKP$e-QI8L_6xT diff --git a/integration-tests/oidc/src/main/resources/server-truststore.p12 b/integration-tests/oidc/src/main/resources/server-truststore.p12 deleted file mode 100644 index d006d5d2dd43e1f3fb281ef9b0f70b62366d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6k{F#kOL?OfWpAH=<&{v*odT2lL7)K5Nth0 A8vp start() { diff --git a/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/WebsocketOidcTestCase.java b/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/WebsocketOidcTestCase.java index 3a75d88294dc4..3c3323e40562d 100644 --- a/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/WebsocketOidcTestCase.java +++ b/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/WebsocketOidcTestCase.java @@ -27,7 +27,9 @@ public class WebsocketOidcTestCase { @TestHTTPResource("secured-hello") URI wsUri; - KeycloakTestClient client = new KeycloakTestClient(new Tls()); + KeycloakTestClient client = new KeycloakTestClient( + new Tls("target/certificates/oidc-client-keystore.p12", + "target/certificates/oidc-client-truststore.p12")); @Test public void websocketTest() throws Exception { diff --git a/test-framework/keycloak-server/src/main/java/io/quarkus/test/keycloak/client/KeycloakTestClient.java b/test-framework/keycloak-server/src/main/java/io/quarkus/test/keycloak/client/KeycloakTestClient.java index 55d2b70561e22..f510c3dac6ec3 100644 --- a/test-framework/keycloak-server/src/main/java/io/quarkus/test/keycloak/client/KeycloakTestClient.java +++ b/test-framework/keycloak-server/src/main/java/io/quarkus/test/keycloak/client/KeycloakTestClient.java @@ -455,6 +455,9 @@ public record Tls(String keystore, String keystorePassword, public Tls() { this("client-keystore.p12", "password", "client-truststore.p12", "password"); } - }; + public Tls(String keystore, String truststore) { + this(keystore, "password", truststore, "password"); + } + }; }