У меня возникла блокирующая ситуация с CAS 6.0.x, и я не могу ее преодолеть.Я не могу войти с именем пользователяPasswordCredential.Я даже удалил все фактические проверки и просто вернул учетные данные.
Вот код:
public class MyDatabaseAuthenticationHandler extends AbstractJdbcUsernamePasswordAuthenticationHandler {
public MyDatabaseAuthenticationHandler(String name, ServicesManager servicesManager, PrincipalFactory principalFactory, Integer order, DataSource dataSource) {
super(name, servicesManager, principalFactory, order, dataSource);
}
@Override
protected AuthenticationHandlerExecutionResult authenticateUsernamePasswordInternal(UsernamePasswordCredential credential, String originalPassword) throws GeneralSecurityException, PreventedException {
return createHandlerResult(credential, this.principalFactory.createPrincipal(username), null);
}
@Override
public boolean supports(final Credential credential) {
return true;
}
}
Вот мой конфиг:
@Configuration("My6CasConfiguration")
public class My6CasConfiguration implements AuthenticationEventExecutionPlanConfigurer {
@Autowired
@Qualifier("principalFactory")
private PrincipalFactory principalFactory;
@Bean
public AuthenticationHandler getMyJdbcAuthenticationHandler() {
return new MyDatabaseAuthenticationHandler("MYJDBCAuthenticationManager",
servicesManager,
principalFactory,
0,
customDataSource());
}
@Override
public void configureAuthenticationExecutionPlan(AuthenticationEventExecutionPlan plan) {
plan.registerAuthenticationHandler(getMyJdbcAuthenticationHandler());
}
}
Эточто я получаю в логах:
[36m2019-06-02 11:07:38,544 DEBUG [org.apereo.cas.authentication.DefaultAuthenticationEventExecutionPlan] - <Candidate/Registered authentication handlers for this transaction are [[org.apereo.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler@277fd34b, com.xxx.cas.handler.MyDatabaseAuthenticationHandler@58b0ac93, org.apereo.cas.adaptors.x509.authentication.handler.support.X509CredentialsAuthenticationHandler@41078c16]]>^[[m
[[36m2019-06-02 11:07:38,544 DEBUG [org.apereo.cas.authentication.DefaultAuthenticationEventExecutionPlan] - <Sorted and registered authentication handler resolvers for this transaction are [[org.apereo.cas.authentication.handler.ByCredentialSourceAuthenticationHandlerResolver@663cfaa1, org.apereo.cas.authentication.handler.RegisteredServiceAuthenticationHandlerResolver@272f62cc]]>^[[m
[[36m2019-06-02 11:07:38,545 DEBUG [org.apereo.cas.authentication.DefaultAuthenticationEventExecutionPlan] - <Authentication handler resolvers for this transaction are [[org.apereo.cas.authentication.handler.ByCredentialSourceAuthenticationHandlerResolver@663cfaa1, org.apereo.cas.authentication.handler.RegisteredServiceAuthenticationHandlerResolver@272f62cc]]>^[[m
[[1;31m2019-06-02 11:07:38,549 ERROR [org.apereo.cas.authentication.PolicyBasedAuthenticationManager] - <Authentication has failed. Credentials may be incorrect or CAS cannot find authentication handler that supports [UsernamePasswordCredential(username=asdf, source=MYJDBCAuthenticationManager)] of type [UsernamePasswordCredential]. Examine the configuration to ensure a method of authentication is defined and analyze CAS logs at DEBUG level to trace the authentication event.>^[[m
[[1;31m2019-06-02 11:07:38,550 ERROR [org.apereo.cas.authentication.PolicyBasedAuthenticationManager] - <[MYJDBCAuthenticationManager]: [warnings is marked @NonNull but is null]>
Что я делаю не так, что это не работает?И в чем разница между кандидатами / зарегистрированными, отсортированными / зарегистрированными и обработчиками обработчиков?
То, что мой пользовательский класс появляется только в первом, заставляет меня думать, что я что-то настроил неправильно.
Есть идеи?