From 919688d06e142a9658adf3aa152dc768843351a0 Mon Sep 17 00:00:00 2001 From: Konrad Windszus Date: Thu, 25 Apr 2024 16:52:54 +0200 Subject: [PATCH] Optionally create/update managed groups in Adobe IMS This leverages the UMAPI This closes #698 --- .github/workflows/maven.yml | 9 + accesscontroltool-bundle/bnd.bnd | 4 +- accesscontroltool-bundle/pom.xml | 18 +- .../AuthorizableInstallerServiceImpl.java | 23 +- .../ExternalGroupInstallerServiceImpl.java | 2 +- .../configmodel/AuthorizableConfigBean.java | 19 +- .../actool/configreader/YamlConfigReader.java | 4 + .../ExternalGroupManagement.java | 19 ++ .../ims/IMSUserManagement.java | 228 ++++++++++++++++++ .../ims/request/ActionCommand.java | 20 ++ .../ims/request/CreateGroupStep.java | 17 ++ .../ims/request/Step.java | 14 ++ .../ims/request/UserGroupActionCommand.java | 13 + .../ims/response/AccessToken.java | 15 ++ .../ims/response/ActionCommandError.java | 21 ++ .../ims/response/ActionCommandIssue.java | 25 ++ .../ims/response/ActionCommandResponse.java | 26 ++ .../ims/response/ActionCommandWarning.java | 21 ++ .../ims/IMSUserManagementIT.java | 58 +++++ docs/AdvancedFeatures.md | 12 +- docs/Configuration.md | 5 +- .../maximum-environment/maximum-aem.bndrun | 1 + .../minimum-environment/minimum-aem.bndrun | 1 + 23 files changed, 565 insertions(+), 10 deletions(-) create mode 100644 accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/externalusermanagement/ExternalGroupManagement.java create mode 100644 accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/externalusermanagement/ims/IMSUserManagement.java create mode 100644 accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/externalusermanagement/ims/request/ActionCommand.java create mode 100644 accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/externalusermanagement/ims/request/CreateGroupStep.java create mode 100644 accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/externalusermanagement/ims/request/Step.java create mode 100644 accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/externalusermanagement/ims/request/UserGroupActionCommand.java create mode 100644 accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/externalusermanagement/ims/response/AccessToken.java create mode 100644 accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/externalusermanagement/ims/response/ActionCommandError.java create mode 100644 accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/externalusermanagement/ims/response/ActionCommandIssue.java create mode 100644 accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/externalusermanagement/ims/response/ActionCommandResponse.java create mode 100644 accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/externalusermanagement/ims/response/ActionCommandWarning.java create mode 100644 accesscontroltool-bundle/src/test/java/biz/netcentric/cq/tools/actool/externalusermanagement/ims/IMSUserManagementIT.java diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 2e1695221..682bb09d4 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -45,6 +45,11 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Needed to get some information about the pull request, if any GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Necessary for IMS IT + ACTOOL_IMS_IT_ORGANIZATIONID: ${{ env.ACTOOL_IMS_IT_ORGANIZATIONID }} + ACTOOL_IMS_IT_CLIENTID: {{ env.ACTOOL_IMS_IT_CLIENTID }} + ACTOOL_IMS_IT_CLIENTSECRET: ${{ secrets.ACTOOL_IMS_IT_CLIENTSECRET }} + run: mvn -e -B -V clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=Netcentric_accesscontroltool -Dsonar.organization=netcentric -Dsonar.host.url=https://sonarcloud.io -DnvdApiKeyEnvironmentVariable=NVD_API_KEY -Pdependency-check,coverage-report,integration-tests - name: Build, Analyse and Deploy with Maven @@ -58,4 +63,8 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Needed to get some information about the pull request, if any GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Necessary for IMS IT + ACTOOL_IMS_IT_ORGANIZATIONID: ${{ env.ACTOOL_IMS_IT_ORGANIZATIONID }} + ACTOOL_IMS_IT_CLIENTID: {{ env.ACTOOL_IMS_IT_CLIENTID }} + ACTOOL_IMS_IT_CLIENTSECRET: ${{ secrets.ACTOOL_IMS_IT_CLIENTSECRET }} run: mvn -e -B -V clean deploy org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=Netcentric_accesscontroltool -Dsonar.organization=netcentric -Dsonar.host.url=https://sonarcloud.io -DnvdApiKeyEnvironmentVariable=NVD_API_KEY -Pdependency-check,coverage-report,integration-tests diff --git a/accesscontroltool-bundle/bnd.bnd b/accesscontroltool-bundle/bnd.bnd index c601423cd..efa2e4ce9 100644 --- a/accesscontroltool-bundle/bnd.bnd +++ b/accesscontroltool-bundle/bnd.bnd @@ -7,10 +7,12 @@ Bundle-SymbolicName: biz.netcentric.cq.tools.accesscontroltool.bundle # allow to run in Sling without AEM bundles # allow to run without bouncycastle which is only necessary for some edge cases when managing keys -Import-Package: \ +Import-Package: com.adobe.granite.crypto;resolution:=optional,\ com.adobe.granite.keystore;resolution:=optional,\ com.adobe.granite.jmx.annotation;resolution:=optional,\ +com.fasterxml.jackson.databind;resolution:=optional,\ +org.apache.http.*;resolution:=optional,\ org.bouncycastle.*;resolution:=optional,\ org.apache.sling.commons.scheduler.*;resolution:=optional,\ org.apache.jackrabbit.oak.spi.security.principal;version="[1.5.0,3)",\ diff --git a/accesscontroltool-bundle/pom.xml b/accesscontroltool-bundle/pom.xml index e3bb6566b..f87be44bb 100644 --- a/accesscontroltool-bundle/pom.xml +++ b/accesscontroltool-bundle/pom.xml @@ -150,6 +150,12 @@ slf4j-simple test + + org.osgi + org.osgi.util.converter + 1.0.9 + test + org.apache.jackrabbit @@ -183,7 +189,17 @@ 3.6.8 test - + + org.apache.httpcomponents + httpclient-osgi + 4.5.13 + test + + + com.fasterxml.jackson.core + jackson-databind + test +