custom authentication execution

290 views
Skip to first unread message

Wayne Mahan

unread,
Aug 23, 2022, 2:26:48 PM8/23/22
to Keycloak Dev
Hello,

I'm trying to create a custom authenticator execution, aka authentication SPI. In doing so I see documentation of: https://www.keycloak.org/docs/latest/server_development/index.html#_auth_spi_walkthrough

According to the latest, I am to:

Packaging classes and deployment

You will package your classes within a single jar. This jar must contain a file named org.keycloak.authentication.AuthenticatorFactory and must be contained in the META-INF/services/ directory of your jar. This file must list the fully qualified class name of each AuthenticatorFactory implementation you have in the jar. For example:

org.keycloak.examples.authenticator.SecretQuestionAuthenticatorFactory org.keycloak.examples.authenticator.AnotherProviderFactory

This services/ file is used by Keycloak to scan the providers it has to load into the system.

To deploy this jar, just copy it to the providers directory.

So I created a generic authenticator which implements Authenticator and a generic AuthenticationFactory which implements AuthenticatorFactory & ConfigurableAuthenticatorFactory.

When I create and copy the jar file to the providers directory, and run the build command I followed that up with a show config giving me:

Current Mode: none

Runtime Configuration:

   kc.cache =  ispn (PersistedConfigSource)

   kc.config.args =  show-config (SysPropConfigSource)

   kc.db =  dev-file (PersistedConfigSource)

   kc.health-enabled =  false (PersistedConfigSource)

   kc.home.dir =  /XXX/keycloak-18.0.2/bin/../ (SysPropConfigSource)

   kc.http-enabled =  false (PropertiesConfigSource[source=jar:file:///XXX/keycloak-18.0.2/lib/lib/main/org.keycloak.keycloak-quarkus-server-18.0.2.jar!/META-INF/keycloak.conf])

   kc.http-relative-path =  / (PersistedConfigSource)

   kc.log-console-output =  default (PropertiesConfigSource[source=jar:file:///XXX/keycloak-18.0.2/lib/lib/main/org.keycloak.keycloak-quarkus-server-18.0.2.jar!/META-INF/keycloak.conf])

   kc.log-file =  /XXX/keycloak-18.0.2/bin/../data/log/keycloak.log (PropertiesConfigSource[source=jar:file:///XXX/keycloak-18.0.2/lib/lib/main/org.keycloak.keycloak-quarkus-server-18.0.2.jar!/META-INF/keycloak.conf])

   kc.metrics-enabled =  false (PersistedConfigSource)

   kc.provider.file.keycloak-auth-spi.jar.last-modified =  1661271950500 (PersistedConfigSource)

   kc.quarkus-properties-enabled =  false (PersistedConfigSource)

   kc.show.config =  none (SysPropConfigSource)

   kc.version =  18.0.2 (SysPropConfigSource)



The issue is... I client on Authentication, selection the type (copied from type "Browser") and select "Add exection" - I do not see the option for my custom Authenticator... What did I miss?


Thank you so much in advance!


-Wayne

Reply all
Reply to author
Forward
0 new messages