p2-inc / keycloak-orgs

Single realm, multi-tenancy for SaaS apps
Other
367 stars 65 forks source link

Extensions menu not appearing #91

Closed edouardr closed 1 year ago

edouardr commented 1 year ago

Hi,

I am using docker to build a container image with Keycloak Orgs. Below is my Dockerfile.

FROM quay.io/phasetwo/phasetwo-keycloak:21.1.1.1684876139 as builder

ENV KC_DB=postgres
ENV KC_HEALTH_ENABLED=true
ENV KC_HTTP_RELATIVE_PATH=/auth
ENV KC_METRICS_ENABLED=true
ENV KC_TRANSACTION_JTA_ENABLED=false
ENV KC_TRANSACTION_XA_ENABLED=false

COPY ./conf/cache-ispn-jdbc-ping.xml /opt/keycloak/conf/cache-ispn-jdbc-ping.xml

RUN /opt/keycloak/bin/kc.sh --verbose build \
 --cache-config-file=cache-ispn-jdbc-ping.xml \
 --spi-email-template-provider=freemarker-plus-mustache \
 --spi-email-template-freemarker-plus-mustache-enabled=true

FROM quay.io/phasetwo/phasetwo-keycloak:21.1.1.1684876139

COPY --from=builder /opt/keycloak/lib/quarkus/ /opt/keycloak/lib/quarkus/
COPY --from=builder /opt/keycloak/providers/ /opt/keycloak/providers/
COPY ./conf/realm-custom.json /opt/keycloak/data/import/realm-custom.json
COPY ./theme/custom-theme /opt/keycloak/themes/custom-theme

EXPOSE 8080
EXPOSE 8433
ENTRYPOINT ["/opt/keycloak/bin/kc.sh", "-v", "start", "--optimized", "--import-realm"]

As you can see, I am importing a realm that is already setup to use phasetwo.v2 admin ui's theme. However, the extension menu never appears on the nav bar (see below screenshot). I also enabled the invitation policy.

image

I have looked at the source code of the Admin UI repo. I could find a reference to showOrgs in branch 21.0.2_orgs and not in the main branch.

We can see that showOrgs calls hasSomeAccessByString() function from the AccessContext. However, this function does not seem to exist in the context of my app:

image

This leads me to think that the theme is not loaded properly.

Is there anything that I am missing to get it working?

Thanks for your help.

sumandas15 commented 1 year ago

Do this in master realm and verify

xgp commented 1 year ago

Are you logging in as the master realm admin user? If so, you needs to set the Admin UI Theme in the master realm to phasetwo.v2. It's a quirk of Keycloak that the admin UI theme that gets used is the theme of the realm from the user you log in as.

edouardr commented 1 year ago

Ah of course!

Thanks guys, it works. Maybe it would be good to menton it in the documentation?

In the Admin Console UI, of the master realm, go to the Realm Settings -> Themes page and select phasetwo.v2