WebSphere Liberty 中 Jboss EJb3 注释 @SecurityDomain("") 和 WebSphere 注释 @Webcontext 的等效注释是什么

问题描述 投票:0回答:1

我将 Jboss 应用程序迁移到 WebSphere Liberty。我必须删除所有 Jboss 参考库。在这样做的同时,我在某些注释中面临问题。使用

@SecurityDomain("Authentication")
@Webcontext
的 Jboss 应用程序这两个注释在 WebSphere Liberty 中的等效注释是什么。

java jboss websphere-liberty
1个回答
2
投票

根据您的要求(如果省略,则有一些默认值),您可能希望在

web.xml
中包含以下内容:

1)安全约束,描述应用程序的资源并映射到角色,例如

<security-constraint>
    <web-resource-collection>
      <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>testing</role-name>
    </auth-constraint>
 </security-constraint>

2)安全角色定义(尽管也可以通过注释来完成

@DeclareRoles

<security-role>
    <role-name>testing</role-name>
 </security-role> 

3)登录配置,当需要表单登录时使用(如果省略则默认为Basic):

<login-config>
    <auth-method>BASIC</auth-method>
 </login-config> 

然后在 Liberty 中配置用户注册表。如果需要,您可以使用基于文件的、LDAP 或自定义的。

server.xml
配置取决于所使用的注册表类型。最后,您需要将用户绑定到安全角色。它太宽泛,无法在此处包含所有选项,因此只需添加相关链接即可。 (如果需要,为更详细的问题创建单独的问题)。

有用的链接:

© www.soinside.com 2019 - 2024. All rights reserved.