By default, CAS scans only the org.apereo.cas.config package, so you config bean is not picked up. You can either move the config bean to the org.apereo.cas.config package, or you register your Config bean. See https://apereo.github.io/2017/02/21/cas-autocfg-strategy/ <https://apereo.github.io/2017/02/21/cas-autocfg-strategy/>
> Am 11.12.2017 um 15:57 schrieb noumann.f <[email protected]>: > > The registration class in the previous post isn't complete, here it is: > > Registration class: > package org.custom; > > // imports copied from the original code > > > @Configuration("customFileAuthenticationEventExecutionPlanConfiguration") > @EnableConfigurationProperties(CasConfigurationProperties.class) > public class CustomFileAuthenticationEventExecutionPlanConfiguration > implements AuthenticationEventExecutionPlanConfigurer { > private static final Logger LOGGER = > LoggerFactory.getLogger(CustomFileAuthenticationEventExecutionPlanConfiguration.class); > > @Autowired(required = false) > @Qualifier("customFilePasswordPolicyConfiguration") > private PasswordPolicyConfiguration customFilePasswordPolicyConfiguration; > > @Autowired > @Qualifier("servicesManager") > private ServicesManager servicesManager; > > @Autowired > private CasConfigurationProperties casProperties; > > @Autowired > @Qualifier("personDirectoryPrincipalResolver") > private PrincipalResolver personDirectoryPrincipalResolver; > > > @ConditionalOnMissingBean(name = "filePrincipalFactory") > @Bean > public PrincipalFactory filePrincipalFactory() { > return new DefaultPrincipalFactory(); > } > > @RefreshScope > @Bean > public AuthenticationHandler customFileAuthenticationHandler() { > final FileAuthenticationProperties fileProperties = > casProperties.getAuthn().getFile(); > final FileAuthenticationHandler h = new > FileAuthenticationHandler(fileProperties.getName(), servicesManager, > filePrincipalFactory(), > fileProperties.getFilename(), fileProperties.getSeparator()); > > > h.setPasswordEncoder(Beans.newPasswordEncoder(fileProperties.getPasswordEncoder())); > if (customFilePasswordPolicyConfiguration != null) { > > h.setPasswordPolicyConfiguration(customFilePasswordPolicyConfiguration); > } > > h.setPrincipalNameTransformer(Beans.newPrincipalNameTransformer(fileProperties.getPrincipalTransformation())); > > return h; > } > > @Override > public void configureAuthenticationExecutionPlan(final > AuthenticationEventExecutionPlan plan) { > if (casProperties.getAuthn().getFile().getFilename() != null) { > LOGGER.debug("zzz Added file-based authentication handler"); > > plan.registerAuthenticationHandlerWithPrincipalResolver(customFileAuthenticationHandler(), > personDirectoryPrincipalResolver); > } > } > } > > > > cas.properites file > > #File Authentication > ################################################## > cas.authn.file.separator=:: > cas.authn.file.filename=file:///etc/cas/usersfile > cas.authn.file.name=usersfile > > ... > > cas.authn.policy.requiredHandlerAuthenticationPolicyEnabled=true > cas.authn.policy.req.tryAll=false > cas.authn.policy.req.handlerName=CustomFileAuthenticationHandler > cas.authn.policy.req.enabled=true > > > > > On Wednesday, December 6, 2017 at 11:18:28 PM UTC+2, noumann.f wrote: > Hi, > > I need to create a custom JDBC authentication handler, I'd done this > previously with version 4.x but with new version 5.1.x things have changed !! > > I'm following the guide in here: > https://apereo.github.io/2017/02/02/cas51-authn-handlers > <https://apereo.github.io/2017/02/02/cas51-authn-handlers> > but I need more details about registering the new handler and how to create > special properties for it in the cas.properties and then reach them in the > code! > > Best regards, > > -- > - Website: https://apereo.github.io/cas <https://apereo.github.io/cas> > - Gitter Chatroom: https://gitter.im/apereo/cas <https://gitter.im/apereo/cas> > - List Guidelines: https://goo.gl/1VRrw7 <https://goo.gl/1VRrw7> > - Contributions: https://goo.gl/mh7qDG <https://goo.gl/mh7qDG> > --- > You received this message because you are subscribed to the Google Groups > "CAS Community" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/a/apereo.org/d/msgid/cas-user/2b3377eb-0d7d-4e63-bd09-36d6432c2a2d%40apereo.org > > <https://groups.google.com/a/apereo.org/d/msgid/cas-user/2b3377eb-0d7d-4e63-bd09-36d6432c2a2d%40apereo.org?utm_medium=email&utm_source=footer>. -- - Website: https://apereo.github.io/cas - Gitter Chatroom: https://gitter.im/apereo/cas - List Guidelines: https://goo.gl/1VRrw7 - Contributions: https://goo.gl/mh7qDG --- You received this message because you are subscribed to the Google Groups "CAS Community" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/5F5AD95F-8FC2-4B10-8322-384317EF3BAE%40gmail.com.
