我在使用CAS 6.0.x时遇到了阻塞问题,无法克服。我无法使用UsernamePasswordCredential登录。我什至删除了所有实际的支票,只返回了一个凭证。
这是粗俗的话
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]>
这不起作用,我在做什么错?候选人/已注册,已排序/已注册和处理程序解析器之间有什么区别?
我的自定义类仅在第一阶段出现的行为,使我认为我配置了错误的内容。
有什么想法吗?