                                           "emailVerified" false
                                           "enabled" true})
                                :headers headers})))
+
   (demote-user-from-admin
     [this tenant author-claims user-id]
     (do-demote-user-from-admin this tenant author-claims user-id))


(defmethod ig/init-key :akvo.lumen.component.keycloak/keycloak  [_ {:keys [credentials data max-user-ids-cache monitoring] :as opts}]
  (log/info "Starting keycloak")
  (let [{:keys [issuer openid-config api-root] :as this} (init-keycloak (assoc data :credentials credentials :max-user-ids-cache max-user-ids-cache))
        connection-manager                               (http.client/new-connection-manager {:timeout 10 :threads 10 :default-per-route 10})
        openid-config                                    (fetch-openid-configuration issuer {})]
    (log/info "Successfully got openid-config from provider.")
    (assoc this
           :connection-manager connection-manager
           :openid-config openid-config
           :monitoring monitoring)))

(defn- init-keycloak [{:keys [credentials url realm max-user-ids-cache]}]
  (map->KeycloakAgent {:api-root      (format "%s/admin/realms/%s" url realm)
                       :credentials   credentials
                       :user-id-cache (atom (cache/lru-cache-factory {} :threshold max-user-ids-cache))}))

(defmethod ig/init-key :akvo.lumen.component.keycloak/data  [_ {:keys [url realm] :as opts}]
