<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright The WildFly Authors
  ~ SPDX-License-Identifier: Apache-2.0
  -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.wildfly.core</groupId>
        <artifactId>wildfly-core-parent</artifactId>
        <version>25.0.0.Beta2</version>
    </parent>

    <artifactId>wildfly-elytron-integration</artifactId>

    <name>WildFly: Elytron Subsystem</name>

    <properties>
        <!-- TlsTestCase specifies use of sun.security.ssl.SunJSSE in the server config,
             so make it available. -->
        <modular.jdk11.args/>
        <modular.jdk.args>${standard.client.modular.jdk.args} ${modular.jdk11.args}
            --add-opens=java.base/sun.security.ssl=ALL-UNNAMED
        </modular.jdk.args>
        <version.com.nimbus.jose-jwt>9.37.3</version.com.nimbus.jose-jwt>
        <version.com.squareup.okhttp3.mockwebserver>3.8.1</version.com.squareup.okhttp3.mockwebserver>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.wildfly.core</groupId>
                <artifactId>wildfly-core-testbom</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>

        <dependency>
            <groupId>jakarta.authentication</groupId>
            <artifactId>jakarta.authentication-api</artifactId>
        </dependency>

        <dependency>
            <groupId>jakarta.authorization</groupId>
            <artifactId>jakarta.authorization-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wildfly.core</groupId>
            <artifactId>wildfly-controller</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wildfly.core</groupId>
            <artifactId>wildfly-server</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wildfly.security</groupId>
            <artifactId>wildfly-elytron-auth</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wildfly.security</groupId>
            <artifactId>wildfly-elytron-dynamic-ssl</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wildfly.security</groupId>
            <artifactId>wildfly-elytron-realm-jdbc</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wildfly.security</groupId>
            <artifactId>wildfly-elytron-realm-ldap</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wildfly.security</groupId>
            <artifactId>wildfly-elytron-realm-token</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wildfly.security</groupId>
            <artifactId>wildfly-elytron-x500-principal</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wildfly.security.jakarta</groupId>
            <artifactId>jakarta-authentication</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wildfly.security.jakarta</groupId>
            <artifactId>jakarta-authorization</artifactId>
        </dependency>

        <!--Test dependencies -->

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>failureaccess</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.nimbusds</groupId>
            <artifactId>nimbus-jose-jwt</artifactId>
            <version>${version.com.nimbus.jose-jwt}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>mockwebserver</artifactId>
            <version>${version.com.squareup.okhttp3.mockwebserver}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.bouncycastle</groupId>
                    <artifactId>bcprov-jdk15on</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- JSONP javax API and IMPL -->
        <dependency>
            <groupId>jakarta.json</groupId>
            <artifactId>jakarta.json-api</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.directory.api</groupId>
            <artifactId>api-ldap-codec-core</artifactId>
            <version>${version.org.apache.directory.api}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.directory.api</groupId>
            <artifactId>api-ldap-codec-standalone</artifactId>
            <version>${version.org.apache.directory.api}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.directory.api</groupId>
            <artifactId>api-ldap-net-mina</artifactId>
            <version>${version.org.apache.directory.api}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.directory.server</groupId>
            <artifactId>apacheds-core-annotations</artifactId>
            <version>${version.org.apache.ds}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-lang3</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-collections</groupId>
                    <artifactId>commons-collections</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.bouncycastle</groupId>
                    <artifactId>bcprov-jdk15on</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.bouncycastle</groupId>
                    <artifactId>bcpkix-jdk15on</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.directory.server</groupId>
            <artifactId>apacheds-core-api</artifactId>
            <version>${version.org.apache.ds}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-lang3</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.directory.server</groupId>
            <artifactId>apacheds-protocol-ldap</artifactId>
            <version>${version.org.apache.ds}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-lang3</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-collections</groupId>
                    <artifactId>commons-collections</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.bouncycastle</groupId>
                    <artifactId>bcprov-jdk15on</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpkix-jdk18on</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk18on</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcutil-jdk18on</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.eclipse.parsson</groupId>
            <artifactId>parsson</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- javax dependencies required to bootstrap the legacy controllers for transformer tests -->
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>jakarta.json</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging-annotations</artifactId>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging-processor</artifactId>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.jboss.msc</groupId>
            <artifactId>jboss-msc</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.spec.javax.security.auth.message</groupId>
            <artifactId>jboss-jaspi-api_1.1_spec</artifactId>
            <version>${legacy.version.org.jboss.spec.javax.security.auth.message.jboss-jaspi-api_1.1_spec}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.spec.javax.security.jacc</groupId>
            <artifactId>jboss-jacc-api_1.5_spec</artifactId>
            <version>${legacy.version.org.jboss.spec.javax.security.jacc.jboss-jacc-api_1.5_spec}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.jboss.spec.javax.servlet</groupId>
                    <artifactId>jboss-servlet-api_4.0_spec</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.mock-server</groupId>
            <artifactId>mockserver-netty</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.wildfly.core</groupId>
            <artifactId>wildfly-subsystem-test</artifactId>
            <type>pom</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.wildfly.security</groupId>
            <artifactId>wildfly-elytron-sasl-scram</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.wildfly.security</groupId>
            <artifactId>wildfly-elytron-sasl-plain</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.wildfly.security</groupId>
            <artifactId>wildfly-elytron-tests-common</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.wildfly.openssl</groupId>
            <artifactId>wildfly-openssl-java</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.wildfly.openssl</groupId>
            <artifactId>wildfly-openssl-linux-x86_64</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.wildfly.openssl</groupId>
            <artifactId>wildfly-openssl-linux-s390x</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.wildfly.openssl</groupId>
            <artifactId>wildfly-openssl-macosx-x86_64</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.wildfly.openssl</groupId>
            <artifactId>wildfly-openssl-windows-x86_64</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jmockit</groupId>
            <artifactId>jmockit</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>xml-maven-plugin</artifactId>
                <configuration>
                    <validationSets>
                        <validationSet>
                            <dir>src/test/resources/org/wildfly/extension/elytron</dir>
                            <includes>
                                <include>*.xml</include>
                            </includes>
                            <excludes>
                                <exclude>*-1.*.xml</exclude>
                                <exclude>*-4.*.xml</exclude>
                                <exclude>*-8.*.xml</exclude>
                                <exclude>elytron-expressions.xml</exclude>
                                <exclude>custom-policies.xml</exclude>
                                <exclude>jacc-with-providers.xml</exclude>
                                <exclude>legacy*.xml</exclude>
                                <exclude>elytron-subsystem-community*.xml</exclude>
                            </excludes>
                            <systemId>src/main/resources/schema/wildfly-elytron_18_0.xsd</systemId>
                        </validationSet>
                        <validationSet>
                            <dir>src/main/resources/schema</dir>
                        </validationSet>
                    </validationSets>
                </configuration>
                <executions>
                    <execution>
                        <id>xml-validation</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>validate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <reuseForks>false</reuseForks>
                    <argLine>-javaagent:${settings.localRepository}/org/jmockit/jmockit/${version.org.jmockit}/jmockit-${version.org.jmockit}.jar ${surefire.jacoco.args} ${modular.jdk.args} -Dorg.wildfly.extension.elytron.restore-default-ssl-context=true -Dauthconfigprovider.factory=org.wildfly.security.auth.jaspi.ElytronAuthConfigFactory</argLine>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <!-- Profiles -->
    <profiles>
        <!--
          Name: JDK11
          Descr: JDK11 specific settings
        -->
        <profile>
            <id>jdk11</id>
            <activation>
                <jdk>11</jdk>
            </activation>
            <properties>
                <modular.jdk11.args>
                    --add-opens=java.base/com.sun.net.ssl.internal.ssl=ALL-UNNAMED
                </modular.jdk11.args>
            </properties>
        </profile>
    </profiles>

</project>
