Keycloak 1.9.1-Final
我实现了以下自定义FormActionFactory。
public class RegistrationFormActionFactory implements FormActionFactory{
public static final String PROVIDER_ID = "rc-registration-profile-action";
@Override
public FormAction create(KeycloakSession session){
return new RegistrationFormAction();
}
@Override
public String getDisplayType(){
return "RC Profile Validation";
}
...
关联的FormAction在org.keycloak.authentication.forms.RegistrationProfile
之后建模public class RegistrationFormAction implements FormAction{
...
在jar的META-INF / services中我有一个文件: org.keycloak.authentication.FormActionFactory
仅包含以下文字:
com.realcomp.keycloak.RegistrationFormActionFactory
在Keycloak管理页面中,我制作了 Registration 身份验证流程的副本,并将其命名为注册副本。在我的新流程中添加执行时,我会看到我的自定义" RC配置文件验证" FormAction在可用提供程序的下拉列表中。选中后,我在Keycloak服务器日志中收到以下异常:
14:31:00,264 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-54) RESTEASY002005: Failed executing POST /admin/realms/master/authentication/flows/Copy of registration registration form/executions/execution: org.jboss.resteasy.spi.BadRequestException: No authentication provider found for id: rc-registration-profile-action
at org.keycloak.services.resources.admin.AuthenticationManagementResource.addExecution(AuthenticationManagementResource.java:394)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
(omitted...)
有趣的附注:如果我将FormActionFactory中的PROVIDER_ID更改为" registration-profile-action "一切都按预期工作。但是,这个PROVIDER_ID由RegistrationProfile类使用并且感觉不对。
我增加了日志记录详细程度,看起来我的FormAction 正在加载:
17:07:20,659 DEBUG [org.keycloak.services] (ServerService Thread Pool -- 50) Loaded SPI form-action (providers = [registration-profile-action, rc-registration-profile-action, registration-recaptcha-action, registration-password-action, registration-user-creation])
我可能错过了一些配置步骤。我在这里做错了什么想法?