Closed tomschulze closed 1 year ago
Looks like a bug that was introduced in the recent version change, as keycloak changed the meaning of id
and name
.
The culprit lies in the use of realm.getId()
when creating an organization:
https://github.com/p2-inc/keycloak-orgs/blob/main/src/main/java/io/phasetwo/service/model/jpa/JpaOrganizationProvider.java#L35
In previous versions of Keycloak realm.getId()
and realm.getName()
used to return the same thing. They finally "fixed" realm.getId()
to return the UUID rather than the name. Two alternatives:
realm.getName()
realm.getId()
(UUID)I'm going to go with 2, but will make a note if you have backwards compatibility issues
thanks so much for the quick fix. it works now.
No problem. Good catch. I'm trying to figure out exactly what happened with the change. Anyone that had an existing installation that upgrades to this will need to update their realm_id
column in the organization
table to be the UUID. However, I can't exactly figure out where that is coming from in the DB: https://github.com/keycloak/keycloak/discussions/15690
I wanted to try the invitation flow and configured the invitation authenticator according to the docs (added invitation as a step after the username+password form). The invitation action is never triggered and the login flow continues as if invitations are not configured. The following logs appear:
I run the
quay.io/phasetwo/phasetwo-keycloak:20.0.1-alpha
docker image and started keycloak withstart-dev
. I use the default H2 database. I did query the H2 database file and the realm, organization and invitation data was there.After debugging, I found that the JpaOrganizationProvider uses
realm.getName()
as a parameter to setup the named querygetInvitationsByRealmAndEmail
. When swapping the parameter withrealm.getId()
, the query returns my invitation.