mirror of
https://github.com/bmlong137/alfresco-keycloak.git
synced 2025-09-10 14:11:09 +00:00
Basic working state of repo-tier subsystem
- supports synch of users / groups - supports configurable / extensible attribute mapping - supports configurable / extensible filtering - supports claim / role mapping - supports Keycloak auth redirect, Bearer and Basic authentication - bundles newer Keycloak libraries than Alfresco default via shaded dependency artifacts
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!--
|
||||
Copyright 2019 Acosix GmbH
|
||||
Copyright 2019 - 2020 Acosix GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -127,11 +127,92 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
|
||||
<!-- some image customisations -->
|
||||
<!-- Maven + docker-maven-plugin result in somewhat weird inheritance handling -->
|
||||
<!-- (relying on positional order of images for overrides) -->
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<images>
|
||||
<image>
|
||||
<!-- no change to postgres image (first image in parent POM) -->
|
||||
</image>
|
||||
<image>
|
||||
<!-- customise repository image (second image in parent POM) -->
|
||||
<run>
|
||||
<env>
|
||||
<DOCKER_HOST_NAME>${docker.tests.host.name}</DOCKER_HOST_NAME>
|
||||
</env>
|
||||
<!-- add log directory mount to just the contentstore -->
|
||||
<!-- (cannot be done in parent POM due to hard requirement on specific project structure -->
|
||||
<!-- for tests to easily check contentstore files, we also mount alf_data locally, not in a volume -->
|
||||
<volumes>
|
||||
<bind>
|
||||
<volume>${moduleId}-repository-test-contentstore:/usr/local/tomcat/alf_data</volume>
|
||||
<volume>${project.build.directory}/docker/repository-logs:/usr/local/tomcat/logs</volume>
|
||||
</bind>
|
||||
</volumes>
|
||||
<dependsOn>
|
||||
<container>postgres</container>
|
||||
<container>keycloak</container>
|
||||
</dependsOn>
|
||||
</run>
|
||||
</image>
|
||||
<image>
|
||||
<!-- no change to Share image -->
|
||||
</image>
|
||||
<image>
|
||||
<!-- no change to Search image -->
|
||||
</image>
|
||||
<image>
|
||||
<name>jboss/keycloak</name>
|
||||
<alias>keycloak</alias>
|
||||
<run>
|
||||
<hostname>keycloak</hostname>
|
||||
<env>
|
||||
<KEYCLOAK_USER>admin</KEYCLOAK_USER>
|
||||
<KEYCLOAK_PASSWORD>admin</KEYCLOAK_PASSWORD>
|
||||
<KEYCLOAK_IMPORT>/tmp/test-realm.json</KEYCLOAK_IMPORT>
|
||||
<DB_VENDOR>h2</DB_VENDOR>
|
||||
</env>
|
||||
<ports>
|
||||
<port>${docker.tests.keycloakPort}:8080</port>
|
||||
</ports>
|
||||
<network>
|
||||
<mode>custom</mode>
|
||||
<name>${moduleId}-test</name>
|
||||
<alias>keycloak</alias>
|
||||
</network>
|
||||
<volumes>
|
||||
<bind>
|
||||
<volume>${project.build.directory}/docker/test-realm.json:/tmp/test-realm.json</volume>
|
||||
</bind>
|
||||
</volumes>
|
||||
</run>
|
||||
</image>
|
||||
</images>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>net.alchim31.maven</groupId>
|
||||
<artifactId>yuicompressor-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!--
|
||||
Copyright 2019 Acosix GmbH
|
||||
Copyright 2019 - 2020 Acosix GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!--
|
||||
Copyright 2019 Acosix GmbH
|
||||
Copyright 2019 - 2020 Acosix GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!--
|
||||
Copyright 2019 Acosix GmbH
|
||||
Copyright 2019 - 2020 Acosix GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!--
|
||||
Copyright 2019 Acosix GmbH
|
||||
Copyright 2019 - 2020 Acosix GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!--
|
||||
Copyright 2019 Acosix GmbH
|
||||
Copyright 2019 - 2020 Acosix GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 Acosix GmbH
|
||||
* Copyright 2019 - 2020 Acosix GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 Acosix GmbH
|
||||
* Copyright 2019 - 2020 Acosix GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 Acosix GmbH
|
||||
* Copyright 2019 - 2020 Acosix GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 Acosix GmbH
|
||||
* Copyright 2019 - 2020 Acosix GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 Acosix GmbH
|
||||
* Copyright 2019 - 2020 Acosix GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 Acosix GmbH
|
||||
* Copyright 2019 - 2020 Acosix GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 Acosix GmbH
|
||||
* Copyright 2019 - 2020 Acosix GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 Acosix GmbH
|
||||
* Copyright 2019 - 2020 Acosix GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 Acosix GmbH
|
||||
* Copyright 2019 - 2020 Acosix GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 Acosix GmbH
|
||||
* Copyright 2019 - 2020 Acosix GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 Acosix GmbH
|
||||
* Copyright 2019 - 2020 Acosix GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!--
|
||||
Copyright 2019 Acosix GmbH
|
||||
Copyright 2019 - 2020 Acosix GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<#--
|
||||
Copyright 2019 Acosix GmbH
|
||||
Copyright 2019 - 2020 Acosix GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 Acosix GmbH
|
||||
* Copyright 2019 - 2020 Acosix GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
12
share/src/test/docker/Repository-Dockerfile
Normal file
12
share/src/test/docker/Repository-Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM ${docker.tests.repositoryBaseImage}
|
||||
COPY maven ${docker.tests.repositoryWebappPath}
|
||||
|
||||
# merge additions to alfresco-global.properties
|
||||
RUN echo "" >> ${docker.tests.repositoryWebappPath}/../../shared/classes/alfresco-global.properties \
|
||||
&& echo "#MergeGlobalProperties" >> ${docker.tests.repositoryWebappPath}/../../shared/classes/alfresco-global.properties \
|
||||
&& sed -i '/#MergeGlobalProperties/r ${docker.tests.repositoryWebappPath}/WEB-INF/classes/alfresco/extension/alfresco-global.addition.properties' ${docker.tests.repositoryWebappPath}/../../shared/classes/alfresco-global.properties \
|
||||
&& sed -i 's/<secure>true<\/secure>/<secure>false<\/secure>/' $CATALINA_HOME/conf/web.xml \
|
||||
&& mv ${docker.tests.repositoryWebappPath}/WEB-INF/classes/alfresco/extension/entrypoint.sh $CATALINA_HOME/bin/ \
|
||||
&& chmod +x $CATALINA_HOME/bin/entrypoint.sh
|
||||
|
||||
CMD ["entrypoint.sh", "catalina.sh run -security"]
|
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# Copyright 2019 - 2020 Acosix GmbH
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# note: this file is not named alfresco-global.properties to not override the default file in the image
|
||||
# instead it relies on Dockerfile post-processing to merge with the default file
|
||||
|
||||
authentication.chain=keycloak1:keycloak,alfrescoNtlm1:alfrescoNtlm
|
||||
|
||||
keycloak.adapter.auth-server-url=http://${docker.tests.host.name}:${docker.tests.keycloakPort}/auth
|
||||
keycloak.adapter.realm=test
|
||||
keycloak.adapter.resource=alfresco
|
||||
keycloak.adapter.credentials.provider=secret
|
||||
keycloak.adapter.credentials.secret=6f70a28f-98cd-41ca-8f2f-368a8797d708
|
||||
|
||||
keycloak.synchronization.userFilter.containedInGroup.property.groupPaths=/Test A
|
||||
keycloak.synchronization.groupFilter.containedInGroup.property.groupPaths=/Test A
|
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# Copyright 2019 - 2020 Acosix GmbH
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
log4j.rootLogger=error, File
|
||||
|
||||
log4j.appender.File=org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.File.File=\${catalina.base}/logs/alfresco.log
|
||||
log4j.appender.File.Append=true
|
||||
log4j.appender.File.DatePattern='.'yyyy-MM-dd
|
||||
log4j.appender.File.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.File.layout.ConversionPattern=%d{ISO8601} %-5p [%c] [%t] %m%n
|
||||
|
||||
log4j.logger.${project.artifactId}=DEBUG
|
10
share/src/test/docker/alfresco/extension/entrypoint.sh
Normal file
10
share/src/test/docker/alfresco/extension/entrypoint.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
ip=`hostname -I | awk '{print $1}'`
|
||||
hostip=`echo "${ip}" | sed -E 's/([0-9]+\.[0-9]+)\.0\.[0-9]+/\1.0.1/'`
|
||||
hostname="${DOCKER_HOST_NAME}"
|
||||
echo "${hostip} ${hostname}" >> /etc/hosts
|
||||
|
||||
bash -c "$@"
|
@@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!--
|
||||
Copyright 2019 Acosix GmbH
|
||||
Copyright 2019 - 2020 Acosix GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
@@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!--
|
||||
Copyright 2019 Acosix GmbH
|
||||
Copyright 2019 - 2020 Acosix GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -23,18 +23,43 @@
|
||||
<format>dir</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<dependencySets>
|
||||
<!--
|
||||
<dependencySet>
|
||||
<outputDirectory>WEB-INF/lib</outputDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/src/test/docker/alfresco</directory>
|
||||
<outputDirectory>WEB-INF/classes/alfresco</outputDirectory>
|
||||
<includes>
|
||||
<include>*</include>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
<scope>compile</scope>
|
||||
</dependencySet>
|
||||
-->
|
||||
<excludes>
|
||||
<exclude>*.js</exclude>
|
||||
<exclude>**/*.js</exclude>
|
||||
<exclude>*.ftl</exclude>
|
||||
<exclude>**/*.ftl</exclude>
|
||||
<exclude>*.keystore</exclude>
|
||||
<exclude>**/*.keystore</exclude>
|
||||
</excludes>
|
||||
<filtered>true</filtered>
|
||||
<lineEnding>lf</lineEnding>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/src/test/docker/alfresco</directory>
|
||||
<outputDirectory>WEB-INF/classes/alfresco</outputDirectory>
|
||||
<includes>
|
||||
<include>*.js</include>
|
||||
<include>**/*.js</include>
|
||||
<include>*.ftl</include>
|
||||
<include>**/*.ftl</include>
|
||||
<include>*.keystore</include>
|
||||
<include>**/*.keystore</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<outputDirectory>WEB-INF/lib</outputDirectory>
|
||||
<includes>
|
||||
<include>${project.groupId}:de.acosix.alfresco.keycloak.repo.deps:*</include>
|
||||
<include>de.acosix.alfresco.utility:de.acosix.alfresco.utility.common:*</include>
|
||||
<include>de.acosix.alfresco.utility:de.acosix.alfresco.utility.core.repo.quartz1:*</include>
|
||||
<include>de.acosix.alfresco.utility:de.acosix.alfresco.utility.core.repo.quartz2:*</include>
|
||||
|
1
share/src/test/docker/repository-logs/dummy.properties
Normal file
1
share/src/test/docker/repository-logs/dummy.properties
Normal file
@@ -0,0 +1 @@
|
||||
# only exists to ensure Maven creates path in project ./target
|
@@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!--
|
||||
Copyright 2019 Acosix GmbH
|
||||
Copyright 2019 - 2020 Acosix GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,13 @@
|
||||
<format>dir</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<files>
|
||||
<file>
|
||||
<source>${project.basedir}/src/test/docker/share-log4j.properties</source>
|
||||
<outputDirectory>WEB-INF/classes</outputDirectory>
|
||||
<destName>log4j.properties</destName>
|
||||
</file>
|
||||
</files>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${project.build.directory}</directory>
|
||||
@@ -32,24 +39,41 @@
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/src/test/resources</directory>
|
||||
<outputDirectory>WEB-INF/classes</outputDirectory>
|
||||
<directory>${project.basedir}/src/test/docker/alfresco</directory>
|
||||
<outputDirectory>WEB-INF/classes/alfresco</outputDirectory>
|
||||
<includes>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.xml</include>
|
||||
<include>*</include>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>*.js</exclude>
|
||||
<exclude>**/*.js</exclude>
|
||||
<exclude>*.ftl</exclude>
|
||||
<exclude>**/*.ftl</exclude>
|
||||
<exclude>*.keystore</exclude>
|
||||
<exclude>**/*.keystore</exclude>
|
||||
</excludes>
|
||||
<filtered>true</filtered>
|
||||
<lineEnding>lf</lineEnding>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/src/test/docker/alfresco</directory>
|
||||
<outputDirectory>WEB-INF/classes/alfresco</outputDirectory>
|
||||
<includes>
|
||||
<include>*.js</include>
|
||||
<include>**/*.js</include>
|
||||
<include>*.ftl</include>
|
||||
<include>**/*.ftl</include>
|
||||
<include>*.keystore</include>
|
||||
<include>**/*.keystore</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<outputDirectory>WEB-INF/lib</outputDirectory>
|
||||
<includes>
|
||||
<include>org.keycloak:*</include>
|
||||
<include>org.jboss.logging:*</include>
|
||||
<include>org.bouncycastle:*</include>
|
||||
<include>com.fasterxml.jackson.core:*</include>
|
||||
<include>${project.groupId}:de.acosix.alfresco.keycloak.share.deps:*</include>
|
||||
</includes>
|
||||
<scope>compile</scope>
|
||||
</dependencySet>
|
||||
|
1404
share/src/test/docker/test-realm.json
Normal file
1404
share/src/test/docker/test-realm.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 Acosix GmbH
|
||||
* Copyright 2019 - 2020 Acosix GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!--
|
||||
Copyright 2019 Acosix GmbH
|
||||
Copyright 2019 - 2020 Acosix GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!--
|
||||
Copyright 2019 Acosix GmbH
|
||||
Copyright 2019 - 2020 Acosix GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
Reference in New Issue
Block a user