2.7. 覆盖应用的身份验证配置
您可以使用在 JBoss EAP 中配置的应用,覆盖应用的身份验证配置。要做到这一点,使用 undertow 子系统的 application 属性:
-security-domain 部分中的 override- deployment-configuration
/subsystem=undertow/application-security-domain=exampleApplicationDomain:write-attribute(name=override-deployment-config,value=true)
注意
可以通过导航到 Configuration → Subsystems → Web(Under tow )→ Application Security Domain,使用管理控制台配置 undertow 子系统中的 application-security-domain。
例如,应用已配置为使用 FORM 身份验证 及其 jboss-web.xml 中的 exampleApplicationDomain。
jboss-web.xml示例
<login-config> <auth-method>FORM</auth-method> <realm-name>exampleApplicationDomain</realm-name> </login-config>
通过启用 覆盖部署配置, 您可以创建一个新的 http-authentication-factory,以指定不同的身份验证机制,如 BASIC 或 DIGEST。
http-authentication-factory示例
/subsystem=elytron/http-authentication-factory=exampleHttpAuth:read-resource()
{
"outcome" => "success",
"result" => {
"http-server-mechanism-factory" => "global",
"mechanism-configurations" => [{
"mechanism-name" => "BASIC",
"mechanism-realm-configurations" => [{"realm-name" => "exampleApplicationDomain"}]
}],
"security-domain" => "exampleSD"
}
}
这将覆盖应用的 jboss-web.xml 中定义的身份验证机制,并尝试使用 BASIC 而不是 FORM 验证用户 。