<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.inteligr8.alfresco</groupId>
	<artifactId>auth-platform-module</artifactId>
	<version>1.0.6</version>
	<packaging>jar</packaging>

	<name>Authentication &amp; Authorization for ACS</name>
	<description>An Alfresco Content Service module providing improved authentication and authorization support.</description>
	<url>https://git.inteligr8.com/inteligr8/auth-platform-module</url>

	<licenses>
		<license>
			<name>GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007</name>
			<url>https://www.gnu.org/licenses/lgpl-3.0.txt</url>
		</license>
	</licenses>

	<scm>
		<connection>scm:git:https://git.inteligr8.com/inteligr8/auth-platform-module.git</connection>
		<developerConnection>scm:git:git@git.inteligr8.com:inteligr8/auth-platform-module.git</developerConnection>
		<url>https://git.inteligr8.com/inteligr8/auth-platform-module</url>
	</scm>
	<organization>
		<name>Inteligr8</name>
		<url>https://www.inteligr8.com</url>
	</organization>
	<developers>
		<developer>
			<id>brian.long</id>
			<name>Brian Long</name>
			<email>brian@inteligr8.com</email>
			<url>https://twitter.com/brianmlong</url>
		</developer>
	</developers>

	<properties>
		<maven.compiler.source>17</maven.compiler.source>
		<maven.compiler.target>17</maven.compiler.target>
		<maven.compiler.release>17</maven.compiler.release>

		<alfresco.platform.version>25.1.0</alfresco.platform.version>
		<alfresco.sdk.version>4.12.0</alfresco.sdk.version>
		
		<!-- for RAD -->
		<support-tools.version>1.2.3.0</support-tools.version>
		<keycloak.realm>my-app</keycloak.realm>
		<keycloak.server.port>8081</keycloak.server.port>
		<oauth.platform.client.id>acs-public</oauth.platform.client.id>
		<oauth.platform.client.secret></oauth.platform.client.secret>
		<oauth.platform.client.public>true</oauth.platform.client.public>
		<oauth.adminConsole.client.id>acs-admin-console</oauth.adminConsole.client.id>
		<oauth.adminConsole.client.secret>a-secret</oauth.adminConsole.client.secret>
		<oauth.adminConsole.client.public>false</oauth.adminConsole.client.public>
		<oauth.share.client.id>acs-public</oauth.share.client.id>
		<oauth.share.client.secret></oauth.share.client.secret>
		<oauth.share.client.public>true</oauth.share.client.public>
		
		<!-- For ACS Platform & Share RAD testing -->
		<tomcat-rad.version>10-2.2</tomcat-rad.version>
		
		<!-- For ACS Platform and this module RAD testing -->
		<!-- see POM: https://artifacts.alfresco.com/nexus/repository/public/org/alfresco/acs-community-packaging -->
		<!-- for alfresco-community-repo version -->
		<alfresco.platform.war.version>${alfresco.platform.version}.9</alfresco.platform.war.version>
		<acs-platform.hotswap.enabled>false</acs-platform.hotswap.enabled>
		<acs-platform.timeout>150000</acs-platform.timeout>
		<acs-platform.tomcat.opts.base>-Dauthentication.chain=keycloak:identity-service \
			-Didentity-service.authentication.enable-username-password-authentication=true \
			-Didentity-service.resource=${oauth.platform.client.id} \
			-Didentity-service.credentials.secret=${oauth.platform.client.secret} \
			-Didentity-service.admin-console.scopes=openid,profile,email,offline_access,microprofile-jwt \
			-Didentity-service.webscripts-home.scopes=openid,profile,email,microprofile-jwt \
			-Didentity-service.password-grant.scopes=openid,profile,email,microprofile-jwt \
			-Didentity-service.allow-any-hostname=true \
			-Didentity-service.disable-trust-manager=true \
			-Didentity-service.public-client=${oauth.platform.client.public} \
			-Dinteligr8.auth.admin-console.resource=${oauth.adminConsole.client.id} \
			-Dinteligr8.auth.admin-console.resource-secret=${oauth.adminConsole.client.secret} \
			-Dinteligr8.auth.admin-console.public=${oauth.adminConsole.client.public}</acs-platform.tomcat.opts.base>
			
		<!-- For ACS Share RAD testing -->
		<!-- see POM: https://artifacts.alfresco.com/nexus/repository/public/org/alfresco/acs-community-packaging -->
		<!-- for alfresco-community-share version -->
		<alfresco.share.war.version>${alfresco.platform.version}.56</alfresco.share.war.version>
		<acs-share.timeout>60000</acs-share.timeout>
		<acs-share.debugger.enabled>false</acs-share.debugger.enabled>
		<acs-share.hotswap.enabled>false</acs-share.hotswap.enabled>
		<acs-share.tomcat.opts.base>-Daims.enabled=true \
			-Daims.resource=${oauth.share.client.id} \
			-Daims.secret=${oauth.share.client.secret} \
			-Daims.publicClient=${oauth.share.client.public}</acs-share.tomcat.opts.base>
	</properties>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.alfresco</groupId>
				<artifactId>acs-community-packaging</artifactId>
				<version>${alfresco.platform.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<dependencies>
		<!-- Needed for Activiti App Identity Service inheritance/override -->
		<!-- includes activiti-app-logic for API -->
		<dependency>
			<groupId>org.alfresco</groupId>
			<artifactId>alfresco-repository</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.orderofthebee.support-tools</groupId>
			<artifactId>support-tools-repo</artifactId>
			<version>${support-tools.version}</version>
			<type>amp</type>
			<classifier>amp</classifier>
			<scope>test</scope>
		</dependency>		
	</dependencies>
	
	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>io.repaint.maven</groupId>
					<artifactId>tiles-maven-plugin</artifactId>
					<version>2.41</version>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<plugin>
				<groupId>io.repaint.maven</groupId>
				<artifactId>tiles-maven-plugin</artifactId>
				<extensions>true</extensions>
				<configuration>
					<tiles>
						<!-- Documentation: https://bitbucket.org/inteligr8/ootbee-beedk/src/stable/beedk-acs-platform-self-rad-tile -->
						<tile>com.inteligr8.ootbee:beedk-acs-platform-self-rad-tile:[1.1.0,2.0.0)</tile>
						<!-- Documentation: https://bitbucket.org/inteligr8/ootbee-beedk/src/stable/beedk-acs-platform-self-rad-tile -->
						<tile>com.inteligr8.ootbee:beedk-acs-share-artifact-rad-tile:[1.1.0,2.0.0)</tile>
						<!-- Documentation: https://bitbucket.org/inteligr8/ootbee-beedk/src/stable/beedk-acs-platform-module-tile -->
						<tile>com.inteligr8.ootbee:beedk-acs-platform-module-tile:[1.1.0,2.0.0)</tile>
					</tiles>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>acs-oauth-confidential</id>
			<activation>
				<property>
					<name>secret</name>
				</property>
			</activation>
			<properties>
				<oauth.client.id>acs-confidential</oauth.client.id>
				<oauth.client.secret>a-secret</oauth.client.secret>
				<oauth.client.public>false</oauth.client.public>
			</properties>
		</profile>
		<profile>
			<id>acs-keycloak</id>
			<activation>
				<property>
					<name>rad</name>
					<value>keycloak</value>
				</property>
			</activation>
			<properties>
				<acs-platform.tomcat.opts>${acs-platform.tomcat.opts.base} \
					-Didentity-service.realm=${keycloak.realm} \
					-Didentity-service.auth-server-url=http://host.docker.internal:${keycloak.server.port}</acs-platform.tomcat.opts>
				<acs-share.tomcat.opts>${acs-share.tomcat.opts.base} \
					-Daims.realm=${keycloak.realm} \
					-Daims.authServerUrl=http://host.docker.internal:${keycloak.server.port}</acs-share.tomcat.opts>
			</properties>
		</profile>
		<profile>
			<id>acs-oauth</id>
			<activation>
				<property>
					<name>rad</name>
					<value>!keycloak</value>
				</property>
			</activation>
			<properties>
				<acs-platform.tomcat.opts>${acs-platform.tomcat.opts.base} \
					-Didentity-service.realm= \
					-Didentity-service.auth-server-url=http://host.docker.internal:${keycloak.server.port}/realms/${keycloak.realm}</acs-platform.tomcat.opts>
				<acs-share.tomcat.opts>${acs-share.tomcat.opts.base} \
					-Daims.realm= \
					-Daims.authServerUrl=http://host.docker.internal:${keycloak.server.port}/realms/${keycloak.realm}</acs-share.tomcat.opts>
			</properties>
		</profile>
		<profile>
			<id>rad-keycloak</id>
			<activation>
				<property>
					<name>rad</name>
				</property>
			</activation>
			<properties>
				<!-- Due to SSL restrictions in previous versions, testing against keycloak is near impossible. -->
				<!-- This module should still work against nearly all versions of Keycloak that support the OIDC standards -->
				<keycloak.server.version>26.2</keycloak.server.version>
			</properties>
			<build>
				<plugins>
					<plugin>
						<groupId>io.fabric8</groupId>
						<artifactId>docker-maven-plugin</artifactId>
						<version>0.46.0</version>
						<executions>
							<execution>
								<id>run-keycloak</id>
								<phase>test-compile</phase>
								<goals><goal>start</goal></goals>
								<configuration>
									<images>
										<image>
											<name>keycloak/keycloak:${keycloak.server.version}</name>
											<alias>keycloak</alias>
											<run>
												<cmd>start-dev --import-realm</cmd>
												<env>
													<KC_BOOTSTRAP_ADMIN_USERNAME>admin</KC_BOOTSTRAP_ADMIN_USERNAME>
													<KC_BOOTSTRAP_ADMIN_PASSWORD>admin</KC_BOOTSTRAP_ADMIN_PASSWORD>
												</env>
												<ports>
													<port>${keycloak.server.port}:8080</port>
												</ports>
												<network>
													<mode>custom</mode>
													<name>${project.artifactId}</name>
												</network>
												<extraHosts>
													<host>host.docker.internal:host-gateway</host>
												</extraHosts>
												<volumes>
													<bind>
														<volume>${project.basedir}/src/test/resources/keycloak-import:/opt/keycloak/data/import:ro</volume>
													</bind>
												</volumes>
											</run>
										</image>
									</images>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>central-publish</id>
			<properties>
				<maven.deploy.skip>true</maven.deploy.skip>
			</properties>
			<build>
				<plugins>
					<plugin>
						<artifactId>maven-source-plugin</artifactId>
						<executions>
							<execution>
								<id>source</id>
								<phase>package</phase>
								<goals><goal>jar-no-fork</goal></goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<artifactId>maven-javadoc-plugin</artifactId>
						<executions>
							<execution>
								<id>javadoc</id>
								<phase>package</phase>
								<goals><goal>jar</goal></goals>
								<configuration>
									<show>public</show>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<artifactId>maven-gpg-plugin</artifactId>
						<executions>
							<execution>
								<id>sign</id>
								<phase>verify</phase>
								<goals><goal>sign</goal></goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.sonatype.central</groupId>
						<artifactId>central-publishing-maven-plugin</artifactId>
						<version>0.8.0</version>
						<extensions>true</extensions>
						<configuration>
							<publishingServerId>central</publishingServerId>
							<autoPublish>true</autoPublish>
						</configuration>
						<!-- for some reason this is required... -->
						<executions>
							<execution>
								<id>deploy</id>
								<phase>deploy</phase>
								<goals><goal>publish</goal></goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

	<repositories>
		<repository>
			<id>alfresco-public</id>
			<url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
		</repository>
	</repositories>
	
</project>
