diff --git a/distribution/adapters/shared-cli/adapter-elytron-install.cli b/distribution/adapters/shared-cli/adapter-elytron-install.cli new file mode 100644 index 0000000000..16f17ce9a8 --- /dev/null +++ b/distribution/adapters/shared-cli/adapter-elytron-install.cli @@ -0,0 +1,57 @@ +if (outcome != success) of /extension=org.keycloak.keycloak-adapter-subsystem:read-resource + /extension=org.keycloak.keycloak-adapter-subsystem/:add(module=org.keycloak.keycloak-adapter-subsystem) +else + echo Keycloak OpenID Connect Extension already installed +end-if + +if (outcome != success) of /subsystem=keycloak:read-resource + /subsystem=keycloak:add +else + echo Keycloak OpenID Connect Subsystem already installed +end-if + +if (outcome != success) of /subsystem=elytron/custom-realm=KeycloakOIDCRealm:read-resource + /subsystem=elytron/custom-realm=KeycloakOIDCRealm:add(class-name=org.keycloak.adapters.elytron.KeycloakSecurityRealm, module=org.keycloak.keycloak-wildfly-elytron-oidc-adapter) +else + echo Keycloak OpenID Connect Realm already installed +end-if + +if (outcome != success) of /subsystem=elytron/security-domain=KeycloakDomain:read-resource + /subsystem=elytron/security-domain=KeycloakDomain:add(default-realm=KeycloakOIDCRealm,permission-mapper=default-permission-mapper,security-event-listener=local-audit,realms=[{realm=KeycloakOIDCRealm}]) +else + echo Keycloak Security Domain already installed. Trying to install Keycloak OpenID Connect Realm. + /subsystem=elytron/security-domain=KeycloakDomain:list-add(name=realms, value={realm=KeycloakOIDCRealm}) +end-if + +if (outcome != success) of /subsystem=elytron/constant-realm-mapper=keycloak-oidc-realm-mapper:read-resource + /subsystem=elytron/constant-realm-mapper=keycloak-oidc-realm-mapper:add(realm-name=KeycloakOIDCRealm) +else + echo Keycloak OpenID Connect Realm Mapper already installed +end-if + +if (outcome != success) of /subsystem=elytron/service-loader-http-server-mechanism-factory=keycloak-oidc-http-server-mechanism-factory:read-resource + /subsystem=elytron/service-loader-http-server-mechanism-factory=keycloak-oidc-http-server-mechanism-factory:add(module=org.keycloak.keycloak-wildfly-elytron-oidc-adapter) +else + echo Keycloak OpenID Connect HTTP Mechanism already installed +end-if + +if (outcome != success) of /subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:read-resource + /subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:add(http-server-factories=[keycloak-oidc-http-server-mechanism-factory, global]) +else + echo Keycloak HTTP Mechanism Factory already installed. Trying to install Keycloak OpenID Connect HTTP Mechanism Factory. + /subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:list-add(name=http-server-factories, value=keycloak-oidc-http-server-mechanism-factory) +end-if + + +if (outcome != success) of /subsystem=elytron/http-authentication-factory=keycloak-http-authentication:read-resource + /subsystem=elytron/http-authentication-factory=keycloak-http-authentication:add(security-domain=KeycloakDomain,http-server-mechanism-factory=keycloak-http-server-mechanism-factory,mechanism-configurations=[{mechanism-name=KEYCLOAK,mechanism-realm-configurations=[{realm-name=KeycloakOIDCRealm,realm-mapper=keycloak-oidc-realm-mapper}]}]) +else + echo Keycloak HTTP Authentication Factory already installed. Trying to install Keycloak OpenID Connect Mechanism Configuration + /subsystem=elytron/http-authentication-factory=keycloak-http-authentication:list-add(name=mechanism-configurations, value={mechanism-name=KEYCLOAK,mechanism-realm-configurations=[{realm-name=KeycloakOIDCRealm,realm-mapper=keycloak-oidc-realm-mapper}]}) +end-if + +if (outcome != success) of /subsystem=undertow/application-security-domain=other:read-resource + /subsystem=undertow/application-security-domain=other:add(http-authentication-factory=keycloak-http-authentication) +else + echo Undertow already configured with Keycloak +end-if \ No newline at end of file diff --git a/distribution/adapters/wildfly-adapter/wildfly-adapter-zip/assembly.xml b/distribution/adapters/wildfly-adapter/wildfly-adapter-zip/assembly.xml index 527750ff23..fcecc4845d 100755 --- a/distribution/adapters/wildfly-adapter/wildfly-adapter-zip/assembly.xml +++ b/distribution/adapters/wildfly-adapter/wildfly-adapter-zip/assembly.xml @@ -58,5 +58,13 @@ cli/adapter-install-offline.cli bin + + ../../shared-cli/adapter-elytron-install.cli + bin + + + cli/adapter-elytron-install-offline.cli + bin + - + \ No newline at end of file diff --git a/distribution/adapters/wildfly-adapter/wildfly-adapter-zip/cli/adapter-elytron-install-offline.cli b/distribution/adapters/wildfly-adapter/wildfly-adapter-zip/cli/adapter-elytron-install-offline.cli new file mode 100644 index 0000000000..8e0335ac02 --- /dev/null +++ b/distribution/adapters/wildfly-adapter/wildfly-adapter-zip/cli/adapter-elytron-install-offline.cli @@ -0,0 +1,59 @@ +embed-server --server-config=standalone.xml + +if (outcome != success) of /extension=org.keycloak.keycloak-adapter-subsystem:read-resource + /extension=org.keycloak.keycloak-adapter-subsystem/:add(module=org.keycloak.keycloak-adapter-subsystem) +else + echo Keycloak OpenID Connect Extension already installed +end-if + +if (outcome != success) of /subsystem=keycloak:read-resource + /subsystem=keycloak:add +else + echo Keycloak OpenID Connect Subsystem already installed +end-if + +if (outcome != success) of /subsystem=elytron/custom-realm=KeycloakOIDCRealm:read-resource + /subsystem=elytron/custom-realm=KeycloakOIDCRealm:add(class-name=org.keycloak.adapters.elytron.KeycloakSecurityRealm, module=org.keycloak.keycloak-wildfly-elytron-oidc-adapter) +else + echo Keycloak OpenID Connect Realm already installed +end-if + +if (outcome != success) of /subsystem=elytron/security-domain=KeycloakDomain:read-resource + /subsystem=elytron/security-domain=KeycloakDomain:add(default-realm=KeycloakOIDCRealm,permission-mapper=default-permission-mapper,security-event-listener=local-audit,realms=[{realm=KeycloakOIDCRealm}]) +else + echo Keycloak Security Domain already installed. Trying to install Keycloak OpenID Connect Realm. + /subsystem=elytron/security-domain=KeycloakDomain:list-add(name=realms, value={realm=KeycloakOIDCRealm}) +end-if + +if (outcome != success) of /subsystem=elytron/constant-realm-mapper=keycloak-oidc-realm-mapper:read-resource + /subsystem=elytron/constant-realm-mapper=keycloak-oidc-realm-mapper:add(realm-name=KeycloakOIDCRealm) +else + echo Keycloak OpenID Connect Realm Mapper already installed +end-if + +if (outcome != success) of /subsystem=elytron/service-loader-http-server-mechanism-factory=keycloak-oidc-http-server-mechanism-factory:read-resource + /subsystem=elytron/service-loader-http-server-mechanism-factory=keycloak-oidc-http-server-mechanism-factory:add(module=org.keycloak.keycloak-wildfly-elytron-oidc-adapter) +else + echo Keycloak OpenID Connect HTTP Mechanism already installed +end-if + +if (outcome != success) of /subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:read-resource + /subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:add(http-server-factories=[keycloak-oidc-http-server-mechanism-factory, global]) +else + echo Keycloak HTTP Mechanism Factory already installed. Trying to install Keycloak OpenID Connect HTTP Mechanism Factory. + /subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:list-add(name=http-server-factories, value=keycloak-oidc-http-server-mechanism-factory) +end-if + + +if (outcome != success) of /subsystem=elytron/http-authentication-factory=keycloak-http-authentication:read-resource + /subsystem=elytron/http-authentication-factory=keycloak-http-authentication:add(security-domain=KeycloakDomain,http-server-mechanism-factory=keycloak-http-server-mechanism-factory,mechanism-configurations=[{mechanism-name=KEYCLOAK,mechanism-realm-configurations=[{realm-name=KeycloakOIDCRealm,realm-mapper=keycloak-oidc-realm-mapper}]}]) +else + echo Keycloak HTTP Authentication Factory already installed. Trying to install Keycloak OpenID Connect Mechanism Configuration + /subsystem=elytron/http-authentication-factory=keycloak-http-authentication:list-add(name=mechanism-configurations, value={mechanism-name=KEYCLOAK,mechanism-realm-configurations=[{realm-name=KeycloakOIDCRealm,realm-mapper=keycloak-oidc-realm-mapper}]}) +end-if + +if (outcome != success) of /subsystem=undertow/application-security-domain=other:read-resource + /subsystem=undertow/application-security-domain=other:add(http-authentication-factory=keycloak-http-authentication) +else + echo Undertow already configured with Keycloak +end-if \ No newline at end of file diff --git a/distribution/saml-adapters/shared-cli/adapter-elytron-install-saml.cli b/distribution/saml-adapters/shared-cli/adapter-elytron-install-saml.cli new file mode 100755 index 0000000000..1f24085459 --- /dev/null +++ b/distribution/saml-adapters/shared-cli/adapter-elytron-install-saml.cli @@ -0,0 +1,56 @@ +if (outcome != success) of /extension=org.keycloak.keycloak-saml-adapter-subsystem:read-resource + /extension=org.keycloak.keycloak-saml-adapter-subsystem/:add(module=org.keycloak.keycloak-saml-adapter-subsystem) +else + echo Keycloak SAML Extension already installed +end-if + +if (outcome != success) of /subsystem=keycloak-saml:read-resource + /subsystem=keycloak-saml:add +else + echo Keycloak SAML Subsystem already installed +end-if + +if (outcome != success) of /subsystem=elytron/custom-realm=KeycloakSAMLRealm:read-resource + /subsystem=elytron/custom-realm=KeycloakSAMLRealm:add(class-name=org.keycloak.adapters.saml.elytron.KeycloakSecurityRealm, module=org.keycloak.keycloak-saml-wildfly-elytron-adapter) +else + echo Keycloak SAML Realm already installed +end-if + +if (outcome != success) of /subsystem=elytron/security-domain=KeycloakDomain:read-resource + /subsystem=elytron/security-domain=KeycloakDomain:add(default-realm=KeycloakSAMLRealm,permission-mapper=default-permission-mapper,security-event-listener=local-audit,realms=[{realm=KeycloakSAMLRealm}]) +else + echo Keycloak Security Domain already installed. Trying to install Keycloak SAML Realm. + /subsystem=elytron/security-domain=KeycloakDomain:list-add(name=realms, value={realm=KeycloakSAMLRealm}) +end-if + +if (outcome != success) of /subsystem=elytron/constant-realm-mapper=keycloak-saml-realm-mapper:read-resource + /subsystem=elytron/constant-realm-mapper=keycloak-saml-realm-mapper:add(realm-name=KeycloakSAMLRealm) +else + echo Keycloak SAML Realm Mapper already installed +end-if + +if (outcome != success) of /subsystem=elytron/service-loader-http-server-mechanism-factory=keycloak-saml-http-server-mechanism-factory:read-resource + /subsystem=elytron/service-loader-http-server-mechanism-factory=keycloak-saml-http-server-mechanism-factory:add(module=org.keycloak.keycloak-saml-wildfly-elytron-adapter) +else + echo Keycloak SAML HTTP Mechanism Factory already installed +end-if + +if (outcome != success) of /subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:read-resource + /subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:add(http-server-factories=[keycloak-saml-http-server-mechanism-factory, global]) +else + echo Keycloak HTTP Mechanism Factory already installed. Trying to install Keycloak SAML HTTP Mechanism Factory. + /subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:list-add(name=http-server-factories, value=keycloak-saml-http-server-mechanism-factory) +end-if + +if (outcome != success) of /subsystem=elytron/http-authentication-factory=keycloak-http-authentication:read-resource + /subsystem=elytron/http-authentication-factory=keycloak-http-authentication:add(security-domain=KeycloakDomain,http-server-mechanism-factory=keycloak-http-server-mechanism-factory,mechanism-configurations=[{mechanism-name=KEYCLOAK-SAML,mechanism-realm-configurations=[{realm-name=KeycloakSAMLCRealm,realm-mapper=keycloak-saml-realm-mapper}]}]) +else + echo Keycloak HTTP Authentication Factory already installed. Trying to install Keycloak SAML Mechanism Configuration + /subsystem=elytron/http-authentication-factory=keycloak-http-authentication:list-add(name=mechanism-configurations, value={mechanism-name=KEYCLOAK-SAML,mechanism-realm-configurations=[{realm-name=KeycloakSAMLRealm,realm-mapper=keycloak-saml-realm-mapper}]}) +end-if + +if (outcome != success) of /subsystem=undertow/application-security-domain=other:read-resource + /subsystem=undertow/application-security-domain=other:add(http-authentication-factory=keycloak-http-authentication) +else + echo Undertow already configured with Keycloak +end-if \ No newline at end of file diff --git a/distribution/saml-adapters/wildfly-adapter/wildfly-adapter-zip/assembly.xml b/distribution/saml-adapters/wildfly-adapter/wildfly-adapter-zip/assembly.xml index ff57870dc9..398930dcf9 100755 --- a/distribution/saml-adapters/wildfly-adapter/wildfly-adapter-zip/assembly.xml +++ b/distribution/saml-adapters/wildfly-adapter/wildfly-adapter-zip/assembly.xml @@ -52,5 +52,9 @@ ../../shared-cli/adapter-install-saml.cli bin + + ../../shared-cli/adapter-elytron-install-saml.cli + bin + diff --git a/testsuite/integration-arquillian/servers/app-server/jboss/common/configure-elytron.xsl b/testsuite/integration-arquillian/servers/app-server/jboss/common/configure-elytron.xsl deleted file mode 100644 index 96edcfecf6..0000000000 --- a/testsuite/integration-arquillian/servers/app-server/jboss/common/configure-elytron.xsl +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/testsuite/integration-arquillian/servers/app-server/jboss/common/install-adapters.sh b/testsuite/integration-arquillian/servers/app-server/jboss/common/install-adapters.sh index 460599234b..bd9e65b25e 100755 --- a/testsuite/integration-arquillian/servers/app-server/jboss/common/install-adapters.sh +++ b/testsuite/integration-arquillian/servers/app-server/jboss/common/install-adapters.sh @@ -23,10 +23,20 @@ do echo "Server is running. Installing adapter." ./jboss-cli.sh -c --file="adapter-install.cli" + + if [ "$ELYTRON_SUPPORTED" = true ]; then + ./jboss-cli.sh -c --file="adapter-elytron-install.cli" + fi + if [ $? -ne 0 ]; then RESULT=1; fi if [ "$SAML_SUPPORTED" = true ]; then ./jboss-cli.sh -c --file="adapter-install-saml.cli" + + if [ "$ELYTRON_SUPPORTED" = true ]; then + ./jboss-cli.sh -c --file="adapter-elytron-install-saml.cli" + fi + if [ $? -ne 0 ]; then RESULT=1; fi fi diff --git a/testsuite/integration-arquillian/servers/app-server/jboss/pom.xml b/testsuite/integration-arquillian/servers/app-server/jboss/pom.xml index 90a3952f13..5299493e09 100644 --- a/testsuite/integration-arquillian/servers/app-server/jboss/pom.xml +++ b/testsuite/integration-arquillian/servers/app-server/jboss/pom.xml @@ -200,6 +200,7 @@ ${app.server.java.home} ${app.server.jboss.home} ${app.server.saml.adapter.supported} + ${app.server.elytron.adapter.supported} @@ -452,36 +453,8 @@ ${elytron.wildfly.version} + true - - - - org.codehaus.mojo - xml-maven-plugin - - - configure-adapter-debug-log - process-test-resources - - transform - - - - - ${app.server.jboss.home}/standalone/configuration - - standalone.xml - - ${common.resources}/configure-elytron.xsl - ${app.server.jboss.home}/standalone/configuration - - - - - - - -