I'm writing a custom authentication SPI for Keycloak. To authenticate cookie, I want to use AuthenticationManager of keycloak-services. I've added keycloak-services as maven dependency in the project. It doesn't give any compilation error but after deploying the SPI on Keycloak, it's throwing me below exception.
Here is the Exception :
ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-68) Uncaught server error: java.lang.NoClassDefFoundError: org/keycloak/services/managers/AuthenticationManager at org.keycloak.examples.authenticator.SecretQuestionAuthenticator.authenticate(SecretQuestionAuthenticator.java:102) at org.keycloak.authentication.DefaultAuthenticationFlow.processFlow(DefaultAuthenticationFlow.java:200) at org.keycloak.authentication.AuthenticationProcessor.authenticateOnly(AuthenticationProcessor.java:853) at org.keycloak.authentication.AuthenticationProcessor.authenticate(AuthenticationProcessor.java:722) at org.keycloak.protocol.AuthorizationEndpointBase.handleBrowserAuthenticationRequest(AuthorizationEndpointBase.java:145) at org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint.buildAuthorizationCodeAuthorizationResponse(AuthorizationEndpoint.java:395) at org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint.build(AuthorizationEndpoint.java:139)
Maven Dependency
<dependencies>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-spi</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-spi-private</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-services</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>