cooperlyt/keycloak-phone-provider

Not compatible with keycloak 22 (JAX-RS)

Romain7495 opened this issue · 7 comments

Hi,

Context and dependency injection no longer enabled to JAX-RS Resources

Source: https://www.keycloak.org/2023/07/keycloak-2200-released

Cannot add keycloak phone provider to keycloak v22.

Logs:

#14 7.253 	[error]: Build step org.keycloak.quarkus.deployment.KeycloakProcessor#configureKeycloakSessionFactory threw an exception: java.util.ServiceConfigurationError: org.keycloak.authentication.AuthenticatorFactory: Provider cc.coopersoft.keycloak.phone.authentication.authenticators.browser.SmsOtpMfaAuthenticatorFactory could not be instantiated
#14 7.253 	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:586)
#14 7.253 	at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:813)
#14 7.253 	at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:729)
#14 7.253 	at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1403)
#14 7.253 	at org.keycloak.provider.DefaultProviderLoader.load(DefaultProviderLoader.java:60)
#14 7.253 	at org.keycloak.provider.ProviderManager.load(ProviderManager.java:93)
#14 7.253 	at org.keycloak.quarkus.deployment.KeycloakProcessor.loadFactories(KeycloakProcessor.java:668)
#14 7.253 	at org.keycloak.quarkus.deployment.KeycloakProcessor.configureKeycloakSessionFactory(KeycloakProcessor.java:361)
#14 7.253 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
#14 7.253 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
#14 7.253 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
#14 7.253 	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
#14 7.253 	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
#14 7.253 	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
#14 7.253 	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
#14 7.253 	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
#14 7.253 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
#14 7.253 	at java.base/java.lang.Thread.run(Thread.java:833)
#14 7.253 	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
#14 7.253 Caused by: java.lang.NoClassDefFoundError: javax/ws/rs/ForbiddenException
#14 7.253 	at cc.coopersoft.keycloak.phone.authentication.authenticators.browser.SmsOtpMfaAuthenticatorFactory.<clinit>(SmsOtpMfaAuthenticatorFactory.java:23)
#14 7.253 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
#14 7.253 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
#14 7.253 	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
#14 7.253 	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
#14 7.253 	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
#14 7.253 	at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:789)
#14 7.253 	... 17 more
#14 7.253 Caused by: java.lang.ClassNotFoundException: javax.ws.rs.ForbiddenException
#14 7.253 	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:518)
#14 7.253 	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
#14 7.253 	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:516)
#14 7.253 	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
#14 7.253 	... 24 more
#14 7.253 
#14 7.253 ERROR: Build failure: Build failed due to errors
#14 7.253 	[error]: Build step org.keycloak.quarkus.deployment.KeycloakProcessor#configureKeycloakSessionFactory threw an exception: java.util.ServiceConfigurationError: org.keycloak.authentication.AuthenticatorFactory: Provider cc.coopersoft.keycloak.phone.authentication.authenticators.browser.SmsOtpMfaAuthenticatorFactory could not be instantiated
#14 7.253 	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:586)
#14 7.253 	at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:813)
#14 7.253 	at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:729)
#14 7.253 	at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1403)
#14 7.253 	at org.keycloak.provider.DefaultProviderLoader.load(DefaultProviderLoader.java:60)
#14 7.253 	at org.keycloak.provider.ProviderManager.load(ProviderManager.java:93)
#14 7.253 	at org.keycloak.quarkus.deployment.KeycloakProcessor.loadFactories(KeycloakProcessor.java:668)
#14 7.253 	at org.keycloak.quarkus.deployment.KeycloakProcessor.configureKeycloakSessionFactory(KeycloakProcessor.java:361)
#14 7.253 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
#14 7.253 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
#14 7.253 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
#14 7.253 	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
#14 7.253 	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
#14 7.253 	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
#14 7.253 	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
#14 7.253 	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
#14 7.253 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
#14 7.253 	at java.base/java.lang.Thread.run(Thread.java:833)
#14 7.253 	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
#14 7.253 Caused by: java.lang.NoClassDefFoundError: javax/ws/rs/ForbiddenException
#14 7.253 	at cc.coopersoft.keycloak.phone.authentication.authenticators.browser.SmsOtpMfaAuthenticatorFactory.<clinit>(SmsOtpMfaAuthenticatorFactory.java:23)
#14 7.253 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
#14 7.253 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
#14 7.253 	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
#14 7.253 	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
#14 7.253 	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
#14 7.253 	at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:789)
#14 7.253 	... 17 more
#14 7.253 Caused by: java.lang.ClassNotFoundException: javax.ws.rs.ForbiddenException
#14 7.253 	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:518)
#14 7.253 	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
#14 7.253 	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:516)
#14 7.253 	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
#14 7.253 	... 24 more
#14 7.253 
#14 7.253 ERROR: org.keycloak.authentication.AuthenticatorFactory: Provider cc.coopersoft.keycloak.phone.authentication.authenticators.browser.SmsOtpMfaAuthenticatorFactory could not be instantiated
#14 7.253 ERROR: javax/ws/rs/ForbiddenException
#14 7.253 ERROR: javax.ws.rs.ForbiddenException
#14 7.253 For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command.
#14 ERROR: executor failed running [/bin/sh -c /opt/keycloak/bin/kc.sh show-config && /opt/keycloak/bin/kc.sh build && /opt/keycloak/bin/kc.sh show-config]: exit code: 1
------
 > [10/10] RUN /opt/keycloak/bin/kc.sh show-config && /opt/keycloak/bin/kc.sh build && /opt/keycloak/bin/kc.sh show-config:
7.253 	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:518)
7.253 	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
7.253 	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:516)
7.253 	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
7.253 	... 24 more
7.253 
7.253 ERROR: org.keycloak.authentication.AuthenticatorFactory: Provider cc.coopersoft.keycloak.phone.authentication.authenticators.browser.SmsOtpMfaAuthenticatorFactory could not be instantiated
7.253 ERROR: javax/ws/rs/ForbiddenException
7.253 ERROR: javax.ws.rs.ForbiddenException
7.253 For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command.```

@cooperlyt did you plan to support keycloak 22 ?

@cooperlyt I know that you are busy right now but can you please advise ?

Sorry , Not for now, I'm busy right now. When I have some free time, I will consider this feature.

I've have made it compatible with keycloak 22, but the change isn't backward compatible with previous verisons of kc.

hey @vivekko can you share your fix we can also give a try together may be on a different branch or fork

Here #70

@cooperlyt how do you want to proceed ? Are you ok to merge this PR to main branch and create a breaking change on your lib. Maybe moving the major version to version 3 ? btw thx @vivekko for your help 💪