p2-inc / keycloak-magic-link

Magic Link Authentication for Keycloak
https://phasetwo.io
Other
231 stars 46 forks source link

NullPointerException in MagicLinkAuthenticator if forceCreate is false #60

Closed kosmoz closed 10 months ago

kosmoz commented 10 months ago

When a login is attempted but no such user exists and forceCreate is set to false, the plugin raises a NullPointerException here:

https://github.com/p2-inc/keycloak-magic-link/blob/9821b1e91806b0fe83fa5a4f71225d051d6fecb6/src/main/java/io/phasetwo/keycloak/magic/auth/MagicLinkAuthenticator.java#L85C67-L85C67

Keycloak then proceeds to return a 500 error response due to the following error (but I am not sure if this is caused by the plugin):

Uncaught server error: java.lang.IllegalStateException: Attempted to define event error without first setting the event type

xgp commented 10 months ago

@kosmoz Good catch. Please PR if you have the time.

kosmoz commented 10 months ago

@kosmoz Good catch. Please PR if you have the time.

You beat me to it :slightly_smiling_face: Thanks!