Keycloak自定义所需的操作未在用户界面中显示

huangapple go评论69阅读模式
英文:

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] ------------------------------------------------------------------------

然而,即使在登录到管理员控制台后,我也无法在所需操作列表中看到我的所需操作。
Keycloak自定义所需的操作未在用户界面中显示

我在这里漏掉了什么?

英文:

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 implements RequiredActionProvider
  • providers/invitation/src/main/java/it/rent/auth/requiredaction/InvitationRequiredActionFactory.java which implements RequiredActionFactory
  • 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.
Keycloak自定义所需的操作未在用户界面中显示

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

huangapple
  • 本文由 发表于 2020年10月1日 21:29:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/64156426.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定