Closed hrueger closed 10 months ago
You only need the keycloak-magic-link-0.17-SNAPSHOT.jar
. I'm not familiar with the bitnami image, but putting it in the providers directory sounds right. After a successful install, the endpoint should be at https://{keycloak-host}/{relative-path}/realms/{realm}/magic-link
, and there should be an example flow called "Magic Link" available in your Authentication Flows.
Hi, thanks for the quick answer. Yes I tried that url (I'm not using a custom relative path and I'm on the keycloak 22, so no /auth prefix). I also can't find the example flow nor the execution step step in the ui... Do you think it is an issue with the image?
I believe the providers directory is correct since it complains if there are two .jar files.
I did a quick test with this docker-compose file and it works fine:
version: '3'
services:
keycloak:
image: docker.io/bitnami/keycloak:22.0.1
volumes:
- ${PWD}/target/keycloak-magic-link-0.17-SNAPSHOT.jar:/opt/bitnami/keycloak/providers/keycloak-magic-link.jar
environment:
KEYCLOAK_DATABASE_VENDOR: dev-mem
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
ports:
- 8080:8080
and I see the following on start
2023-08-22 10:03:50,785 WARN [org.keycloak.services] (build-41) KC-SERVICES0047: magic-link (io.phasetwo.keycloak.magic.resources.MagicLinkResourceProviderFactory) is implementing the internal SPI realm-restapi-extension. This SPI is internal and may change without notice
2023-08-22 10:03:50,866 WARN [org.keycloak.services] (build-41) KC-SERVICES0047: ext-magic-form (io.phasetwo.keycloak.magic.auth.MagicLinkAuthenticatorFactory) is implementing the internal SPI authenticator. This SPI is internal and may change without notice
2023-08-22 10:03:50,866 WARN [org.keycloak.services] (build-41) KC-SERVICES0047: ext-email-otp (io.phasetwo.keycloak.magic.auth.EmailOtpAuthenticatorFactory) is implementing the internal SPI authenticator. This SPI is internal and may change without notice
2023-08-22 10:03:51,034 WARN [org.keycloak.services] (build-41) KC-SERVICES0047: ext-magic-link (io.phasetwo.keycloak.magic.auth.token.MagicLinkActionTokenHandlerFactory) is implementing the internal SPI actionTokenHandler. This SPI is internal and may change without notice
and
2023-08-22 10:04:04,998 INFO [io.phasetwo.keycloak.magic.MagicLink] (main) creating built-in auth flow for magic link
I'm sorry, but I still can't get it to work. I believe I'm doing the exact same thing: https://github.com/hrueger/keycloak-magic-link-installation-issue
I run docker compose up -d
and get those container logs:
2023-08-22 13:31:04 keycloak 11:31:04.85
2023-08-22 13:31:04 keycloak 11:31:04.85 Welcome to the Bitnami keycloak container
2023-08-22 13:31:04 keycloak 11:31:04.85 Subscribe to project updates by watching https://github.com/bitnami/containers
2023-08-22 13:31:04 keycloak 11:31:04.86 Submit issues and feature requests at https://github.com/bitnami/containers/issues
2023-08-22 13:31:04 keycloak 11:31:04.86
2023-08-22 13:31:04 keycloak 11:31:04.86 INFO ==> ** Starting keycloak setup **
2023-08-22 13:31:04 keycloak 11:31:04.87 INFO ==> Validating settings in KEYCLOAK_* env vars...
2023-08-22 13:31:04 /opt/bitnami/scripts/libvalidations.sh: line 245: return: : numeric argument required
2023-08-22 13:31:04 keycloak 11:31:04.88 INFO ==> Configuring database settings
2023-08-22 13:31:04 keycloak 11:31:04.89 INFO ==> Enabling statistics
2023-08-22 13:31:04 keycloak 11:31:04.89 INFO ==> Enabling health endpoints
2023-08-22 13:31:04 keycloak 11:31:04.89 INFO ==> Configuring http settings
2023-08-22 13:31:04 keycloak 11:31:04.91 INFO ==> Configuring hostname settings
2023-08-22 13:31:04 keycloak 11:31:04.91 INFO ==> Configuring cache count
2023-08-22 13:31:04 keycloak 11:31:04.92 INFO ==> Configuring log level
2023-08-22 13:31:04 keycloak 11:31:04.92 INFO ==> Configuring proxy
2023-08-22 13:31:04 keycloak 11:31:04.93 INFO ==> ** keycloak setup finished! **
2023-08-22 13:31:04 keycloak 11:31:04.94 INFO ==> ** Starting keycloak **
2023-08-22 13:31:04
2023-08-22 13:31:05 Updating the configuration and installing your custom providers, if any. Please wait.
2023-08-22 13:31:08 2023-08-22 11:31:07,987 WARN [org.keycloak.services] (build-28) KC-SERVICES0047: metrics (org.jboss.aerogear.keycloak.metrics.MetricsEndpointFactory) is implementing the internal SPI realm-restapi-extension. This SPI is internal and may change without notice
2023-08-22 13:31:08 2023-08-22 11:31:08,279 WARN [org.keycloak.services] (build-28) KC-SERVICES0047: metrics-listener (org.jboss.aerogear.keycloak.metrics.MetricsEventListenerFactory) is implementing the internal SPI eventsListener. This SPI is internal and may change without notice
2023-08-22 13:31:12 2023-08-22 11:31:12,614 INFO [io.quarkus.deployment.QuarkusAugmentor] (main) Quarkus augmentation completed in 5895ms
2023-08-22 13:31:14 2023-08-22 11:31:13,657 INFO [org.keycloak.quarkus.runtime.hostname.DefaultHostnameProvider] (main) Hostname settings: Base URL: <unset>, Hostname: <request>, Strict HTTPS: false, Path: <request>, Strict BackChannel: false, Admin URL: <unset>, Admin: <request>, Port: -1, Proxied: true
2023-08-22 13:31:14 2023-08-22 11:31:14,904 WARN [io.quarkus.agroal.runtime.DataSources] (main) Datasource <default> enables XA but transaction recovery is not enabled. Please enable transaction recovery by setting quarkus.transaction-manager.enable-recovery=true, otherwise data may be lost if the application is terminated abruptly
2023-08-22 13:31:15 2023-08-22 11:31:15,531 WARN [org.infinispan.PERSISTENCE] (keycloak-cache-init) ISPN000554: jboss-marshalling is deprecated and planned for removal
2023-08-22 13:31:15 2023-08-22 11:31:15,616 INFO [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000556: Starting user marshaller 'org.infinispan.jboss.marshalling.core.JBossUserMarshaller'
2023-08-22 13:31:15 2023-08-22 11:31:15,729 INFO [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000088: Unable to use any JGroups configuration mechanisms provided in properties {}. Using default JGroups configuration!
2023-08-22 13:31:15 2023-08-22 11:31:15,811 INFO [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000078: Starting JGroups channel `ISPN`
2023-08-22 13:31:15 2023-08-22 11:31:15,813 INFO [org.jgroups.JChannel] (keycloak-cache-init) local_addr: 01ebc1b6-8502-450b-b177-aee676ed80db, name: 9cbd0a9bec25-38310
2023-08-22 13:31:15 2023-08-22 11:31:15,822 WARN [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the send buffer of socket MulticastSocket was set to 1MB, but the OS only allocated 212.99KB
2023-08-22 13:31:15 2023-08-22 11:31:15,822 WARN [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the receive buffer of socket MulticastSocket was set to 20MB, but the OS only allocated 212.99KB
2023-08-22 13:31:15 2023-08-22 11:31:15,823 WARN [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the send buffer of socket MulticastSocket was set to 1MB, but the OS only allocated 212.99KB
2023-08-22 13:31:15 2023-08-22 11:31:15,823 WARN [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the receive buffer of socket MulticastSocket was set to 25MB, but the OS only allocated 212.99KB
2023-08-22 13:31:15 2023-08-22 11:31:15,839 INFO [org.jgroups.protocols.FD_SOCK2] (keycloak-cache-init) server listening on *.39776
2023-08-22 13:31:15 2023-08-22 11:31:15,879 INFO [org.keycloak.broker.provider.AbstractIdentityProviderMapper] (main) Registering class org.keycloak.broker.provider.mappersync.ConfigSyncEventListener
2023-08-22 13:31:16 2023-08-22 11:31:16,836 INFO [org.keycloak.quarkus.runtime.storage.legacy.liquibase.QuarkusJpaUpdaterProvider] (main) Initializing database schema. Using changelog META-INF/jpa-changelog-master.xml
2023-08-22 13:31:17 2023-08-22 11:31:17,844 INFO [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) 9cbd0a9bec25-38310: no members discovered after 2002 ms: creating cluster as coordinator
2023-08-22 13:31:17 2023-08-22 11:31:17,851 INFO [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000094: Received new cluster view for channel ISPN: [9cbd0a9bec25-38310|0] (1) [9cbd0a9bec25-38310]
2023-08-22 13:31:17 2023-08-22 11:31:17,865 INFO [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000079: Channel `ISPN` local address is `9cbd0a9bec25-38310`, physical addresses are `[172.23.0.2:55312]`
2023-08-22 13:31:18 2023-08-22 11:31:18,549 INFO [org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFactory] (main) Node name: 9cbd0a9bec25-38310, Site name: null
2023-08-22 13:31:18 2023-08-22 11:31:18,683 INFO [org.keycloak.services] (main) KC-SERVICES0050: Initializing master realm
2023-08-22 13:31:20 2023-08-22 11:31:20,110 INFO [io.quarkus] (main) Keycloak 22.0.1 on JVM (powered by Quarkus 3.2.0.Final) started in 7.409s. Listening on: http://0.0.0.0:8080
2023-08-22 13:31:20 2023-08-22 11:31:20,110 INFO [io.quarkus] (main) Profile dev activated.
2023-08-22 13:31:20 2023-08-22 11:31:20,110 INFO [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-orm, jdbc-h2, jdbc-mariadb, jdbc-mssql, jdbc-mysql, jdbc-oracle, jdbc-postgresql, keycloak, logging-gelf, micrometer, narayana-jta, reactive-routes, resteasy, resteasy-jackson, smallrye-context-propagation, smallrye-health, vertx]
2023-08-22 13:31:20 2023-08-22 11:31:20,251 INFO [org.keycloak.services] (main) KC-SERVICES0009: Added user 'admin' to realm 'master'
2023-08-22 13:31:20 2023-08-22 11:31:20,253 WARN [org.keycloak.quarkus.runtime.KeycloakMain] (main) Running the server in development mode. DO NOT use this configuration in production.
No mentioning of magic-link or similar. I can't see it in the ui either.
Maybe my .jar
file is just broken?
The only things I changed are ${PWD}/
to ./
since I'm on windows, and the port from 8080
to 8089
.
I found it: somehow the generated .jar
file was broken.
I used GitHub Codespaces and (please don't ask me why) the first time it built and generated files with ca. 39 kb, the second time I build, I got about 47 kb.
But never mind, now its working 👍 Sorry for the noise.
It's not the first time I've heard of something going sideways in Codespaces. Thanks for chasing down the root cause and sharing your findings. Let me know if anything else comes up as you use our extension.
Yes, there are actually some minor things (let me know if you want a new issue for that):
Duplicate emails
enabled in Keycloak. Therefore, I can't use email
as the values are not unique. I was first looking to specify the user via its id
, but I only found the username
option in your rest api endpoint. This works fine, though.update_password
required action, since it is automatically enabled when specifying the username. What is the reason for that? I changed that in a fork for my usecase: https://github.com/p2-inc/keycloak-magic-link/commit/f6712c8cef1be633b428dbb25948e5e98341fd63User with email null not found, and forceCreate is off
. This was a bit confusing, since I thought it did not take my username
field.However, those are only minor things and I was able to work around them pretty easily. Other than that its working just fine!
2 seems like a bug. I can't remember a reason for forcing update_password
(or update_profile
for that matter). I'll update that.
Cool, thanks!
(Just on my phone, so I can't comment on the commit)
I saw that you also changed the error message I mentioned. Love that. I think it would make sense to show the username at %s
if no email is given? Currently, getEmail
is hardcoded there and it might confuse people cause they think their argument value didn't make it into username
properly. Does that make sense?
You're right. It should probably be emailOrUsername
Hi, first of all, thanks for this plugin. I'd really like to use it, however, I cannot get it installed (or enabled?). I'm using the bitnami keycloak docker image. My
docker-compose.yml
looks like this:I've copied the
keycloak-magic-link-0.17-SNAPSHOT.jar
to./keycloak-extensions
.However, the
/magic-link
url returns a{"error":"HTTP 404 Not Found"}
and I can't find theMagic Link
Step in the UI. I made sure to not be on the master realm.Keycloak does somehow detect the .jar file, because if I copy both by
mvn clean install
generated files (keycloak-magic-link-0.17-SNAPSHOT.jar
andoriginal-keycloak-magic-link-0.17-SNAPSHOT.jar
, the docker logs show:Docker Container logs with only one of the two files (which one should be used by the way?)
Any idea what I might be missing?