wouterh-dev / keycloak-spi-trusted-device

Apache License 2.0
24 stars 6 forks source link

Cannnot configure Authenticator types with Keycloak 23.0.6 #6

Closed cride83 closed 4 months ago

cride83 commented 5 months ago

Hi

Keycloak version: 23.0.6 Postgres version: 14

I tried taking into use your extension for remembering MFA device in the login flow when user has requirement to "Configure OTP".

Unfortunately I cannot configure the "Authenticator types" when editing the condition "Credential Configured". When I try to use the flow I see that there is an error in the keycloak docker logs:

2024-05-08 05:08:25,595 WARN [org.keycloak.services] (executor-thread-16) KC-SERVICES0013: Failed authentication: java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.length()" because "this.text" is null at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1769) at java.base/java.util.regex.Matcher.reset(Matcher.java:415) at java.base/java.util.regex.Matcher.(Matcher.java:252) at java.base/java.util.regex.Pattern.matcher(Pattern.java:1134) at java.base/java.util.regex.Pattern.split(Pattern.java:1262) at java.base/java.util.regex.Pattern.split(Pattern.java:1335) at nl.wouterh.keycloak.trusteddevice.authenticator.CredentialConfiguredCondition.matchCondition(CredentialConfiguredCondition.java:25) at org.keycloak.authentication.DefaultAuthenticationFlow.conditionalNotMatched(DefaultAuthenticationFlow.java:358)

The configuration dialog for Credential Configured looks like this:

image

The flow that I have tried to configured looks like this:

image

Is this a problem that the component is not yet supporting Keycloak 23.0.6 or have I missed something essential here?

wouterh-dev commented 4 months ago

This is a problem with Keycloak: https://github.com/keycloak/keycloak/issues/28979

The latest version will default to the "otp" authenticator type to work around this upstream bug: https://github.com/wouterh-dev/keycloak-spi-trusted-device/commit/4bd3603aaab4e183789a02bb11e098b4dc7faa73