英文:
Keyclock custom required action not showing up in UI
问题
我正在尝试向我的Keycloak实例添加自定义的Keycloak所需操作。
到目前为止,我已经添加了以下文件:
providers/pom.xml
providers/invitation/pom.xml
(父级 - 子级)providers/invitation/src/main/java/it/rent/auth/requiredaction/InvitationRequiredAction.java
,它实现了RequiredActionProvider
providers/invitation/src/main/java/it/rent/auth/requiredaction/InvitationRequiredActionFactory.java
,它实现了RequiredActionFactory
providers/invitation/src/main/resources/META-INF/services/org.keycloak.authentication.RequiredActionFactory
,其中包含以下内容:it.rent.auth.requiredaction.InvitationRequiredActionFactory
Keycloak的Docker文件如下:
FROM maven:3-jdk-8-alpine as builder
WORKDIR /build/providers
ENV MODULES="invitation"
RUN for module in $MODULES; do mkdir -p "/build/providers/$module"; done
COPY providers/pom.xml /build/providers/pom.xml
COPY providers/invitation/pom.xml /build/providers/invitation/pom.xml
RUN mvn -B clean
COPY providers /build/providers
RUN mvn -B package
FROM jboss/keycloak:4.8.2.Final
构建输出看起来很有希望,如下所示:
[INFO]
[INFO] Providers .......................................... SUCCESS [ 0.020 s]
[INFO] invitation ......................................... SUCCESS [ 2.449 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
然而,即使在登录到管理员控制台后,我也无法在所需操作列表中看到我的所需操作。
我在这里漏掉了什么?
英文:
I am trying to add a custom Keycloak required action to my Keycloak instance
So far I have been adding the following files
providers/pom.xml
providers/invitation/pom.xml
(parent - child)providers/invitation/src/main/java/it/rent/auth/requiredaction/InvitationRequiredAction.java
which implementsRequiredActionProvider
providers/invitation/src/main/java/it/rent/auth/requiredaction/InvitationRequiredActionFactory.java
which implementsRequiredActionFactory
providers/invitation/src/main/resources/META-INF/services/org.keycloak.authentication.RequiredActionFactory
with the following content:it.rent.auth.requiredaction.InvitationRequiredActionFactory
The keycloak Docker file looks like
FROM maven:3-jdk-8-alpine as builder
WORKDIR /build/providers
ENV MODULES="invitation"
RUN for module in $MODULES; do mkdir -p "/build/providers/$module"; done
COPY providers/pom.xml /build/providers/pom.xml
COPY providers/invitation/pom.xml /build/providers/invitation/pom.xml
RUN mvn -B clean
COPY providers /build/providers
RUN mvn -B package
FROM jboss/keycloak:4.8.2.Final
The build output seems promising as it says
[INFO]
[INFO] Providers .......................................... SUCCESS [ 0.020 s]
[INFO] invitation ......................................... SUCCESS [ 2.449 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
Anyway after landing to the admin dashboard I am not able to see my required action in the required actions list.
What do I miss here?
答案1
得分: 1
多亏了 @Evil_skunk 指出了这一点,我忘记将构建好的 JAR 文件复制到 /opt/jboss/keycloak/standalone/deployments
目录下。
所以,我通过在 Dockerfile 的末尾添加了以下这行代码来解决了这个问题:
COPY --from=builder /build/providers/invitation/target/*.jar /opt/jboss/keycloak/standalone/deployments
英文:
Thanks to @Evil_skunk to point this out, I forgot to copy my builded jar files to /opt/jboss/keycloak/standalone/deployments
.
So I managed to fix this problem by adding the following line at the end ouf my Dockerfile
COPY --from=builder /build/providers/invitation/target/*.jar /opt/jboss/keycloak/standalone/deployments
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论