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 11df9af88cd73..0000000000000 Binary files a/integration-tests/oidc/src/main/resources/client-keystore.p12 and /dev/null differ 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 8a9cefe2f5506..0000000000000 Binary files a/integration-tests/oidc/src/main/resources/client-truststore.p12 and /dev/null differ diff --git a/integration-tests/oidc/src/main/resources/server-keystore.p12 b/integration-tests/oidc/src/main/resources/server-keystore.p12 deleted file mode 100644 index 6e476f513ef30..0000000000000 Binary files a/integration-tests/oidc/src/main/resources/server-keystore.p12 and /dev/null differ 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 d006d5d2dd43e..0000000000000 Binary files a/integration-tests/oidc/src/main/resources/server-truststore.p12 and /dev/null differ diff --git a/integration-tests/oidc/src/main/resources/upconfig.json b/integration-tests/oidc/src/main/resources/upconfig.json deleted file mode 100644 index 8487089bc90fd..0000000000000 --- a/integration-tests/oidc/src/main/resources/upconfig.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "attributes": [ - { - "name": "username", - "displayName": "${username}", - "permissions": { - "view": ["admin", "user"], - "edit": ["admin", "user"] - }, - "validations": { - "length": { "min": 3, "max": 255 }, - "username-prohibited-characters": {}, - "up-username-not-idn-homograph": {} - } - }, - { - "name": "email", - "displayName": "${email}", - "permissions": { - "view": ["admin", "user"], - "edit": ["admin", "user"] - }, - "validations": { - "email" : {}, - "length": { "max": 255 } - } - }, - { - "name": "firstName", - "displayName": "${firstName}", - "permissions": { - "view": ["admin", "user"], - "edit": ["admin", "user"] - }, - "validations": { - "length": { "max": 255 }, - "person-name-prohibited-characters": {} - } - }, - { - "name": "lastName", - "displayName": "${lastName}", - "permissions": { - "view": ["admin", "user"], - "edit": ["admin", "user"] - }, - "validations": { - "length": { "max": 255 }, - "person-name-prohibited-characters": {} - } - } - ], - "groups": [ - { - "name": "user-metadata", - "displayHeader": "User metadata", - "displayDescription": "Attributes, which refer to user metadata" - } - ] -} \ No newline at end of file diff --git a/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/AbstractBearerTokenAuthorizationTest.java b/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/AbstractBearerTokenAuthorizationTest.java index a1ec95be5d378..608e8af04fceb 100644 --- a/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/AbstractBearerTokenAuthorizationTest.java +++ b/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/AbstractBearerTokenAuthorizationTest.java @@ -16,7 +16,9 @@ public abstract class AbstractBearerTokenAuthorizationTest { - 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 testSecureAccessSuccessWithCors() { diff --git a/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/KeycloakXTestResourceLifecycleManager.java b/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/KeycloakXTestResourceLifecycleManager.java index 57e855d482d07..dc9863d595683 100644 --- a/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/KeycloakXTestResourceLifecycleManager.java +++ b/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/KeycloakXTestResourceLifecycleManager.java @@ -22,7 +22,9 @@ public class KeycloakXTestResourceLifecycleManager private static final String KEYCLOAK_REALM = "quarkus"; private static final String KEYCLOAK_SERVICE_CLIENT = "quarkus-app"; - final KeycloakTestClient client = new KeycloakTestClient(new Tls()); + final KeycloakTestClient client = new KeycloakTestClient( + new Tls("target/certificates/oidc-client-keystore.p12", + "target/certificates/oidc-client-truststore.p12")); @Override public Map 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"); + } + }; }