mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-17 14:21:39 +00:00
ACS-7567 Test with Keycloak 24.0.2 (#2599)
This commit is contained in:
committed by
Sara Aspery
parent
8c7c8a69b4
commit
5a7116e9ef
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
@@ -357,8 +357,8 @@ jobs:
|
|||||||
- testSuite: AppContext04TestSuite
|
- testSuite: AppContext04TestSuite
|
||||||
compose-profile: with-transform-core-aio
|
compose-profile: with-transform-core-aio
|
||||||
- testSuite: AppContext05TestSuite
|
- testSuite: AppContext05TestSuite
|
||||||
compose-profile: default
|
compose-profile: with-sso
|
||||||
mvn-options: '"-Didentity-service.auth-server-url=http://${HOST_IP}:8999/auth"'
|
mvn-options: '"-Didentity-service.auth-server-url=http://localhost:8999/auth"'
|
||||||
- testSuite: AppContext06TestSuite
|
- testSuite: AppContext06TestSuite
|
||||||
compose-profile: with-transform-core-aio
|
compose-profile: with-transform-core-aio
|
||||||
- testSuite: AppContextExtraTestSuite
|
- testSuite: AppContextExtraTestSuite
|
||||||
@@ -379,11 +379,7 @@ jobs:
|
|||||||
- name: "Set transformers tag"
|
- name: "Set transformers tag"
|
||||||
run: echo "TRANSFORMERS_TAG=$(mvn help:evaluate -Dexpression=dependency.alfresco-transform-core.version -q -DforceStdout)" >> $GITHUB_ENV
|
run: echo "TRANSFORMERS_TAG=$(mvn help:evaluate -Dexpression=dependency.alfresco-transform-core.version -q -DforceStdout)" >> $GITHUB_ENV
|
||||||
- name: "Set up the environment"
|
- name: "Set up the environment"
|
||||||
run: |
|
run: docker-compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile ${{ matrix.compose-profile }} up -d
|
||||||
if [ -e ./scripts/ci/tests/${{ matrix.testSuite }}-setup.sh ]; then
|
|
||||||
bash ./scripts/ci/tests/${{ matrix.testSuite }}-setup.sh
|
|
||||||
fi
|
|
||||||
docker-compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile ${{ matrix.compose-profile }} up -d
|
|
||||||
- name: "Run tests"
|
- name: "Run tests"
|
||||||
run: mvn -B test -pl repository -am -Dtest=${{ matrix.testSuite }} -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco ${{ matrix.mvn-options }}
|
run: mvn -B test -pl repository -am -Dtest=${{ matrix.testSuite }} -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco ${{ matrix.mvn-options }}
|
||||||
- name: "Clean Maven cache"
|
- name: "Clean Maven cache"
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -29,26 +29,18 @@ import static org.mockito.ArgumentMatchers.any;
|
|||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.NetworkInterface;
|
|
||||||
import java.net.SocketException;
|
|
||||||
import java.security.KeyPair;
|
import java.security.KeyPair;
|
||||||
import java.security.KeyPairGenerator;
|
import java.security.KeyPairGenerator;
|
||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import org.alfresco.repo.management.subsystems.AbstractChainedSubsystemTest;
|
import org.alfresco.repo.management.subsystems.AbstractChainedSubsystemTest;
|
||||||
import org.alfresco.repo.management.subsystems.ChildApplicationContextFactory;
|
import org.alfresco.repo.management.subsystems.ChildApplicationContextFactory;
|
||||||
import org.alfresco.repo.management.subsystems.DefaultChildApplicationContextManager;
|
import org.alfresco.repo.management.subsystems.DefaultChildApplicationContextManager;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationException;
|
|
||||||
import org.alfresco.repo.security.authentication.external.RemoteUserMapper;
|
import org.alfresco.repo.security.authentication.external.RemoteUserMapper;
|
||||||
import org.alfresco.repo.security.authentication.identityservice.IdentityServiceConfig;
|
|
||||||
import org.alfresco.util.ApplicationContextHelper;
|
import org.alfresco.util.ApplicationContextHelper;
|
||||||
import org.apache.http.HttpEntity;
|
import org.apache.http.HttpEntity;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
@@ -128,31 +120,8 @@ public class IdentityServiceRemoteUserMapperTest extends AbstractChainedSubsyste
|
|||||||
|
|
||||||
public void testKeycloakConfig() throws Exception
|
public void testKeycloakConfig() throws Exception
|
||||||
{
|
{
|
||||||
//Get the host of the IDS test server
|
|
||||||
String ip = "localhost";
|
|
||||||
try {
|
|
||||||
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
|
|
||||||
while (interfaces.hasMoreElements()) {
|
|
||||||
NetworkInterface iface = interfaces.nextElement();
|
|
||||||
// filters out 127.0.0.1 and inactive interfaces
|
|
||||||
if (iface.isLoopback() || !iface.isUp())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Enumeration<InetAddress> addresses = iface.getInetAddresses();
|
|
||||||
while(addresses.hasMoreElements()) {
|
|
||||||
InetAddress addr = addresses.nextElement();
|
|
||||||
if(Pattern.matches("([0-9]{1,3}\\.){3}[0-9]{1,3}", addr.getHostAddress())){
|
|
||||||
ip = addr.getHostAddress();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SocketException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// check string overrides
|
// check string overrides
|
||||||
assertEquals("identity-service.auth-server-url", "http://"+ip+":8999/auth",
|
assertEquals("identity-service.auth-server-url", "http://localhost:8999/auth",
|
||||||
this.identityServiceConfig.getAuthServerUrl());
|
this.identityServiceConfig.getAuthServerUrl());
|
||||||
|
|
||||||
assertEquals("identity-service.realm", "alfresco",
|
assertEquals("identity-service.realm", "alfresco",
|
||||||
|
@@ -10,7 +10,7 @@ services:
|
|||||||
- "8090:8090"
|
- "8090:8090"
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:13.3
|
image: postgres:13.3
|
||||||
profiles: ["default", "with-transform-core-aio", "postgres"]
|
profiles: ["default", "with-transform-core-aio", "postgres", "with-sso"]
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_PASSWORD=alfresco
|
- POSTGRES_PASSWORD=alfresco
|
||||||
- POSTGRES_USER=alfresco
|
- POSTGRES_USER=alfresco
|
||||||
@@ -19,8 +19,20 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "5433:5432"
|
- "5433:5432"
|
||||||
activemq:
|
activemq:
|
||||||
profiles: ["default", "with-transform-core-aio", "activemq"]
|
profiles: ["default", "with-transform-core-aio", "activemq", "with-sso"]
|
||||||
image: alfresco/alfresco-activemq:5.16.7-jre17-rockylinux8
|
image: alfresco/alfresco-activemq:5.16.7-jre17-rockylinux8
|
||||||
ports:
|
ports:
|
||||||
- "5672:5672" # AMQP
|
- "5672:5672" # AMQP
|
||||||
- "61616:61616" # OpenWire
|
- "61616:61616" # OpenWire
|
||||||
|
keycloak:
|
||||||
|
profiles: ["with-sso"]
|
||||||
|
image: quay.io/keycloak/keycloak:24.0.2
|
||||||
|
environment:
|
||||||
|
- KEYCLOAK_ADMIN=admin
|
||||||
|
- KEYCLOAK_ADMIN_PASSWORD=admin
|
||||||
|
- KC_DB=dev-mem
|
||||||
|
command: ["start-dev", "--import-realm", "--http-relative-path=/auth", "--hostname=localhost", "--http-enabled=true"]
|
||||||
|
volumes:
|
||||||
|
- ../../../repository/src/test/resources/realms/alfresco-realm.json:/opt/keycloak/data/import/alfresco-realm.json
|
||||||
|
ports:
|
||||||
|
- 8999:8080
|
@@ -1,15 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
echo "=========================== Starting AppContext05TestSuite setup ==========================="
|
|
||||||
PS4="\[\e[35m\]+ \[\e[m\]"
|
|
||||||
set -vex
|
|
||||||
pushd "$(dirname "${BASH_SOURCE[0]}")/../../../"
|
|
||||||
|
|
||||||
mkdir -p "${HOME}/tmp"
|
|
||||||
cp repository/src/test/resources/realms/alfresco-realm.json "${HOME}/tmp"
|
|
||||||
echo "HOST_IP=$(hostname -I | cut -f1 -d' ')" >> $GITHUB_ENV
|
|
||||||
docker run -d -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin -e DB_VENDOR=h2 -p 8999:8080 -e KEYCLOAK_IMPORT=/tmp/alfresco-realm.json -v $HOME/tmp/alfresco-realm.json:/tmp/alfresco-realm.json alfresco/alfresco-identity-service:1.2
|
|
||||||
|
|
||||||
popd
|
|
||||||
set +vex
|
|
||||||
echo "=========================== Finishing AppContext05TestSuite setup =========================="
|
|
Reference in New Issue
Block a user