我们计划从 Picketbox 迁移到 Elytron 并面临以下问题:
使用 Picketbox,自定义登录模块可以使用(甚至可以驻留在)部署模块(例如 wildfly/standalone/deployments 中的 EAR)的功能在服务器端实现身份验证:
<subsystem xmlns="urn:jboss:domain:security:2.0">
<security-domains>
...
<security-domain name="MyDomain" cache-type="default">
<authentication>
<login-module name="MyLoginModule" code="de.example.wildfly.MyLoginModule" flag="required" module="deployment.de.example.wildfly.login"/>
</authentication>
</security-domain>
我的第一次尝试是在 Elytron 中使用自定义领域。但据我了解,自定义领域需要是“静态”模块(意味着它位于 wildfly/modules/... 下),因此无法访问“动态”部署的模块(请参阅https://developer.jboss .org/message/984198#984198)。
<subsystem xmlns="urn:wildfly:elytron:7.0" final-providers="combined-providers" disallowed-providers="OracleUcrypto">
...
<security-domains>
<security-domain name="MyDomain" default-realm="MyRealm" permission-mapper="default-permission-mapper">
<realm name="MyRealm" role-decoder="from-roles-attribute" />
</security-domain>
</security-domains>
<security-realms>
...
<custom-realm name="MyRealm" module="de.example.wildfly.login" class-name="de.example.wildfly.MyCustomRealm" />
(我省略了更多的安全域配置)
当我尝试在 MyCustomRealm 中加载 Spring 上下文(位于 EAR 中以便从 EAR 访问一些自定义类)时,我收到以下错误:
org.springframework.beans.factory.access.BootstrapException: Unable to initialize group definition. Group resource name [classpath:applicationContext-appServerBase.xml], factory key [applicationContextEjb]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext-appServerBase.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext-appServerBase.xml] cannot be opened because it does not exist
这并不奇怪,因为我的领域不依赖于应用程序上下文所在的耳朵或其中的任何罐子。
如何使用 Elytron 中部署模块 (EAR) 中的类在服务器端自定义身份验证(特别是针对 EJB 调用)?