我正在创建一个简单的雅加达EE 9应用程序。由于我自己的原因,我必须实现我自己的HttpAuthenticationMechanism (我没有使用内置的HttpAuthenticationMechanism CDI )。
我有一个问题,激活我自己的HttpAuthenticationMechanism。在我的登录servlet中,我尝试调用SecurityContext.authenticate(请求、响应、AuthenticationParameters)手动处理登录,,但我自己的HttpAuthenticationMechanism从未被调用。它应该叫做.
我自己的HttpAuthenticationMechanism &它的注释
@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
}
}正如您所看到的,我已经添加了“和”优先级来激活bean.
我的环境:
有帮助吗?谢谢你!
发布于 2022-05-23 14:21:49
,我发现出了什么问题。野生蝇26中没有安全域“jaspitest”。默认情况下,此安全域在Wildfly中存在,但不再存在。这就是为什么我自己的HttpAuthenticationMechanism没有被调用的原因。
解决方案:使用安全域'other'代替,或者从jboss-web.xml或您自己的安全域中删除安全域标记
https://stackoverflow.com/questions/72322565
复制相似问题