如何在雅加达EE应用程序中激活我自己的雅加达httpauthentication mechanism
我正在创建一个简单的 Jakarta EE 9 应用程序。由于我自己的原因,我必须实施自己的httpauthenticationmechanism(我不使用https://jakarta.ee/speciciations/platform/9/apidocs/jakarta/jakarta/security/security/security/enterprise/authentication/机制/http/httpauthentication mechanism“ rel =“ nofollow noreferrer”> httpauthenticationmechanism cdi beans)。
我在激活自己的httpauthenticationmnation机构方面存在问题。 In my login servlet, I try to call
我自己的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
}
}
,我已经添加了@alternative和 @priority来激活豆。
我的环境:
- jakarta ee 9.1
- Wildfly 26雅加达EE 9预览9
- 我还将集成的jaspi 从野生蝇上的On上更改为OFF。
- 我的jboss-web.xml:<安全域> jaspitest < /security-domain>
- Java 11
有帮助吗?谢谢!
I am creating an simple Jakarta EE 9 app. Because of my own reason, I have to implement my own HttpAuthenticationMechanism (I am not using built-in HttpAuthenticationMechanism CDI beans).
I am having an issue with activating my own HttpAuthenticationMechanism. In my login servlet, I try to call SecurityContext.authenticate(request, response, AuthenticationParameters) to process a login manually, 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:
- Jakarta EE 9.1
- Wildfly 26 preview for Jakarta EE 9
- I also changed Integrated JASPI from ON to OFF on the Wildfly.
- my jboss-web.xml: < security-domain>jaspitest< /security-domain>
- Java 11
Any helps? Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了什么问题。 Wildfly 26中没有安全域“ Jaspitest”。默认情况下,Wildfly中存在此安全域,但不再存在。这就是为什么我自己的httpauthenticationmnation机构没有被调用的原因。
解决方案:使用安全域'其他',或从jboss-web.xml或您自己的安全域中删除安全域标签
I found out what was wrong. There was NO security domain 'jaspitest' in Wildfly 26. This security domain existed in Wildfly before by default, but no longer exists. That was the reason why my own HttpAuthenticationMechanism did not get invoked.
Solution: Use Security Domain 'other' instead, OR remove the security-domain tag from jboss-web.xml, OR your own security domain