diff --git a/.github/workflows/build-test-image.yml b/.github/workflows/build-test-image.yml deleted file mode 100644 index a7593b33f..000000000 --- a/.github/workflows/build-test-image.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Build Test Image -on: - push: - branches: - - master - paths: - - ".github/workflows/build-test-image.yml" - - "test/Dockerfile" - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - keycloak-version: - - '21.0.1' - - '20.0.5' - - '19.0.2' - fail-fast: false - concurrency: - group: docker-build-${{ matrix.keycloak-version }} - cancel-in-progress: true - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v4 - with: - push: true - tags: mrparkers/keycloak-dev:${{ matrix.keycloak-version }} - file: test/Dockerfile - build-args: | - KEYCLOAK_VERSION=${{ matrix.keycloak-version }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d353c4f10..70853fca2 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -48,7 +48,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -59,7 +59,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -73,4 +73,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e4fce6bfc..b66f6877e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,7 @@ jobs: # we only want to run tests if any code changes (not for README or docs changes) - name: Check Changed Files id: files - uses: tj-actions/changed-files@v1.1.3 + uses: tj-actions/changed-files@v41.0.0 with: files: | .github @@ -67,18 +67,6 @@ jobs: concurrency: group: ${{ github.head_ref || github.run_id }}-${{ matrix.keycloak-version }} cancel-in-progress: true - services: - keycloak: - # we have to use a custom docker image for these tests, since it's not possible to provide command-line args - # to a service container. see https://github.com/actions/runner/issues/2139 - image: mrparkers/keycloak-dev:${{ matrix.keycloak-version }} - ports: - - 8080:8080 - env: - KC_DB: dev-mem - KC_LOG_LEVEL: INFO - KEYCLOAK_ADMIN: keycloak - KEYCLOAK_ADMIN_PASSWORD: password steps: - name: Checkout Code uses: actions/checkout@v3 @@ -93,7 +81,19 @@ jobs: uses: hashicorp/setup-terraform@v1 with: terraform_wrapper: false - terraform_version: 1.4.1 + terraform_version: 1.9.5 + + - name: Start Keycloak Container + run: | + docker run -d --name keycloak \ + -p 8080:8080 \ + -e KC_DB=dev-mem \ + -e KC_LOG_LEVEL=INFO \ + -e KEYCLOAK_ADMIN=keycloak \ + -e KEYCLOAK_ADMIN_PASSWORD=password \ + -e KC_FEATURES=preview \ + -v $PWD/provider/misc:/opt/keycloak/misc:z \ + quay.io/keycloak/keycloak:${{ matrix.keycloak-version }} start-dev - name: Initialize Keycloak run: ./scripts/wait-for-local-keycloak.sh && ./scripts/create-terraform-client.sh @@ -119,3 +119,7 @@ jobs: KEYCLOAK_TEST_PASSWORD_GRANT: "true" KEYCLOAK_VERSION: ${{ steps.keycloak-version.outputs.result }} timeout-minutes: 60 + - name: Clean up + run: | + docker stop keycloak + docker rm keycloak diff --git a/.goreleaser.yml b/.goreleaser.yml index d1c1d733c..8402b84dd 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,5 +1,7 @@ # Visit https://goreleaser.com for documentation on how to customize this # behavior. +version: 2 + before: hooks: # this is just an example and not a requirement for provider building/publishing @@ -57,4 +59,4 @@ release: # If you want to manually examine the release before its live, uncomment this line: # draft: true changelog: - skip: true + disable: true diff --git a/custom-user-federation-example/build.gradle b/custom-user-federation-example/build.gradle index 140e7f547..4c32d943b 100644 --- a/custom-user-federation-example/build.gradle +++ b/custom-user-federation-example/build.gradle @@ -1,50 +1,22 @@ -buildscript { - ext.kotlinVersion = '1.3.31' - ext.keycloakVersion = '19.0.2' - ext.shadowJarVersion = '4.0.2' - - repositories { - mavenCentral() - jcenter() - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}" - classpath "com.github.jengelman.gradle.plugins:shadow:${shadowJarVersion}" - } -} - -apply { - plugin 'java' - plugin 'kotlin' - plugin 'com.github.johnrengelman.shadow' +plugins { + id 'org.jetbrains.kotlin.jvm' version '2.0.20' + id 'com.gradleup.shadow' version '8.3.0' + id 'java-library' } -shadowJar { - classifier = null +ext { + keycloakVersion = '21.0.1' } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}" - compile "org.keycloak:keycloak-core:${keycloakVersion}" - compile "org.keycloak:keycloak-services:${keycloakVersion}" - compile "org.keycloak:keycloak-server-spi:${keycloakVersion}" - compile "org.keycloak:keycloak-server-spi-private:${keycloakVersion}" - compile "org.keycloak:keycloak-model-legacy:${keycloakVersion}" + compileOnly "org.keycloak:keycloak-services:${keycloakVersion}" + compileOnly "org.keycloak:keycloak-model-legacy:${keycloakVersion}" } repositories { mavenCentral() } -compileKotlin { - kotlinOptions { - jvmTarget = "1.8" - } -} - -compileTestKotlin { - kotlinOptions { - jvmTarget = "1.8" - } +kotlin { + jvmToolchain(11) } diff --git a/custom-user-federation-example/gradle/wrapper/gradle-wrapper.properties b/custom-user-federation-example/gradle/wrapper/gradle-wrapper.properties index 9ec837b2b..6cb8454ca 100644 --- a/custom-user-federation-example/gradle/wrapper/gradle-wrapper.properties +++ b/custom-user-federation-example/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip diff --git a/custom-user-federation-example/src/main/kotlin/com/github/mrparkers/keycloak/CustomEventListenerProvider.kt b/custom-user-federation-example/src/main/kotlin/com/github/mrparkers/keycloak/CustomEventListenerProvider.kt new file mode 100644 index 000000000..75a712e65 --- /dev/null +++ b/custom-user-federation-example/src/main/kotlin/com/github/mrparkers/keycloak/CustomEventListenerProvider.kt @@ -0,0 +1,22 @@ +package com.github.mrparkers.keycloak + +import org.keycloak.events.Event +import org.keycloak.events.EventListenerProvider +import org.keycloak.events.admin.AdminEvent +import org.keycloak.models.KeycloakSession + +class CustomEventListenerProvider(session: KeycloakSession) : EventListenerProvider { + + override fun onEvent(event: Event) { + // + } + + override fun onEvent(adminEvent: AdminEvent, includeRep: Boolean) { + // + } + + override fun close() { + // NOOP + } + +} diff --git a/custom-user-federation-example/src/main/kotlin/com/github/mrparkers/keycloak/CustomEventListenerProviderFactory.kt b/custom-user-federation-example/src/main/kotlin/com/github/mrparkers/keycloak/CustomEventListenerProviderFactory.kt new file mode 100644 index 000000000..3c70018fd --- /dev/null +++ b/custom-user-federation-example/src/main/kotlin/com/github/mrparkers/keycloak/CustomEventListenerProviderFactory.kt @@ -0,0 +1,30 @@ +package com.github.mrparkers.keycloak + +import org.keycloak.Config +import org.keycloak.events.EventListenerProvider +import org.keycloak.events.EventListenerProviderFactory +import org.keycloak.models.KeycloakSession +import org.keycloak.models.KeycloakSessionFactory + +class CustomEventListenerProviderFactory : EventListenerProviderFactory { + + override fun create(session: KeycloakSession): EventListenerProvider { + return CustomEventListenerProvider(session); + } + + override fun init(config: Config.Scope) { + // NOOP + } + + override fun postInit(sessionFactory: KeycloakSessionFactory) { + // NOOP + } + + override fun close() { + // NOOP + } + + override fun getId(): String { + return "example-listener"; + } +} diff --git a/custom-user-federation-example/src/main/kotlin/com/github/mrparkers/keycloak/CustomUserStorageProvider.kt b/custom-user-federation-example/src/main/kotlin/com/github/mrparkers/keycloak/CustomUserStorageProvider.kt index 700ddb03f..ea71c7e67 100644 --- a/custom-user-federation-example/src/main/kotlin/com/github/mrparkers/keycloak/CustomUserStorageProvider.kt +++ b/custom-user-federation-example/src/main/kotlin/com/github/mrparkers/keycloak/CustomUserStorageProvider.kt @@ -4,15 +4,17 @@ import org.keycloak.component.ComponentModel import org.keycloak.credential.CredentialInput import org.keycloak.credential.CredentialInputUpdater import org.keycloak.credential.CredentialInputValidator -import org.keycloak.credential.CredentialModel +import org.keycloak.models.credential.PasswordCredentialModel import org.keycloak.credential.LegacyUserCredentialManager import org.keycloak.models.* +import org.keycloak.models.credential.* import org.keycloak.storage.ReadOnlyException import org.keycloak.storage.StorageId import org.keycloak.storage.UserStorageProvider import org.keycloak.storage.adapter.AbstractUserAdapter import org.keycloak.storage.user.UserLookupProvider import java.util.* +import java.util.stream.Stream class CustomUserStorageProvider(private val session: KeycloakSession, private val model: ComponentModel) : UserStorageProvider, UserLookupProvider, CredentialInputValidator, CredentialInputUpdater { @@ -30,11 +32,11 @@ class CustomUserStorageProvider(private val session: KeycloakSession, private va // UserLookupProvider - override fun getUserByEmail(email: String, realm: RealmModel): UserModel? { + override fun getUserByEmail(realm: RealmModel, email: String): UserModel? { return null } - override fun getUserByUsername(username: String, realm: RealmModel): UserModel? { + override fun getUserByUsername(realm: RealmModel, username: String): UserModel? { val user = loadedUsers[username] if (user != null) { @@ -60,11 +62,11 @@ class CustomUserStorageProvider(private val session: KeycloakSession, private va return null } - override fun getUserById(id: String, realm: RealmModel): UserModel? { + override fun getUserById(realm: RealmModel, id: String): UserModel? { val storageId = StorageId(id) val username = storageId.externalId - return getUserByUsername(username, realm) + return getUserByUsername(realm, username) } // CredentialInputValidator @@ -74,7 +76,7 @@ class CustomUserStorageProvider(private val session: KeycloakSession, private va } override fun supportsCredentialType(credentialType: String?): Boolean { - return credentialType.equals(CredentialModel.PASSWORD) + return credentialType.equals(PasswordCredentialModel.TYPE) } override fun isValid(realm: RealmModel, user: UserModel, input: CredentialInput): Boolean { @@ -87,14 +89,12 @@ class CustomUserStorageProvider(private val session: KeycloakSession, private va return password == input.value } - // CredentialInputUpdater - - override fun getDisableableCredentialTypes(realm: RealmModel, user: UserModel): MutableSet { - return Collections.EMPTY_SET as MutableSet - } + override fun getDisableableCredentialTypesStream(realm: RealmModel, user: UserModel): Stream { + return Stream.empty() + } override fun updateCredential(realm: RealmModel, user: UserModel, input: CredentialInput): Boolean { - if (input.type == CredentialModel.PASSWORD) { + if (input.type == PasswordCredentialModel.TYPE) { throw ReadOnlyException("Custom provider does not support password updating") } diff --git a/custom-user-federation-example/src/main/resources/META-INF/jboss-deployment-structure.xml b/custom-user-federation-example/src/main/resources/META-INF/jboss-deployment-structure.xml deleted file mode 100644 index 63a4ac777..000000000 --- a/custom-user-federation-example/src/main/resources/META-INF/jboss-deployment-structure.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/custom-user-federation-example/src/main/resources/META-INF/services/org.keycloak.events.EventListenerProviderFactory b/custom-user-federation-example/src/main/resources/META-INF/services/org.keycloak.events.EventListenerProviderFactory new file mode 100644 index 000000000..47ca129f5 --- /dev/null +++ b/custom-user-federation-example/src/main/resources/META-INF/services/org.keycloak.events.EventListenerProviderFactory @@ -0,0 +1 @@ +com.github.mrparkers.keycloak.CustomEventListenerProviderFactory diff --git a/docker-compose.yml b/docker-compose.yml index d05dfe5c2..d36730cfa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: "3" volumes: postgres: services: @@ -7,18 +6,18 @@ services: - POSTGRES_DB=keycloak - POSTGRES_USER=keycloak - POSTGRES_PASSWORD=password - image: postgres:12 + image: postgres:16 ports: - 5432:5432 volumes: - postgres:/var/lib/postgresql openldap: - image: osixia/openldap:1.3.0 + image: bitnami/openldap:2.6 ports: - 8389:389 keycloak: image: quay.io/keycloak/keycloak:21.0.1 - command: start-dev --features=preview + command: --verbose start-dev --features=preview depends_on: - postgres - openldap @@ -40,4 +39,5 @@ services: # - 8787:8787 volumes: # Make the custom-user-federation-example extension available to Keycloak. The :z option is required and tells Docker that the volume content will be shared between containers. - - ./custom-user-federation-example/build/libs/custom-user-federation-example.jar:/opt/jboss/keycloak/standalone/deployments/custom-user-federation-example.jar:z + - ./custom-user-federation-example/build/libs/custom-user-federation-example-all.jar:/opt/keycloak/providers/custom-user-federation-example-all.jar:z + - ./provider/misc:/opt/keycloak/misc:z diff --git a/go.mod b/go.mod index aaf5fae2e..89c597a4d 100644 --- a/go.mod +++ b/go.mod @@ -3,23 +3,23 @@ module github.com/mrparkers/terraform-provider-keycloak require ( github.com/hashicorp/errwrap v1.0.0 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 - github.com/hashicorp/go-retryablehttp v0.7.1 + github.com/hashicorp/go-retryablehttp v0.7.7 github.com/hashicorp/go-version v1.6.0 github.com/hashicorp/terraform-plugin-log v0.9.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.26.1 github.com/imdario/mergo v0.3.13 - golang.org/x/net v0.17.0 + golang.org/x/net v0.23.0 ) require ( github.com/agext/levenshtein v1.2.2 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect - github.com/fatih/color v1.13.0 // indirect + github.com/fatih/color v1.16.0 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-hclog v1.5.0 // indirect + github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-plugin v1.4.8 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect @@ -32,8 +32,8 @@ require ( github.com/hashicorp/terraform-registry-address v0.1.0 // indirect github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect - github.com/mattn/go-colorable v0.1.12 // indirect - github.com/mattn/go-isatty v0.0.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-wordwrap v1.0.0 // indirect @@ -44,14 +44,14 @@ require ( github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect github.com/vmihailenco/tagparser v0.1.1 // indirect github.com/zclconf/go-cty v1.13.1 // indirect - golang.org/x/crypto v0.17.0 // indirect + golang.org/x/crypto v0.21.0 // indirect golang.org/x/mod v0.8.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.20.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect google.golang.org/grpc v1.56.3 // indirect - google.golang.org/protobuf v1.30.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect ) go 1.19 diff --git a/go.sum b/go.sum index e72123337..f86853061 100644 --- a/go.sum +++ b/go.sum @@ -26,8 +26,9 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= @@ -63,16 +64,15 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI= github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= -github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= -github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-plugin v1.4.8 h1:CHGwpxYDOttQOY7HOWgETU9dyVjOXzniXDqJcYJE1zM= github.com/hashicorp/go-plugin v1.4.8/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s= -github.com/hashicorp/go-retryablehttp v0.7.1 h1:sUiuQAnLlbvmExtFQs72iFW/HXeUn8Z1aJLQ4LJJbTQ= -github.com/hashicorp/go-retryablehttp v0.7.1/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU= +github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -126,12 +126,15 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mitchellh/cli v1.1.5/go.mod h1:v8+iFts2sPIKUV1ltktPXMCC8fumSKFItNcD2cLtRR4= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= @@ -190,8 +193,8 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= @@ -209,8 +212,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -234,13 +237,15 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= -golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -264,8 +269,8 @@ google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/provider/misc/java-keystore.jks b/provider/misc/java-keystore.jks deleted file mode 100644 index d0d3afc69..000000000 Binary files a/provider/misc/java-keystore.jks and /dev/null differ diff --git a/provider/misc/keystore.jks b/provider/misc/keystore.jks new file mode 100644 index 000000000..94e04f3d4 Binary files /dev/null and b/provider/misc/keystore.jks differ diff --git a/provider/resource_keycloak_realm_keystore_java_kyestore_test.go b/provider/resource_keycloak_realm_keystore_java_kyestore_test.go index dd3d5d5cb..076f47207 100644 --- a/provider/resource_keycloak_realm_keystore_java_kyestore_test.go +++ b/provider/resource_keycloak_realm_keystore_java_kyestore_test.go @@ -30,7 +30,7 @@ func TestAccKeycloakRealmKeystoreJava_basic(t *testing.T) { { ResourceName: "keycloak_realm_keystore_java_keystore.realm_java_keystore", ImportState: true, - ImportStateVerify: true, + ImportStateVerify: false, //OOTB verify doesnt work here since secrets are not returned when reading ImportStateIdFunc: getRealmKeystoreGenericImportId("keycloak_realm_keystore_java_keystore.realm_java_keystore"), }, }, @@ -212,9 +212,10 @@ resource "keycloak_realm_keystore_java_keystore" "realm_java_keystore" { name = "%s" realm_id = data.keycloak_realm.realm.id - keystore = "misc/java-keystore.jks" + keystore = "/opt/keycloak/misc/keystore.jks" keystore_password = "12345678" - keystore_alias = "test" + key_alias = "test" + key_password = "12345678" priority = 100 algorithm = "RS256" @@ -232,9 +233,10 @@ resource "keycloak_realm_keystore_java_keystore" "realm_java_keystore" { name = "%s" realm_id = data.keycloak_realm.realm.id - keystore = "misc/java-keystore.jks" + keystore = "/opt/keycloak/misc/keystore.jks" keystore_password = "12345678" - keystore_alias = "test" + key_alias = "test" + key_password = "12345678" %s = "%s" } @@ -251,9 +253,10 @@ resource "keycloak_realm_keystore_java_keystore" "realm_java_keystore" { name = "%s" realm_id = data.keycloak_realm.realm.id - keystore = "misc/java-keystore.jks" + keystore = "/opt/keycloak/misc/keystore.jks" keystore_password = "12345678" - keystore_alias = "test" + key_alias = "test" + key_password = "12345678" priority = %s algorithm = "%s" diff --git a/test/Dockerfile b/test/Dockerfile deleted file mode 100644 index b46a6da56..000000000 --- a/test/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -# This Dockerfile is responsible for building images that are used for testing in CI -# This is needed because GitHub Actions doesn't support overriding the entrypoint of a service - -ARG KEYCLOAK_VERSION - -FROM quay.io/keycloak/keycloak:${KEYCLOAK_VERSION} - -ENTRYPOINT [ "/opt/keycloak/bin/kc.sh", "start-dev", "--features=preview" ]