diff --git a/deps.edn b/deps.edn index 5e29d47..d36502a 100644 --- a/deps.edn +++ b/deps.edn @@ -54,17 +54,17 @@ com.google.cloud/google-cloud-secretmanager {:mvn/version "2.23.0"} ;; keycloak stuff - org.keycloak/keycloak-common {:mvn/version "24.0.2"} - org.keycloak/keycloak-core {:mvn/version "24.0.2"} - org.keycloak/keycloak-authz-client {:mvn/version "24.0.2"} - org.keycloak/keycloak-policy-enforcer{:mvn/version "24.0.2"} - org.keycloak/keycloak-adapter-core {:mvn/version "24.0.2"} - org.keycloak/keycloak-adapter-spi {:mvn/version "24.0.2"} + org.keycloak/keycloak-common {:mvn/version "24.0.5"} + org.keycloak/keycloak-core {:mvn/version "24.0.5"} + org.keycloak/keycloak-authz-client {:mvn/version "24.0.5"} + org.keycloak/keycloak-policy-enforcer{:mvn/version "24.0.5"} + org.keycloak/keycloak-adapter-core {:mvn/version "24.0.5"} + org.keycloak/keycloak-adapter-spi {:mvn/version "24.0.5"} org.jboss.logging/jboss-logging {:mvn/version "3.5.3.Final"} org.apache.httpcomponents/httpclient {:mvn/version "4.5.14"} ;;all the deps below are for the admin client (don't know why the transitive deps didn't work) - org.keycloak/keycloak-admin-client {:mvn/version "24.0.2"} + org.keycloak/keycloak-admin-client {:mvn/version "24.0.5"} ;com.fasterxml.jackson.core/jackson-core {:mvn/version "2.17.0"} ;com.fasterxml.jackson.core/jackson-databind {:mvn/version "2.17.0"} ;com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider {:mvn/version "2.17.0"} diff --git a/docker/start-keycloak-docker.sh b/docker/start-keycloak-docker.sh index 6f7b6d9..02354c7 100755 --- a/docker/start-keycloak-docker.sh +++ b/docker/start-keycloak-docker.sh @@ -8,4 +8,4 @@ docker run -d \ --name keycloak-dev \ -p 127.0.0.1:9990:9990 \ -p 127.0.0.1:8080:8080 \ - quay.io/keycloak/keycloak:24.0.2 start-dev + quay.io/keycloak/keycloak:24.0.5 start-dev diff --git a/src/keycloak/utils.clj b/src/keycloak/utils.clj index 2757759..555d129 100644 --- a/src/keycloak/utils.clj +++ b/src/keycloak/utils.clj @@ -8,7 +8,7 @@ (defn keycloak-running? [keycloak-client] (try (-> keycloak-client (.realm "master") (.toRepresentation) bean) - ; (catch javax.ws.rs.ProcessingException pe false) + ; (catch jakarta.ws.rs.ProcessingException pe false) ; (catch java.net.ConnectException ce false) )) diff --git a/test/keycloak/backend_test.clj b/test/keycloak/backend_test.clj index be7af64..44e4116 100644 --- a/test/keycloak/backend_test.clj +++ b/test/keycloak/backend_test.clj @@ -47,9 +47,6 @@ headers (kc-authn/auth-cookie token))})) -(defn yada-test-context [token] - {:request (request-for :get "/protected" (headers-with-token-as-header {} token))}) - (def EXPIRED_TOKEN_BAD_REALM {:access_token "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJxYnIwakNmanZXRXJfV0tkT1FSVzdkTkNiZmZHeXZQaVROTVA2ZjdYSVpZIn0.eyJleHAiOjE2MTM3NTk5MTAsImlhdCI6MTYxMzc1OTYxMCwianRpIjoiNTdmZjFmNjktNDk2ZC00MTA5LWI1ZTctZGFlYTk1NDY4Mzg0IiwiaXNzIjoiaHR0cDovL2xvZ2luLmRlZmF1bHQubWluaWt1YmUuZGV2bWFjaGluZS9hdXRoL3JlYWxtcy9lbGVjdHJlIiwiYXVkIjoiYWNjb3VudCIsInN1YiI6ImRkMTdlODkzLTFmYWYtNDBjMi04MzA0LTFiZjI1NjMxOTkxOCIsInR5cCI6IkJlYXJlciIsImF6cCI6ImRpZmZ1c2lvbi1mcm9udGVuZCIsInNlc3Npb25fc3RhdGUiOiI3MzgzMGM1Mi03YWE2LTRmMWYtOTFmZS0xMWQ1NzllMDZkZmEiLCJhY3IiOiIxIiwiYWxsb3dlZC1vcmlnaW5zIjpbImh0dHA6Ly9sb2NhbGhvc3Q6MzAwMCJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsib3JnLWFkbWluIiwiYXBpLXJlY2hlcmNoZS1saWJ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options) (update :body b/to-byte-buffers) true (update :headers #(merge {"host" "localhost"} %)))))) +(defn yada-test-context [token] + {:request (request-for :get "/protected" (headers-with-token-as-header {} token))}) + (defn yada-test-context-missing-token [] {:request (request-for :get "/protected" {:headers {"content-type" "application/transit+json" "accept" "application/transit+json"}})}) diff --git a/test/keycloak/deployment_test.clj b/test/keycloak/deployment_test.clj index 911e69f..8416cc0 100644 --- a/test/keycloak/deployment_test.clj +++ b/test/keycloak/deployment_test.clj @@ -92,7 +92,7 @@ (is (= username (:username extracted-token))))))))) (testing "realm deletion" (delete-realm! admin-client realm-name) - (is (thrown? javax.ws.rs.NotFoundException (get-realm admin-client realm-name)))))))) + (is (thrown? jakarta.ws.rs.NotFoundException (get-realm admin-client realm-name)))))))) (defn delete-realms-except [realms-to-keep] (let [admin-client (deployment/keycloak-client integration-test-conf admin-login admin-password) diff --git a/test/keycloak/reconciliation_test.clj b/test/keycloak/reconciliation_test.clj index 32a227e..920ed76 100644 --- a/test/keycloak/reconciliation_test.clj +++ b/test/keycloak/reconciliation_test.clj @@ -105,7 +105,7 @@ (is (= "to-be-modified-1" (:username (first (:user/updates plan))))))) (testing "realm deletion" (admin/delete-realm! admin-client realm-name) - (is (thrown? javax.ws.rs.NotFoundException (admin/get-realm admin-client realm-name))))))) + (is (thrown? jakarta.ws.rs.NotFoundException (admin/get-realm admin-client realm-name))))))) (testing "Fetch the existing users and diff the one that need update or creation" (let []))) @@ -189,7 +189,7 @@ (-> (get plan :user/updates) first :groups) => [{:path "/group2"}]))))))) (testing "realm deletion" (admin/delete-realm! admin-client realm-name) - (is (thrown? javax.ws.rs.NotFoundException (admin/get-realm admin-client realm-name)))))))) + (is (thrown? jakarta.ws.rs.NotFoundException (admin/get-realm admin-client realm-name)))))))) (defn- get-roles->users [admin-client realm-name roles] (into {} (map (fn [[role users]] [role (into [] (map bean/UserRepresentation->map users))]) (user/get-users-aggregated-by-realm-roles admin-client realm-name roles)))) @@ -246,7 +246,7 @@ (get empty-plan :realm-role-mappings/deletions) => empty?))))) (testing " finally realm is deleted" (admin/delete-realm! admin-client realm-name) - (is (thrown? javax.ws.rs.NotFoundException (admin/get-realm admin-client realm-name)))))))) + (is (thrown? jakarta.ws.rs.NotFoundException (admin/get-realm admin-client realm-name)))))))) (deftest ^:integration groups-test (let [admin-client (deployment/keycloak-client integration-test-conf admin-login admin-password)] @@ -313,7 +313,7 @@ (get empty-plan :groups/deletions) => empty?))))) (testing " finally realm is deleted" (admin/delete-realm! admin-client realm-name) - (is (thrown? javax.ws.rs.NotFoundException (admin/get-realm admin-client realm-name)))))))) + (is (thrown? jakarta.ws.rs.NotFoundException (admin/get-realm admin-client realm-name)))))))) (comment diff --git a/test/keycloak/starter_test.clj b/test/keycloak/starter_test.clj index 910a0d2..89b2b1e 100644 --- a/test/keycloak/starter_test.clj +++ b/test/keycloak/starter_test.clj @@ -112,7 +112,7 @@ (fact secret-value => (comp not str/blank?))))))) (testing "realm deletion" (delete-realm! admin-client realm-name) - (is (thrown? javax.ws.rs.NotFoundException (get-realm admin-client realm-name))) + (is (thrown? jakarta.ws.rs.NotFoundException (get-realm admin-client realm-name))) )))) (deftest ^:integration starter-reconciliation-test @@ -137,7 +137,7 @@ (starter/init! admin-client (assoc-in config [:realm :name] realm-name) infra-context {:dry-run? true :apply-deletions? true})) (testing "realm deletion" (delete-realm! admin-client realm-name) - (is (thrown? javax.ws.rs.NotFoundException (get-realm admin-client realm-name))))))) + (is (thrown? jakarta.ws.rs.NotFoundException (get-realm admin-client realm-name))))))) (deftest config-test (let [environment (sci/new-var 'environment "staging")