Another issue regarding your comments on which handlers are used I recommend not using dependencies of handlers you are customizing. i.e with jdbc dont use jdbc-support dependency as this is going to setup Cas jdbc implementation. That is why you use order as one of your handlers constructor parameter, which is telling cas in which order you want to use handlers.
2017-12-11 20:29 GMT-03:00 Man H <[email protected]>: > Hi > > > > 1. Could you enable debug in log to see if at startup of cas your > registered handler is beeing configured.? > > 2. You can also debug your code in order to see if it is beeing reached. > > My cas is deployed on tomcat. > > > > > > > > 2017-12-11 16:54 GMT-03:00 noumann.f <[email protected]>: > >> Hi, >> >> I'd already registered my configuration class like described in the >> article here: >> https://apereo.github.io/2017/02/02/cas51-authn-handlers/#st >> ep-2-register-authentication-handlers >> >> and here is my version: >> src/ >> └── main >> ├── java >> │ └── org >> │ └── custom >> │ ├── config >> │ │ └── CustomFileAuthenticationEventE >> xecutionPlanConfiguration.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]>: >>> >>> 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(Custom >>> FileAuthenticationEventExecutionPlanConfiguration.class); >>> >>> @Autowired(required = false) >>> @Qualifier("customFilePasswordPolicyConfiguration") >>> private PasswordPolicyConfiguration customFilePasswordPolicyConfig >>> uration; >>> >>> @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(customFilePasswordPolicyCon >>> figuration); >>> } >>> 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(cust >>> omFileAuthenticationHandler(), 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]. >>> To view this discussion on the web visit https://groups.google.com/a/ap >>> ereo.org/d/msgid/cas-user/2b3377eb-0d7d-4e63-bd09-36d6432c2a >>> 2d%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/ap >> ereo.org/d/msgid/cas-user/83f09f35-9085-4170-9ae0-bcf8bdd4e6 >> d6%40apereo.org >> <https://groups.google.com/a/apereo.org/d/msgid/cas-user/83f09f35-9085-4170-9ae0-bcf8bdd4e6d6%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/CAMY5mieeebin_0v8CFkASbxE3OLU19tuq%2Bd5KTq_eYezG28OuA%40mail.gmail.com.
