p2-inc / keycloak-magic-link

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

NullPointerException in MagicLinkAuthenticator if forceCreate is false #60

Closed kosmoz closed 1 year ago

kosmoz commented 1 year 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 1 year ago

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

kosmoz commented 1 year ago

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

You beat me to it :slightly_smiling_face: Thanks!