p2-inc / keycloak-events

Useful Keycloak event listener implementations and utilities.
https://phasetwo.io
Other
168 stars 35 forks source link

Get correct resource type in webhook payload? #25

Closed egdelwonk closed 1 year ago

egdelwonk commented 1 year ago

Hi @xgp -- any idea on how to get the correct resource type in webhook payloads? On the events tab, I see ORGANIZATION, however in the webhook payload it says "CUSTOM". Is this intentional ? It appears that creating/editing users shows the correct resource type for what it's worth.

image

Creating an org payload

image

Assigning a user to an org payload

image

Thanks for any help.

Cheers

xgp commented 1 year ago

Weird. CUSTOM is never assigned to anything here or in the keycloak-orgs code. Are you running with debug logging? This line should tell us what the AdminEvent is using https://github.com/p2-inc/keycloak-events/blob/main/src/main/java/io/phasetwo/keycloak/events/WebhookSenderEventListenerProvider.java#L65 which is what is getting passed into the payload.

xgp commented 1 year ago

Looks like it got changed to force cast it to a ResourceType enum in the Keycloak AdminEvent code. We need to switch to use getResourceTypeAsString

egdelwonk commented 1 year ago

Thank you! <3