首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在Jakarta应用程序中激活我自己的雅加达HttpAuthenticationMechanism实现

如何在Jakarta应用程序中激活我自己的雅加达HttpAuthenticationMechanism实现
EN

Stack Overflow用户
提问于 2022-05-20 17:13:20
回答 1查看 129关注 0票数 2

我正在创建一个简单的雅加达EE 9应用程序。由于我自己的原因,我必须实现我自己的HttpAuthenticationMechanism (我没有使用内置的HttpAuthenticationMechanism CDI )。

我有一个问题,激活我自己的HttpAuthenticationMechanism。在我的登录servlet中,我尝试调用SecurityContext.authenticate(请求、响应、AuthenticationParameters)手动处理登录,,但我自己的HttpAuthenticationMechanism从未被调用。它应该叫做.

我自己的HttpAuthenticationMechanism &它的注释

代码语言:javascript
运行
复制
@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.

我的环境:

  • 雅加达EE 9.1
  • 野外飞行26预览雅加达EE 9
  • 我还改变了集成JASPI从上到关野蝇。
  • 我的jboss-web.xml:< security-domain>jaspitest< /security>
  • Java 11

有帮助吗?谢谢你!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-05-23 14:21:49

,我发现出了什么问题。野生蝇26中没有安全域“jaspitest”。默认情况下,此安全域在Wildfly中存在,但不再存在。这就是为什么我自己的HttpAuthenticationMechanism没有被调用的原因。

解决方案:使用安全域'other'代替,或者从jboss-web.xml或您自己的安全域中删除安全域标记

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72322565

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档