我试图找到一种方法将我们的安全解决方案从WildFly 22迁移到WildFly 26,在那里不再支持带有自定义登录模块的遗留方式。例如,我发现这篇博客文章https://wildfly-security.github.io/wildfly-elytron/blog/jaas-realm/建议使用jaas-领域,但我无法将其配置为诚实。
如果我想迁移这个例子,我应该做什么呢?这在WildFly的早期版本中是这样定义的:
<security-domain name="my-form-auth" cache-type="default">
<authentication>
<login-module name="FirstLoginModule" code="my.first.lm.FirstLoginModule" flag="sufficient">
<module-option name="config.filename" value=".first_lm_props" />
</login-module>
<login-module name="SecondLoginModule" code="my.second.lm.SecondLoginModule" flag="sufficient">
<module-option name="config.filename" value=".second_lm_props" />
</login-module>
</authentication>
</security-domain>WildFly可以使用这些登录模块的实际代码作为已部署应用程序的依赖项。
到目前为止,我设法像这样设置了WildFly 26的配置(使用基本场景--只有一个登录模块):
<security-domains>
...
<security-domain name="mySD" default-realm="myJaasRealm" permission-mapper="default-permission-mapper">
<realm name="myJaasRealm"/>
</security-domain>
</security-domains>
<security-realms>
...
<jaas-realm name="myJaasRealm" entry="myEntry" module="my.module.with.lm">
<file path="D:\APP\Wildfly\wildfly-26.0.1.Final\bin\elytron\JAAS-login-module.conf"/>
</jaas-realm>
</security-realms>
....
<http>
<http-authentication-factory name="example-loginconfig-http-auth" security-domain="mySD" http-server-mechanism-factory="global">
<mechanism-configuration>
<mechanism mechanism-name="FORM">
<mechanism-realm realm-name="myJaasRealm"/>
</mechanism>
</mechanism-configuration>
</http-authentication-factory>
</http>
....
<subsystem xmlns="urn:jboss:domain:undertow:12.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other" statistics-enabled="${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}}">
...
<application-security-domains>
<application-security-domain name="other" http-authentication-factory="example-loginconfig-http-auth"/>
</application-security-domains>
</subsystem>JAAS-登录-module.conf:
MyEntry {
my.first.lm.FirstLoginModule sufficient;
};JBos-web.xml:
<jboss-web>
<context-root>${context-root}</context-root>
<security-domain>other</security-domain>
</jboss-web>尽管如此,我还是无法让它发挥作用。
发布于 2022-11-15 11:10:58
<jboss-web>
<context-root>${context-root}</context-root>
<security-domain>mySD</security-domain>
</jboss-web>在web.xml中,您还必须配置您的领域名称,如
<login-config>
<auth-method>FORM</auth-method>
<realm-name>myJaasRealm</realm-name>
</login-config>https://stackoverflow.com/questions/73947956
复制相似问题