第 4 章 Elytron 子系统示例方案
4.1. 来自 Box 复制链接链接已复制到粘贴板!
默认情况下,JBoss EAP 提供预配置的组件:
- ApplicationDomain
-
ApplicationDomain
安全域使用ApplicationRealm
和groups-to-roles
进行身份验证。它还使用default-permission-mapper
来分配登录权限。 - ApplicationRealm
-
ApplicationRealm 安全
域是一个属性域,它使用application-users.properties
验证主体,并使用application-roles.properties
分配角色。这些文件位于jboss.server.config.dir
下,默认情况下,该文件映射到EAP_HOME/standalone/configuration
。它们也是与传统安全默认配置使用的相同文件。 - application-http-authentication
-
application-http-authentication
http-authentication-factory 可用于通过 HTTP 进行身份验证。它使用全局
provider-http-server-mechanism-factory 来过滤身份验证机制,并使用ApplicationDomain
验证主体。它接受BASIC
和FORM
验证机制,并将BASIC
作为Application Realm
公开给应用。 - application-sasl-authentication
-
application-sasl-authentication
sasl-authentication-factory 可用于使用 SASL 进行身份验证。它使用配置的
sasl-server-factory 来过滤身份验证机制,这也使用全局
provider-sasl-server-factory 按提供程序名称进行过滤。application-sasl-authentication
使用ApplicationDomain
安全域来验证主体。 - 已配置(configurable-sasl-server-factory)
-
这用于根据机制名称过滤
sasl-authentication-factory
。在这种情况下,配置 将与
JBOSS-LOCAL-USER
和DIGEST-MD5
匹配。它还将wildfly.sasl.local-user.default-user.default-user
设置为$local
。 - default-permission-mapper
default-permission-mapper
是一个简单的权限映射器,使用default-permissions
权限集来分配身份访问服务器上任何服务所需的全部权限集。例如,
default-permission-mapper
使用org.wildfly.extension.batch.jberet.deployment
权限设置来为批处理作业分配权限。批处理权限为 start、stop、restart、wap 和 read,它与.
BatchPermissionjavax.batch.operations.JobOperator
一致。default-permission-mapper
还使用org.wildfly.security.auth.permission.LoginPermission
(由登录权限集指定的)
来分配登录权限。- elytron (mechanism-provider-filtering-sasl-server-factor)
-
这用于根据提供程序过滤使用
sasl-authentication-factory
。在本例中,elytron
将匹配WildFlyElytron
提供程序名称。 - global(provider-http-server-mechanism-factory)
- 这是用于在创建 HTTP 身份验证工厂时列出受支持的身份验证机制的 HTTP 服务器工厂机制定义。
- global(provider-sasl-server-factory)
- 这是用于创建 SASL 身份验证工厂的 SASL 服务器工厂定义。
- groups-to-roles
-
groups-to-roles
mapper 是一个 simple-role-decoder,它将解码主体的组
信息并将其用于角色
信息。 - 本地(映射程序)
-
本地
映射器是一个固定角色映射器,映射到本地
安全域。这用于将身份验证映射到本地
安全域。 - 本地(安全域)
-
本地
安全域不进行身份验证,并将主体的身份设置为$local
。 - ManagementDomain
-
ManagementDomain
安全域使用两个安全域进行身份验证:ManagedRealm
和groups-to-roles
,并通过超级用户映射器
local
。它还使用default-permission-mapper
来分配登录权限。 - ManagementRealm
-
ManagementRealm 安全
域是一个属性域,它使用mgmt-users.properties
验证主体并分配使用mgmt-roles.properties
的角色。这些文件位于jboss.server.config.dir
下,默认情况下,该文件映射到EAP_HOME/standalone/configuration
。它们也是与传统安全默认配置使用的相同文件。 - management-http-authentication
-
management-http-authentication
http-authentication-factory 可用于通过 HTTP 进行身份验证。它使用全局
provider-http-server-mechanism-factory 来过滤身份验证机制,并使用ManagementDomain
验证主体。它接受DIGEST
身份验证机制,并将它作为ManagementRealm
公开给应用。 - management-sasl-authentication
-
management-sasl-authentication
sasl-authentication-factory 可用于使用 SASL 进行身份验证。它使用配置的
sasl-server-factory 来过滤身份验证机制,这也使用全局
provider-sasl-server-factory 按提供程序名称进行过滤。management-sasl-authentication
使用ManagementDomain
安全域对主体进行身份验证。它还利用本地
域映射器来映射使用JBOSS-LOCAL-USER
机制的身份验证,并使用DIGEST-MD5 向
ManagementRealm
进行身份验证。 - super-user-mapper
-
super-user-mapper
映射程序是一个恒定角色映射器,可将SuperUser
角色映射到一个主体。
4.1.1. 安全性 复制链接链接已复制到粘贴板!
为了保证应用安全,JBoss EAP 附带了预配置 application-http-authentication
,用于使用 SASL 使用 HTTP 和 application-sasl-authentication
。application-http-authentication
http-authentication-factory 使用 ApplicationDomain
,它使用 ApplicationRealm
和 groups-to-roles
进行身份验证。ApplicationRealm
是一个由 application- users.properties 和
(用户名、密码和角色信息)支持的 properties-realm。
application-roles.properties
为了保护管理接口,JBoss EAP 附带了用于 HTTP 的 management-http-authentication
的预配置,以及 SASL 的 management-sasl-authentication
。management-http-authentication
http-authentication-factory 使用 ManagementDomain
,它使用 ManagementRealm
和 groups-to-roles
进行身份验证。ManagementRealm
是一个由mgmt- users.properties 和
(用户名、密码和角色信息)支持的 properties-realm。mgmt-roles.properties
management-sasl-authentication
sasl-authentication-factory 使用 ManagementDomain
,它使用 local 进行
JBOSS-LOCAL-USER
身份验证,以及 ManagementRealm
进行 DIGEST-MD5
身份验证。
4.1.2. 它如何工作 复制链接链接已复制到粘贴板!
默认情况下,没有 JBoss EAP 的用户,但本例中添加了以下用户:
username | 密码 | 角色 | Security Realm |
---|---|---|---|
Susan | 测试123! | ManagementRealm | |
Sarah | 测试123! | 示例 | ApplicationRealm |
Frank | 测试123! | ApplicationRealm |
启动时,JBoss EAP 实例加载所有四个身份验证工厂及其关联的安全域、安全域和其他配置的组件。
如果任何人都尝试使用 JBOSS-LOCAL-USER
通过管理 CLI 访问管理界面,换句话说,从与 JBoss EAP 实例相同的主机运行管理 CLI,用户将被定向到 management-sasl-authentication
sasl-authentication-factory,它将尝试使用 本地
安全域通过 ManagementDomain
验证用户身份。
如果 Susan 尝试从其他主机使用管理 CLI 访问管理接口,她将使用带有 SASL 的 DIGEST-MD5
身份验证机制。她将被定向到 management-sasl-authentication
sasl-authentication-factory,它将尝试使用 Management
验证用户。
Realm 安全域通过 Management
Domain
如果 Susan 尝试使用基于 Web 的管理控制台访问管理界面,她将使用带有 HTTP 的 DIGEST
身份验证机制。她将被定向到 management-http-authentication
http-authentication-factory,它将尝试使用 Management
验证用户。
Realm 安全域通过 Management
Domain
应用 sampleApp1.war
有两个 HTML 文件,/hello.html
和 /secure/hello.html
,并使用 BASIC
HTTP 身份验证来保护路径 /secure/*
。它使用 Application Realm
,它需要 sample
的角色。当用户尝试访问 sampleApp1.war
时,它们将定向到 application-http-authentication http-
authentication-factory。它将尝试使用 Application Realm 安全域通过
验证用户。
Application
Domain
当 Sarah 请求 /hello.html
时,她可以查看页面而不进行身份验证。当 Sarah 尝试请求 /secure/hello.html
时,系统会提示她输入其用户名和密码。成功登录后,她能够查看 /secure/hello.html
。Frank 和 Susan 或任何用户都可以访问 /hello.html
,但不能访问 /secure/hello.html
。Frank 没有 示例
角色,Susan 不在 ApplicationRealm 安全
域中。