To read custom config, you need to create a configuration properties file. See
org.apereo.cas.configuration.CasConfigurationProperties for ideas. Ray On Mon, 2017-12-11 at 11:54 -0800, noumann.f wrote: Hi, I'd already registered my configuration class like described in the article here: https://apereo.github.io/2017/02/02/cas51-authn-handlers/#step-2-register-authentication-handlers and here is my version: src/ └── main ├── java │ └── org │ └── custom │ ├── config │ │ └── CustomFileAuthenticationEventExecutionPlanConfiguration.java │ └── CustomFileAuthenticationHandler.java └── resources └── META-INF └── spring.factories in the spring.factories I put: org.springframework.boot.autoconfigure.EnableAutoConfiguration=org.custom.CustomFileAuthenticationEventExecutionPlanConfiguration On Monday, December 11, 2017 at 5:10:48 PM UTC+2, robertoschwald wrote: 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/ Am 11.12.2017 um 15:57 schrieb noumann.f <[email protected]<javascript:>>: 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 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 - 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]<javascript:>. 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>. -- Ray Bon Programmer analyst Development Services, University Systems 2507218831 | CLE 019 | [email protected] -- - 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/1513033948.12203.9.camel%40uvic.ca.
