intellij-idea - 使用 WildFly 的 Java EE 7 EJB 身份验证 - 安全注释不起作用
问题描述
我正在尝试使用 wildfly 18.0.1 建立一个安全域。这些是我使用的设置:
独立的.xml:
<security-domain name="my-security-domain" cache-type="default">
<authentication>
<login-module code="UsersRoles" flag="required">
<module-option name="usersProperties" value="users.properties"/>
<module-option name="rolesProperties" value="roles.properties"/>
</login-module>
</authentication>
</security-domain>
我使用 add-user.bat 创建了用户并创建了文件:users.properties 和 roles.properties,其中填充了创建的用户数据。
IntelliJ 似乎无法识别安全注释,我无法导入它们:
@Stateless
@WebService(name = "HelloWorldType", portName = "HelloWorldPort", targetNamespace = "https://soap.soa.pl/lab1/ws")
@SecurityDomain("my-security-domain") // in standalone.xml
@DeclareRoles({"MyRole"})
@WebContext(contextRoot="lab1", urlPattern="/HelloWorld", authMethod="BASIC", transportGuarantee="NONE")
@SOAPBinding(style=SOAPBinding.Style.DOCUMENT, use=SOAPBinding.Use.LITERAL)
public class HelloWorld {
@WebMethod()
@RolesAllowed("MyRole")
public String sayHello(@WebParam(name = "message") String message) {
return "Here is the message: '" + message + "'";
}
}
另外,现在我无法启动wildfly serwer:
18:49:25,854 INFO [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 18.0.1.Final (WildFly Core 10.0.3.Final) starting
18:49:26,643 INFO [org.wildfly.security] (ServerService Thread Pool -- 25) ELY00001: WildFly Elytron version 1.10.4.Final
18:49:27,227 INFO [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/core-service=management/management-interface=http-interface' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
18:49:27,256 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 13) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/subsystem=undertow/server=default-server/https-listener=https' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
18:49:27,321 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "lab1-ear.ear")]) - failure description: "WFLYSRV0137: No deployment content with hash 5cddb572897ba715135a11fe8d8c7c56f30099b5 is available in the deployment content repository for deployment 'lab1-ear.ear'. This is a fatal boot error. To correct the problem, either restart with the --admin-only switch set and use the CLI to install the missing content or remove it from the configuration, or remove the deployment from the xml configuration file and restart."
18:49:27,326 FATAL [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
18:49:27,337 INFO [org.jboss.as] (MSC service thread 1-7) WFLYSRV0050: WildFly Full 18.0.1.Final (WildFly Core 10.0.3.Final) stopped in 7ms
我不知道为什么,尤其是注释不起作用..请帮忙。
解决方案
您需要找到提供这些注释类的 jar 文件并将其添加到Module Dependencies。
如果您的项目是 Gradle 或 Maven 管理的,请将依赖项添加到build.gradle
/ pom.xml
。
推荐阅读
- flutter - 当设备在 Flutter 中解锁时如何运行我的应用程序
- amazon-web-services - 根据数字顺序从 DynamoDB 获取数据
- r - Shiny App的变化不停
- c++ - 取消引用指针如何更改此代码段中的值?
- php - 未捕获的错误:找不到类“Google_Client”
- webpack - 如何使用 CSS 文件修复 Storybook Webpack 错误
- python - 如何在不需要 *any* __init__.py 的情况下指定 setup.py 并使用查找包?
- javascript - 使用 window.scrollTo({top: 50}) 与 window.scrollTo(0, 50) 有区别吗?
- c# - 在 C# 中使用相同的数据返回上一个表单
- visual-studio-2019 - NuGet System.Windows.Forms.DataVisualization 包之间的差异