我正在创建一个简单的Jakarta EE 9应用程序.由于我自己的原因,我必须实现自己的HttpAuthenticationMechanism(我没有使用内置的HttpAuthenticationMechanism个CDIBean).
我在激活自己的HttpAuthenticationMechanism时遇到问题.在我的登录servlet中,我try 调用SecurityContext.authenticate(request, response, AuthenticationParameters)来手动处理登录,but my own HttpAuthenticationMechanism never get called. It was supposed to be called.
My own HttpAuthenticationMechanism & its annotations
@ApplicationScoped
@Alternative
@jakarta.annotation.Priority(jakarta.interceptor.Interceptor.Priority.APPLICATION)
@AutoApplySession
public class MyOwnHttpAuthenticationMechanism implements HttpAuthenticationMechanism {
@Override
public AuthenticationStatus validateRequest(HttpServletRequest request, HttpServletResponse response, HttpMessageContext httpMessageContext)
throws AuthenticationException {
// Never called
}
}
As you see, I already added @Alternative and @Priority to activate the bean.
My environment:
- 雅加达EE 9.1
- Wildfly 26雅加达EE 9预览
- 我还在Wildfly上把Integrated JASPI从开改为关.
- 我的jboss网站.xml:<;安全域(&T);jaspitest</安全域(&T);
- Java 11
Any helps? Thank you!