Keycloak- 具有算法的无效配置:找不到密码哈希提供程序

Keycloak- Invalid config for has Algorithm: Password hashing provider not found

我是 docker 上的 运行 keycloak,我想导入一个以前导出的领域。但我收到错误:启动时出错:org.keycloak.models.ModelException:hashAlgorithm 配置无效:找不到密码哈希提供程序 我读到我需要将 jbcrypt.jar 复制到 standalone/deployments 文件夹中的容器。然后我创建了一个 Dockerfile,这样我就可以复制 jbcrypt。请问我如何为 bcrypt 提供密码哈希提供程序?

Dockerfile:

FROM jboss/keycloak:latest

ARG KEYCLOAK_HOME=/opt/jboss/keycloak
RUN curl -L https://github.com/leroyguillaume/keycloak-bcrypt/releases/download/1.5.0/keycloak-bcrypt-1.5.0.jar > $KEYCLOAK_HOME/standalone/deployments/keycloak-bcrypt-1.5.0.jar
RUN curl -L https://repo1.maven.org/maven2/org/mindrot/jbcrypt/0.4/jbcrypt-0.4.jar > $KEYCLOAK_HOME/standalone/deployments/jbcrypt-0.4.jar

RUN cd $KEYCLOAK_HOME/standalone/deployments/ && ls
RUN /opt/jboss/keycloak/bin/jboss-cli.sh --command="module add --name=org.mindrot.jbcrypt --resources=$KEYCLOAK_HOME/standalone/deployments/jbcrypt-0.4.jar"
RUN /opt/jboss/keycloak/bin/jboss-cli.sh --command="module add --name=org.mindrot.keycloakbcrypt --resources=$KEYCLOAK_HOME/standalone/deployments/keycloak-bcrypt-1.5.0.jar"

docker-compose.yml

version: '3'

volumes:
  postgres_data:
    driver: local

services:
  ncbs_core_keycloak_postgres:
    image: postgres:latest
    volumes:
      - postgres_data:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: keycloak
      POSTGRES_USER: keycloak
      POSTGRES_PASSWORD: password
    restart: always
  ncbs_core_keycloak:
#    image: jboss/keycloak:latest
    build: .
    environment:
      DB_VENDOR: POSTGRES
      DB_ADDR: ncbs_core_keycloak_postgres
      DB_DATABASE: keycloak
      DB_USER: keycloak
      DB_SCHEMA: public
      DB_PASSWORD: password
      KEYCLOAK_USER: admin
      KEYCLOAK_PASSWORD: admin
      KEYCLOAK_IMPORT: ./imports/realm-export.json
      # Uncomment the line below if you want to specify JDBC parameters. The parameter below is just an example, and it shouldn't be used in production without knowledge. It is highly recommended that you read the PostgreSQL JDBC driver documentation in order to use it.
      #JDBC_PARAMS: "ssl=true"
    command:
      - "-b 0.0.0.0"
      - "-Dkeycloak.migration.action=import"
      - "-Dkeycloak.migration.provider=singleFile"
      - "-Dkeycloak.migration.file=/opt/jboss/keycloak/imports/realm-export.json"
      - "-Dkeycloak.migration.strategy=OVERWRITE_EXISTING"
    volumes:
      - ./imports:/opt/jboss/keycloak/imports
    ports:
      - 8080:8080
    depends_on:
      - ncbs_core_keycloak_postgres

我在 docker-compose 中使用了 volume 来让它在不重启的情况下工作 从 GitHub 下载库并安装为如下卷:

volumes:
- ./keycloak-bcrypt-1.5.0.jar:/opt/jboss/keycloak/standalone/deployments/keycloak-bcrypt-1.5.0.jar