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

What is equivalent annotation in WebSphere Liberty for Jboss EJb3 annotation @SecurityDomain("") and WebSphere annotation @Webcontext

我已将 Jboss 应用程序迁移到 WebSphere Liberty。我必须删除所有 Jboss 参考库。在这样做时,我在某些注释中面临问题。 Jboss 应用程序使用@SecurityDomain("Authentication") 和@Webcontext 对于这两个注释,WebSphere Liberty 中的等效注释是什么。

根据您的要求(如果省略,则有一些默认值),您可能希望在 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) 登录配置,当需要表单登录时使用(如果省略则默认为基本):

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

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

有用的链接: