使用多个身份存储保护应用程序和管理界面
通过组合多个身份存储(如文件系统、数据库、轻量级目录访问协议(LDAP)或自定义身份存储)来保护 JBoss EAP 管理界面和部署的应用程序的指南
摘要
提供有关 JBoss EAP 文档的反馈 复制链接链接已复制到粘贴板!
要报告错误或改进文档,请登录到 Red Hat JIRA 帐户并提交问题。如果您没有 Red Hat Jira 帐户,则会提示您创建一个帐户。
流程
- 单击以下链接 以创建 ticket。
- 在 Summary 中输入问题的简短描述。
- 在 Description 中提供问题或功能增强的详细描述。包括一个指向文档中问题的 URL。
- 点 Submit 创建问题,并将问题路由到适当的文档团队。
使开源包含更多 复制链接链接已复制到粘贴板!
红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。我们从这四个术语开始:master、slave、黑名单和白名单。由于此项工作十分艰巨,这些更改将在即将推出的几个发行版本中逐步实施。有关更多详情,请参阅我们的首席技术官 Chris Wright 提供的消息。
第 1 章 配置身份存储 复制链接链接已复制到粘贴板!
1.1. 创建聚合域 复制链接链接已复制到粘贴板!
1.1.1. Elytron 中的聚合域 复制链接链接已复制到粘贴板!
有了聚合域 aggregate-realm ,您可以对身份验证以及另一个安全域使用安全域,或对 Elytron 中的授权使用多个安全域的聚合。
例如,您可以将 aggregate-realm 配置为对身份验证使用 ldap-realm ,对授权使用 filesystem-realm 和 ldap-realm 的聚合。
在配置了多个授权域的聚合域中创建的一个身份,如下所示:
- 来自每个授权域的属性值被加载。
- 如果属性在多个授权域中定义,则将使用该属性第一次出现的值。
以下示例演示了当多个授权域包含同一身份属性的定义时身份是如何创建的。
聚合域配置示例
/subsystem=elytron/aggregate-realm=exampleSecurityRealm:add(authentication-realm=exampleLDAPRealm,authorization-realms=[exampleLDAPRealm,exampleFileSystemRealm])
/subsystem=elytron/aggregate-realm=exampleSecurityRealm:add(authentication-realm=exampleLDAPRealm,authorization-realms=[exampleLDAPRealm,exampleFileSystemRealm])
在示例中,配置的 aggregate-realm 引用两个现有的安全域:"exampleLDAPRealm",它是一个 LDAP 域,以及"exampleFilesystemRealm",它是文件系统域。
从 LDAP 域中获取的属性值:
mail: administrator@example.com telephoneNumber: 0000 0000
mail: administrator@example.com telephoneNumber: 0000 0000Copy to Clipboard Copied! Toggle word wrap Toggle overflow 从文件系统域中获取的属性值:
mail: user@example.com website: http://www.example.com/
mail: user@example.com website: http://www.example.com/Copy to Clipboard Copied! Toggle word wrap Toggle overflow
从聚合域中获取生成的身份:
mail: administrator@example.com telephoneNumber: 0000 0000 website: http://www.example.com/
mail: administrator@example.com
telephoneNumber: 0000 0000
website: http://www.example.com/
示例 aggregate-realm 使用 LDAP 域中定义的属性 mail 的值,因为 LDAP 域在文件系统域之前被引用。
1.1.2. 创建聚合域所需的安全域的示例 复制链接链接已复制到粘贴板!
以下示例演示了创建 ldap-realm 和 filesystem-realm。您可以在 aggregate-realm 中引用这些安全域。
1.1.2.1. 在 Elytron 示例中创建一个 ldap-realm 复制链接链接已复制到粘贴板!
创建由轻量级目录访问协议(LDAP)身份存储支持的 Elytron 安全域,来保护 JBoss EAP 服务器接口或在服务器上部署的应用程序。
对于此过程中的示例,使用了以下 LDAP 数据交换格式(LDIF):
用于示例的 LDAP 连接参数如下:
-
LDAP URL
:ldap://10.88.0.2 LDAP admin 密码:
secret您需要此内容来使 Elytron 与 LDAP 服务器连接。
-
LDAP admin 可分辨名称(DN):
(cn=admin,dc=wildfly,dc=org) LDAP 机构:
wildfly如果没有指定机构名称,则默认为
Example Inc。LDAP 域:
wildfly.org这是当平台收到 LDAP 搜索参考时匹配的名称。
先决条件
- 您已配置了一个 LDAP 身份存储。
- JBoss EAP 正在运行。
流程
配置一个提供 URL 的目录上下文,以及用于连接到 LDAP 服务器的主体。
/subsystem=elytron/dir-context=<dir_context_name>:add(url="<LDAP_URL>",principal="<principal_distinguished_name>",credential-reference=<credential_reference>)
/subsystem=elytron/dir-context=<dir_context_name>:add(url="<LDAP_URL>",principal="<principal_distinguished_name>",credential-reference=<credential_reference>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/dir-context=exampleDirContext:add(url="ldap://10.88.0.2",principal="cn=admin,dc=wildfly,dc=org",credential-reference={clear-text="secret"}) {"outcome" => "success"}/subsystem=elytron/dir-context=exampleDirContext:add(url="ldap://10.88.0.2",principal="cn=admin,dc=wildfly,dc=org",credential-reference={clear-text="secret"}) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建一个引用目录上下文的 LDAP 域。指定搜索基础 DN 以及用户的映射方式。
语法
/subsystem=elytron/ldap-realm=<ldap_realm_name>add:(dir-context=<dir_context_name>,identity-mapping=search-base-dn="ou=<organization_unit>,dc=<domain_component>",rdn-identifier="<relative_distinguished_name_identifier>",user-password-mapper={from=<password_attribute_name>},attribute-mapping=[{filter-base-dn="ou=<organization_unit>,dc=<domain_component>",filter="<ldap_filter>",from="<ldap_attribute_name>",to="<identity_attribute_name>"}]})/subsystem=elytron/ldap-realm=<ldap_realm_name>add:(dir-context=<dir_context_name>,identity-mapping=search-base-dn="ou=<organization_unit>,dc=<domain_component>",rdn-identifier="<relative_distinguished_name_identifier>",user-password-mapper={from=<password_attribute_name>},attribute-mapping=[{filter-base-dn="ou=<organization_unit>,dc=<domain_component>",filter="<ldap_filter>",from="<ldap_attribute_name>",to="<identity_attribute_name>"}]})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/ldap-realm=exampleLDAPRealm:add(dir-context=exampleDirContext,identity-mapping={search-base-dn="ou=Users,dc=wildfly,dc=org",rdn-identifier="uid",user-password-mapper={from="userPassword"},attribute-mapping=[{filter-base-dn="ou=Roles,dc=wildfly,dc=org",filter="(&(objectClass=groupOfNames)(member={1}))",from="cn",to="Roles"},{from="mail",to="mail"},{from="telephoneNumber",to="telephoneNumber"}]}) {"outcome" => "success"}/subsystem=elytron/ldap-realm=exampleLDAPRealm:add(dir-context=exampleDirContext,identity-mapping={search-base-dn="ou=Users,dc=wildfly,dc=org",rdn-identifier="uid",user-password-mapper={from="userPassword"},attribute-mapping=[{filter-base-dn="ou=Roles,dc=wildfly,dc=org",filter="(&(objectClass=groupOfNames)(member={1}))",from="cn",to="Roles"},{from="mail",to="mail"},{from="telephoneNumber",to="telephoneNumber"}]}) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
现在,您可以使用这个域来创建一个安全域,或与 failover-realm、distributed-realm 或 aggregate-realm 中的另一个域合并。
1.1.2.2. 在 Elytron 示例中创建一个 filesystem-realm 复制链接链接已复制到粘贴板!
创建一个由基于文件系统的身份存储支持的 Elytron 安全域,来保护 JBoss EAP 服务器接口或在服务器上部署的应用程序。
先决条件
- JBoss EAP 正在运行。
流程
在 Elytron 中创建一个
filesystem-realm。语法
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add(path=<file_path>)
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add(path=<file_path>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 将用户添加到域,并配置用户的角色。
添加用户。
语法
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity(identity=<user_name>)
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity(identity=<user_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity(identity=user1) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity(identity=user1) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 为用户设置角色。
语法
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>,name=<roles_attribute_name>, value=[<role_1>,<role_N>])
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>,name=<roles_attribute_name>, value=[<role_1>,<role_N>])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity-attribute(identity=user1, name=Roles, value=["Admin","Guest"]) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity-attribute(identity=user1, name=Roles, value=["Admin","Guest"]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 设置用户的属性。
语法
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>,name=<attribute_name>, value=[<attribute_value>])
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>,name=<attribute_name>, value=[<attribute_value>])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity-attribute(identity=user1, name=mail, value=["user@example.com"]) /subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity-attribute(identity=user1, name=website, value=["http://www.example.com/"])
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity-attribute(identity=user1, name=mail, value=["user@example.com"]) /subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity-attribute(identity=user1, name=website, value=["http://www.example.com/"])Copy to Clipboard Copied! Toggle word wrap Toggle overflow
现在,您可以使用这个域来创建一个安全域,或与 failover-realm、distributed-realm 或 aggregate-realm 中的另一个域合并。
1.1.3. 在 Elytron 中创建一个 aggregate-realm 复制链接链接已复制到粘贴板!
在 Elytron 中创建一个 aggregate-realm,它使用一个安全域进行身份验证,使用多个安全域的聚合进行授权。使用 aggregate-realm 创建一个安全域来添加身份验证和授权,以管理界面和部署的应用程序。
先决条件
- JBoss EAP 正在运行。
- 您已创建了一个要从聚合域中引用的域。
流程
从现有的安全域创建一个
aggregate-realm。语法
/subsystem=elytron/aggregate-realm=<aggregate_realm_name>:add(authentication-realm=<security_realm_for_authentication>, authorization-realms=[<security_realm_for_authorization_1>,<security_realm_for_authorization_2>,...,<security_realm_for_authorization_N>])
/subsystem=elytron/aggregate-realm=<aggregate_realm_name>:add(authentication-realm=<security_realm_for_authentication>, authorization-realms=[<security_realm_for_authorization_1>,<security_realm_for_authorization_2>,...,<security_realm_for_authorization_N>])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/aggregate-realm=exampleSecurityRealm:add(authentication-realm=exampleLDAPRealm,authorization-realms=[exampleLDAPRealm,exampleFileSystemRealm]) {"outcome" => "success"}/subsystem=elytron/aggregate-realm=exampleSecurityRealm:add(authentication-realm=exampleLDAPRealm,authorization-realms=[exampleLDAPRealm,exampleFileSystemRealm]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建一个角色解码器,来将属性映射到角色。
语法
/subsystem=elytron/simple-role-decoder=<role_decoder_name>:add(attribute=<attribute>)
/subsystem=elytron/simple-role-decoder=<role_decoder_name>:add(attribute=<attribute>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/simple-role-decoder=from-roles-attribute:add(attribute=Roles) {"outcome" => "success"}/subsystem=elytron/simple-role-decoder=from-roles-attribute:add(attribute=Roles) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建一个引用
aggregate-realm和角色解码器的安全域。语法
/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<aggregate_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=<aggregate_realm_name>,role-decoder="<role_decoder_name>"}])/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<aggregate_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=<aggregate_realm_name>,role-decoder="<role_decoder_name>"}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm,role-decoder="from-roles-attribute"}]) {"outcome" => "success"}/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm,role-decoder="from-roles-attribute"}]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
现在,您可以使用创建的安全域来向管理界面和应用程序添加身份验证和授权。如需更多信息,请参阅 保护管理界面和应用程序。
1.2. 创建缓存域 复制链接链接已复制到粘贴板!
1.2.1. Elytron 中的缓存域 复制链接链接已复制到粘贴板!
Elytron 提供 caching-realm 来从缓存安全域中查找的凭证的结果。caching-realm 使用 LRU 或 Least Recently Used 缓存策略缓存 PasswordCredential 凭证,在达到最大条目数时,将丢弃最少访问的条目。
您可以使用带有以下安全域的 caching-realm :
-
filesystem-realm -
jdbc-realm -
ldap-realm - 自定义安全域
如果您在 JBoss EAP 之外更改凭证源,如果底层的安全域支持侦听,则这些更改只会传播到 JBoss EAP 缓存域。只有 ldap-realm 支持侦听。但是,过滤的属性,如 roles ,在 ldap-realm 中不支持侦听。
要确保您的缓存域有正确的用户数据的缓存,请确保以下内容:
-
在修改了凭证源处的用户属性后,请清除
caching-realm缓存。 - 通过缓存域而不是在凭证源处修改用户属性。
通过缓存域进行用户更改仅作为技术预览提供。技术预览功能不包括在红帽生产服务级别协议(SLA)中,且其功能可能并不完善。因此,红帽不建议在生产环境中使用它们。这些技术预览功能可以使用户提早试用新的功能,并有机会在开发阶段提供反馈意见。
如需有关技术预览功能支持范围的信息,请参阅红帽客户门户网站上的 技术预览功能支持范围。
1.2.2. 在 Elytron 中创建一个 cache-realm 复制链接链接已复制到粘贴板!
创建一个 cache-realm 以及一个引用域的安全域,来保护 JBoss EAP 服务器界面或服务器上部署的应用程序。
配置为缓存域的 ldap-realm 不支持活动目录。如需更多信息,请参阅 通过 Elytron 的 JBossEAP CLI 修改 LDAP/AD 用户密码 。
先决条件
- 您已将安全域配置为缓存。
流程
创建一个将安全域引用为缓存的
caching-realm。语法
/subsystem=elytron/caching-realm=<caching_realm_name>:add(realm=<realm_to_cache>)
/subsystem=elytron/caching-realm=<caching_realm_name>:add(realm=<realm_to_cache>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/caching-realm=exampleSecurityRealm:add(realm=exampleLDAPRealm)
/subsystem=elytron/caching-realm=exampleSecurityRealm:add(realm=exampleLDAPRealm)Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建一个引用
caching-realm的安全域。语法
/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<caching_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=<caching_realm_name>,role-decoder="<role_decoder_name>"}])/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<caching_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=<caching_realm_name>,role-decoder="<role_decoder_name>"}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm}]) {"outcome" => "success"}/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm}]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
验证
要验证 Elytron 是否可以将
caching-realm中引用的安全域中的数据加载到caching-realm,请使用以下命令:语法
/subsystem=elytron/security-domain=<security_domain_name>:read-identity(name=<username>)
/subsystem=elytron/security-domain=<security_domain_name>:read-identity(name=<username>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
现在,您可以使用创建的安全域来向管理界面和应用程序添加身份验证和授权。如需更多信息,请参阅 保护管理界面和应用程序。
1.2.3. 清除 caching-realm 缓存 复制链接链接已复制到粘贴板!
清除 caching-realm 缓存会强制 Elytron 使用安全域的最新数据重新填充缓存, Elytron 被配置为缓存这些数据。
先决条件
-
caching-realm已配置。
流程
清除
caching-realm缓存。语法
/subsystem=elytron/caching-realm=<caching_realm_name>:clear-cache
/subsystem=elytron/caching-realm=<caching_realm_name>:clear-cacheCopy to Clipboard Copied! Toggle word wrap Toggle overflow 示例
/subsystem=elytron/caching-realm=exampleSecurityRealm:clear-cache
/subsystem=elytron/caching-realm=exampleSecurityRealm:clear-cacheCopy to Clipboard Copied! Toggle word wrap Toggle overflow
1.3. 创建分布式域 复制链接链接已复制到粘贴板!
1.3.1. Elytron 中的分布式域 复制链接链接已复制到粘贴板!
有了分布式域,您可以通过引用现有的安全域来跨不同的身份存储进行搜索。获取的身份用于身份验证和授权。Elytron 在分布式域中跟俊您在 distributed-realm 资源中定义的顺序调用安全域。
distributed-realm 配置示例
/subsystem=elytron/distributed-realm=exampleSecurityRealm:add(realms=[exampleLDAPRealm,exampleFilesystemRealm])
/subsystem=elytron/distributed-realm=exampleSecurityRealm:add(realms=[exampleLDAPRealm,exampleFilesystemRealm])
在示例中,配置的 distributed-realm 引用两个现有的安全域:"exampleLDAPRealm",它是一个 LDAP 域,以及"exampleFilesystemRealm",它是一个文件系统域。Elytron 按如下顺序搜索引用的安全域:
- Elytron 首先搜索 LDAP 域以匹配身份。
- 如果 Elytron 找到匹配项,则身份验证会成功。
- 如果 Elytron 没有找到匹配项,它会搜索文件系统域。
默认情况下,如果在匹配身份前与任何身份存储的连接失败,则身份验证会失败,但有一个例外的 RealmUnavailableException,且不会搜索更多域。您可以通过将属性 ignore-unavailable-realms 设置为 true 来更改此行为。当 ignore-unavailable-realms 设为 true 时与身份存储的连接失败,Elytron 会继续搜索剩余的域。
当 ignore-unavailable-realms 设置为 true 时,emit-events 默认被设置为 true,因此当任何查询的域不可用时会发出 SecurityEvent。您可以通过将 emit-events 设置为 false 来关闭此关闭。
1.3.2. 分布式域所需的创建安全域的示例 复制链接链接已复制到粘贴板!
以下示例演示了创建 ldap-realm 和 filesystem-realm。您可以在 distributed-realm 中引用这些安全域。
1.3.2.1. 在 Elytron 示例中创建一个 ldap-realm 复制链接链接已复制到粘贴板!
创建由轻量级目录访问协议(LDAP)身份存储支持的 Elytron 安全域,来保护 JBoss EAP 服务器接口或在服务器上部署的应用程序。
对于此过程中的示例,使用了以下 LDAP 数据交换格式(LDIF):
用于示例的 LDAP 连接参数如下:
-
LDAP URL
:ldap://10.88.0.2 LDAP admin 密码:
secret您需要此内容来使 Elytron 与 LDAP 服务器连接。
-
LDAP admin 可分辨名称(DN):
(cn=admin,dc=wildfly,dc=org) LDAP 机构:
wildfly如果没有指定机构名称,则默认为
Example Inc。LDAP 域:
wildfly.org这是当平台收到 LDAP 搜索参考时匹配的名称。
先决条件
- 您已配置了一个 LDAP 身份存储。
- JBoss EAP 正在运行。
流程
配置一个提供 URL 的目录上下文,以及用于连接到 LDAP 服务器的主体。
/subsystem=elytron/dir-context=<dir_context_name>:add(url="<LDAP_URL>",principal="<principal_distinguished_name>",credential-reference=<credential_reference>)
/subsystem=elytron/dir-context=<dir_context_name>:add(url="<LDAP_URL>",principal="<principal_distinguished_name>",credential-reference=<credential_reference>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/dir-context=exampleDirContext:add(url="ldap://10.88.0.2",principal="cn=admin,dc=wildfly,dc=org",credential-reference={clear-text="secret"}) {"outcome" => "success"}/subsystem=elytron/dir-context=exampleDirContext:add(url="ldap://10.88.0.2",principal="cn=admin,dc=wildfly,dc=org",credential-reference={clear-text="secret"}) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建一个引用目录上下文的 LDAP 域。指定搜索基础 DN 以及用户的映射方式。
语法
/subsystem=elytron/ldap-realm=<ldap_realm_name>add:(dir-context=<dir_context_name>,identity-mapping=search-base-dn="ou=<organization_unit>,dc=<domain_component>",rdn-identifier="<relative_distinguished_name_identifier>",user-password-mapper={from=<password_attribute_name>},attribute-mapping=[{filter-base-dn="ou=<organization_unit>,dc=<domain_component>",filter="<ldap_filter>",from="<ldap_attribute_name>",to="<identity_attribute_name>"}]})/subsystem=elytron/ldap-realm=<ldap_realm_name>add:(dir-context=<dir_context_name>,identity-mapping=search-base-dn="ou=<organization_unit>,dc=<domain_component>",rdn-identifier="<relative_distinguished_name_identifier>",user-password-mapper={from=<password_attribute_name>},attribute-mapping=[{filter-base-dn="ou=<organization_unit>,dc=<domain_component>",filter="<ldap_filter>",from="<ldap_attribute_name>",to="<identity_attribute_name>"}]})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/ldap-realm=exampleLDAPRealm:add(dir-context=exampleDirContext,identity-mapping={search-base-dn="ou=Users,dc=wildfly,dc=org",rdn-identifier="uid",user-password-mapper={from="userPassword"},attribute-mapping=[{filter-base-dn="ou=Roles,dc=wildfly,dc=org",filter="(&(objectClass=groupOfNames)(member={1}))",from="cn",to="Roles"}]}) {"outcome" => "success"}/subsystem=elytron/ldap-realm=exampleLDAPRealm:add(dir-context=exampleDirContext,identity-mapping={search-base-dn="ou=Users,dc=wildfly,dc=org",rdn-identifier="uid",user-password-mapper={from="userPassword"},attribute-mapping=[{filter-base-dn="ou=Roles,dc=wildfly,dc=org",filter="(&(objectClass=groupOfNames)(member={1}))",from="cn",to="Roles"}]}) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
现在,您可以使用这个域来创建安全域,或与 failover-realm、distributed-realm 或 aggregate-realm 中的其它域合并。您还可以为 ldap-realm 配置一个 caching-realm 来缓存查找的结果,并提高性能。
1.3.2.2. 在 Elytron 示例中创建一个 filesystem-realm 复制链接链接已复制到粘贴板!
创建一个由基于文件系统的身份存储支持的 Elytron 安全域,来保护 JBoss EAP 服务器接口或在服务器上部署的应用程序。
先决条件
- JBoss EAP 正在运行。
流程
在 Elytron 中创建一个
filesystem-realm。语法
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add(path=<file_path>)
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add(path=<file_path>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 将用户添加到域,并配置用户的角色。
添加用户。
语法
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity(identity=<user_name>)
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity(identity=<user_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity(identity=user2) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity(identity=user2) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 设置用户的密码。
语法
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:set-password(identity=<user_name>, clear={password=<password>})/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:set-password(identity=<user_name>, clear={password=<password>})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:set-password(identity=user2, clear={password="passwordUser2"}) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:set-password(identity=user2, clear={password="passwordUser2"}) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 为用户设置角色。
语法
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>, name=<roles_attribute_name>, value=[<role_1>,<role_N>])
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>, name=<roles_attribute_name>, value=[<role_1>,<role_N>])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity-attribute(identity=user2, name=Roles, value=["Admin","Guest"]) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity-attribute(identity=user2, name=Roles, value=["Admin","Guest"]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
现在,您可以使用这个域来创建一个安全域,或与 failover-realm、distributed-realm 或 aggregate-realm 中的另一个域合并。
1.3.3. 在 Elytron 中创建一个 distributed-realm 复制链接链接已复制到粘贴板!
在 Elytron 中创建一个 distributed-realm,以引用现有的安全域来搜索身份。使用 distributed-realm 创建一个安全域,来向管理界面或部署在服务器上的应用程序添加身份验证和授权。
先决条件
- JBoss EAP 正在运行。
-
您已创建了要在
distributed-realm中引用的域。
流程
创建一个引用现有安全域的
distributed-realm。语法
/subsystem=elytron/distributed-realm=<distributed_realm_name>:add(realms=[<security_realm_1>, <security_realm_2>, ..., <security_realm_N>])
/subsystem=elytron/distributed-realm=<distributed_realm_name>:add(realms=[<security_realm_1>, <security_realm_2>, ..., <security_realm_N>])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/distributed-realm=exampleSecurityRealm:add(realms=[exampleLDAPRealm, exampleFileSystemRealm]) {"outcome" => "success"}/subsystem=elytron/distributed-realm=exampleSecurityRealm:add(realms=[exampleLDAPRealm, exampleFileSystemRealm]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建一个角色解码器,来将属性映射到角色。
语法
/subsystem=elytron/simple-role-decoder=<role_decoder_name>:add(attribute=<attribute>)
/subsystem=elytron/simple-role-decoder=<role_decoder_name>:add(attribute=<attribute>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/simple-role-decoder=from-roles-attribute:add(attribute=Roles) {"outcome" => "success"}/subsystem=elytron/simple-role-decoder=from-roles-attribute:add(attribute=Roles) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建一个引用
distributed-realm的安全域,以及角色解码器。语法
/subsystem=elytron/security-domain=<security_domain_name>:add(realms=[{realm=<distributed_realm_name>,role-decoder=<role_decoder_name>}],default-realm=<ldap_realm_name>,permission-mapper=<permission_mapper>)/subsystem=elytron/security-domain=<security_domain_name>:add(realms=[{realm=<distributed_realm_name>,role-decoder=<role_decoder_name>}],default-realm=<ldap_realm_name>,permission-mapper=<permission_mapper>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm,role-decoder="from-roles-attribute"}]) {"outcome" => "success"}/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm,role-decoder="from-roles-attribute"}]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
现在,您可以使用创建的安全域来向管理界面和应用程序添加身份验证和授权。如需更多信息,请参阅 保护管理界面和应用程序。
1.4. 创建故障转移域 复制链接链接已复制到粘贴板!
1.4.1. Elytron 中的故障转移域 复制链接链接已复制到粘贴板!
您可以在 Elytron 中配置故障转移安全域 failover-realm ,其引用两个现有的安全域,以便在一个安全域失败时,Elytron 使用另一个作为备份。
Elytron 中的 failover-realm 引用两个安全域:
-
delegate-realm:要使用的主安全域。 -
failover-realm:要用作备份的安全域。
failover-realm 配置示例
/subsystem=elytron/failover-realm=exampleSecurityRealm:add(delegate-realm=exampleLDAPRealm,failover-realm=exampleFileSystemRealm)
/subsystem=elytron/failover-realm=exampleSecurityRealm:add(delegate-realm=exampleLDAPRealm,failover-realm=exampleFileSystemRealm)
在示例中,exampleLDAPRealm 是一个 ldap-realm,用作委派域, exampleFileSystemRealm 是一个 filesystem-realm,用作 failover-realm。如果 ldap-realm 失败,Elytron 将使用 filesystem-realm 进行身份验证和授权。
在 failover-realm 中,只有当 delegate-realm 失败时才会调用 failover-realm。如果与 delegate-realm 的连接成功但没找到所需的身份,则不会调用 fail-over 域。要搜索跨多个安全域的身份,请使用 distributed-realm。
1.4.2. 创建故障转移域所需的安全域的示例 复制链接链接已复制到粘贴板!
以下示例演示了创建 ldap-realm 和 filesystem-realm。您可以在 failover-realm 中引用这些安全域。
1.4.2.1. 在 Elytron 示例中创建一个 ldap-realm 复制链接链接已复制到粘贴板!
创建由轻量级目录访问协议(LDAP)身份存储支持的 Elytron 安全域,来保护 JBoss EAP 服务器接口或在服务器上部署的应用程序。
对于此过程中的示例,使用了以下 LDAP 数据交换格式(LDIF):
用于示例的 LDAP 连接参数如下:
-
LDAP URL
:ldap://10.88.0.2 LDAP admin 密码:
secret您需要此内容来使 Elytron 与 LDAP 服务器连接。
-
LDAP admin 可分辨名称(DN):
(cn=admin,dc=wildfly,dc=org) LDAP 机构:
wildfly如果没有指定机构名称,则默认为
Example Inc。LDAP 域:
wildfly.org这是当平台收到 LDAP 搜索参考时匹配的名称。
先决条件
- 您已配置了一个 LDAP 身份存储。
- JBoss EAP 正在运行。
流程
配置一个提供 URL 的目录上下文,以及用于连接到 LDAP 服务器的主体。
/subsystem=elytron/dir-context=<dir_context_name>:add(url="<LDAP_URL>",principal="<principal_distinguished_name>",credential-reference=<credential_reference>)
/subsystem=elytron/dir-context=<dir_context_name>:add(url="<LDAP_URL>",principal="<principal_distinguished_name>",credential-reference=<credential_reference>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/dir-context=exampleDirContext:add(url="ldap://10.88.0.2",principal="cn=admin,dc=wildfly,dc=org",credential-reference={clear-text="secret"}) {"outcome" => "success"}/subsystem=elytron/dir-context=exampleDirContext:add(url="ldap://10.88.0.2",principal="cn=admin,dc=wildfly,dc=org",credential-reference={clear-text="secret"}) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建一个引用目录上下文的 LDAP 域。指定搜索基础 DN 以及用户的映射方式。
语法
/subsystem=elytron/ldap-realm=<ldap_realm_name>add:(dir-context=<dir_context_name>,identity-mapping=search-base-dn="ou=<organization_unit>,dc=<domain_component>",rdn-identifier="<relative_distinguished_name_identifier>",user-password-mapper={from=<password_attribute_name>},attribute-mapping=[{filter-base-dn="ou=<organization_unit>,dc=<domain_component>",filter="<ldap_filter>",from="<ldap_attribute_name>",to="<identity_attribute_name>"}]})/subsystem=elytron/ldap-realm=<ldap_realm_name>add:(dir-context=<dir_context_name>,identity-mapping=search-base-dn="ou=<organization_unit>,dc=<domain_component>",rdn-identifier="<relative_distinguished_name_identifier>",user-password-mapper={from=<password_attribute_name>},attribute-mapping=[{filter-base-dn="ou=<organization_unit>,dc=<domain_component>",filter="<ldap_filter>",from="<ldap_attribute_name>",to="<identity_attribute_name>"}]})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/ldap-realm=exampleLDAPRealm:add(dir-context=exampleDirContext,identity-mapping={search-base-dn="ou=Users,dc=wildfly,dc=org",rdn-identifier="uid",user-password-mapper={from="userPassword"},attribute-mapping=[{filter-base-dn="ou=Roles,dc=wildfly,dc=org",filter="(&(objectClass=groupOfNames)(member={1}))",from="cn",to="Roles"}]}) {"outcome" => "success"}/subsystem=elytron/ldap-realm=exampleLDAPRealm:add(dir-context=exampleDirContext,identity-mapping={search-base-dn="ou=Users,dc=wildfly,dc=org",rdn-identifier="uid",user-password-mapper={from="userPassword"},attribute-mapping=[{filter-base-dn="ou=Roles,dc=wildfly,dc=org",filter="(&(objectClass=groupOfNames)(member={1}))",from="cn",to="Roles"}]}) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
现在,您可以使用这个域来创建安全域,或与 failover-realm、distributed-realm 或 aggregate-realm 中的其它域合并。您还可以为 ldap-realm 配置一个 caching-realm 来缓存查找的结果,并提高性能。
1.4.2.2. 在 Elytron 示例中创建一个 filesystem-realm 复制链接链接已复制到粘贴板!
创建一个由基于文件系统的身份存储支持的 Elytron 安全域,来保护 JBoss EAP 服务器接口或在服务器上部署的应用程序。
先决条件
- JBoss EAP 正在运行。
流程
在 Elytron 中创建一个
filesystem-realm。语法
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add(path=<file_path>)
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add(path=<file_path>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 将用户添加到域,并配置用户的角色。
添加用户。
语法
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity(identity=<user_name>)
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity(identity=<user_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity(identity=user1) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity(identity=user1) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 设置用户的密码。
语法
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:set-password(identity=<user_name>, clear={password=<password>})/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:set-password(identity=<user_name>, clear={password=<password>})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:set-password(identity=user1, clear={password="passwordUser1"}) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:set-password(identity=user1, clear={password="passwordUser1"}) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 为用户设置角色。
语法
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>,name=<roles_attribute_name>, value=[<role_1>,<role_N>])
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>,name=<roles_attribute_name>, value=[<role_1>,<role_N>])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity-attribute(identity=user1, name=Roles, value=["Admin","Guest"]) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity-attribute(identity=user1, name=Roles, value=["Admin","Guest"]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
现在,您可以使用这个域来创建一个安全域,或与 failover-realm、distributed-realm 或 aggregate-realm 中的另一个域合并。
1.4.3. 在 Elytron 中创建一个 failover-realm 复制链接链接已复制到粘贴板!
在 Elytron 中创建一个故障转移安全域,它将现有安全域引用为委派域、要使用的默认域以及故障转移域。Elytron 在委派域失败时使用配置的故障转移域。使用安全域创建安全域,来向管理接口或服务器上部署的应用程序添加身份验证和授权。
先决条件
- JBoss EAP 正在运行。
- 您已创建了域来用作委派和故障转移域。
流程
从现有的安全域创建一个
failover-realm。语法
/subsystem=elytron/failover-realm=<failover_realm_name>:add(delegate-realm=<realm_to_use_by_default>,failover-realm=<realm_to_use_as_backup>)
/subsystem=elytron/failover-realm=<failover_realm_name>:add(delegate-realm=<realm_to_use_by_default>,failover-realm=<realm_to_use_as_backup>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/failover-realm=exampleSecurityRealm:add(delegate-realm=exampleLDAPRealm,failover-realm=exampleFileSystemRealm) {"outcome" => "success"}/subsystem=elytron/failover-realm=exampleSecurityRealm:add(delegate-realm=exampleLDAPRealm,failover-realm=exampleFileSystemRealm) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建一个角色解码器,来将属性映射到角色。
语法
/subsystem=elytron/simple-role-decoder=<role_decoder_name>:add(attribute=<attribute>)
/subsystem=elytron/simple-role-decoder=<role_decoder_name>:add(attribute=<attribute>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/simple-role-decoder=from-roles-attribute:add(attribute=Roles) {"outcome" => "success"}/subsystem=elytron/simple-role-decoder=from-roles-attribute:add(attribute=Roles) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建一个引用
failover-realm和角色解码器的安全域。语法
/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<failover_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=<failover_realm_name>,role-decoder="<role_decoder_name>"}])/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<failover_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=<failover_realm_name>,role-decoder="<role_decoder_name>"}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm,role-decoder="from-roles-attribute"}]) {"outcome" => "success"}/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm,role-decoder="from-roles-attribute"}]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
现在,您可以使用创建的安全域来向管理界面和应用程序添加身份验证和授权。如需更多信息,请参阅 保护管理界面和应用程序。
1.5. 创建 JAAS 域 复制链接链接已复制到粘贴板!
1.5.1. Elytron 中的 JAAS 域 复制链接链接已复制到粘贴板!
Java 认证和授权服务(JAAS)域 jaas-realm 是一个安全域,您可以用来在 elytron 子系统中为用户的凭证验证和分配用户角色配置自定义登录模块。
您可以使用 jaas-realm 来保护 JBoss EAP 管理界面和已部署的应用。
JAAS 域通过初始化 javax.security.auth.login.LoginContext (其使用 JAAS 配置文件中指定的登录模块)来验证用户凭据,。
登录模块是 javax.security.auth.login.LoginContext.LoginModule 接口的实现。将这些实现作为 JBoss EAP 模块添加到服务器中,并在 JAAS 配置文件中指定它们。
JAAS 配置文件示例
test {
loginmodules.CustomLoginModule1 optional;
loginmodules.CustomLoginModule2 optional myOption1=true myOption2=exampleOption;
};
test {
loginmodules.CustomLoginModule1 optional;
loginmodules.CustomLoginModule2 optional myOption1=true myOption2=exampleOption;
};
- 1
- 配置
jaas-realm时使用的条目的名称。 - 2
- 使用其可选标记登录模块。您可以使用 JAAS 定义的所有标志。如需更多信息,请参阅 Oracle Java SE 文档中的 JAAS 登录配置文件。
- 3
- 使用其可选标志和选项登录模块。
在登录模块中与属性映射和角色关联的主题的主体
您可以使用 主题 的主体将属性添加到从登录模块获取的身份中。主题 是正被身份验证的用户,主体是标识符,如用户名,包含在主体内。
Elytron 获取和映射身份,如下所示:
-
登录模块使用
javax.security.auth.Subject代表用户,正被身份验证的 主题 。 -
主题 可以有多个
java.security.Principal实例 principal 与之关联。 -
Elytron 使用
org.wildfly.security.auth.server.SecurityIdentity来代表经过身份验证的用户。Elytron 将 主题 映射到SecurityIdentity。
主题的 主体 被映射到具有以下规则的安全身份的属性:
-
属性的
key是 主体 的简单类名称,可通过principal.getClass().getSimpleName()调用获得。 -
value是 主体 的名称,可通过principal.getName()调用获得。 - 对于同一类型的 主体,这些值会附加到属性键下的集合中。
1.5.2. 开发自定义 JAAS 登录模块 复制链接链接已复制到粘贴板!
您可以创建自定义 Java 身份验证和授权服务(JAAS)登录模块来实现自定义身份验证和授权功能。
您可以通过 Elytron 子系统中的 jaas-realm ,使界面和部署的应用程序。登录模块不是部署的一部分,您可以将它们作为 JBoss EAP 模块包含在内。
以下流程仅作为示例提供。如果您已有要保护的应用程序,则可以跳过这些步骤,直接来到 向应用程序添加身份验证和授权。
1.5.2.1. 为 JAAS 登录模块开发创建一个 Maven 项目 复制链接链接已复制到粘贴板!
要创建自定义 Java 身份验证和授权服务(JAAS)登录模块,请创建一个具有所需依赖项和目录结构的 Maven 项目。
先决条件
- 您已安装了 Maven。如需更多信息,请参阅 下载 Apache Maven。
流程
在 CLI 中使用
mvn命令来建立一个 Maven 项目。此命令为项目创建目录结构,以及pom.xml配置文件。语法
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 导航到应用程序根目录。
语法
cd <name-of-your-application>
$ cd <name-of-your-application>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
cd example-custom-login-module
$ cd example-custom-login-moduleCopy to Clipboard Copied! Toggle word wrap Toggle overflow 将生成的
pom.xml文件的内容替换为以下文本:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 删除目录
site和test,因为本例不需要它们。rm -rf src/site/ rm -rf src/test/
$ rm -rf src/site/ $ rm -rf src/test/Copy to Clipboard Copied! Toggle word wrap Toggle overflow
验证
在应用程序根目录中,输入以下命令:
mvn install
$ mvn installCopy to Clipboard Copied! Toggle word wrap Toggle overflow 您会看到类似如下的输出:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
现在,您可以创建自定义的 JAAS 登录模块。
1.5.2.2. 创建自定义的 JAAS 登录模块 复制链接链接已复制到粘贴板!
通过创建实现 javax.security.auth.spi.LoginModule 接口的类来创建自定义的 Java 身份验证和授权服务(JAAS)登录模块。此外,为自定义登录模块创建具有志和选项的 JAAS 配置文件。
在此过程中,<application_home> 指向包含应用程序 pom.xml 配置文件的目录。
先决条件
您已创建了一个 Maven 项目。
如需更多信息,请参阅 为 JAAS 登录模块开发创建一个 Maven 项目。
流程
创建一个用于存储 Java 文件的目录。
语法
mkdir -p src/main/java/<path_based_on_artifactID>
$ mkdir -p src/main/java/<path_based_on_artifactID>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
mkdir -p src/main/java/com/example/loginmodule
$ mkdir -p src/main/java/com/example/loginmoduleCopy to Clipboard Copied! Toggle word wrap Toggle overflow 导航到包含源文件的目录。
语法
cd src/main/java/<path_based_on_groupID>
$ cd src/main/java/<path_based_on_groupID>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
cd src/main/java/com/example/loginmodule
$ cd src/main/java/com/example/loginmoduleCopy to Clipboard Copied! Toggle word wrap Toggle overflow 删除生成的文件
App.java。rm App.java
$ rm App.javaCopy to Clipboard Copied! Toggle word wrap Toggle overflow 为自定义登录模块源创建一个文件
ExampleCustomLoginModule.java。Copy to Clipboard Copied! Toggle word wrap Toggle overflow 在 <application_home> 目录中创建 JAAS 配置文件
JAAS-login-modules.conf。exampleConfiguration { com.example.loginmodule.ExampleCustomLoginModule optional; };exampleConfiguration { com.example.loginmodule.ExampleCustomLoginModule optional; };Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
exampleConfiguration是条目名称。 -
com.example.loginmodule.ExampleCustomLoginModule是登录模块。 -
optional是标志。
-
编译登录模块。
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
现在,您可以使用登录模块来保护 JBoss EAP 管理界面和部署的应用程序。
1.5.3. 在 Elytron 中创建一个 jaas-realm 复制链接链接已复制到粘贴板!
创建由 Java 认证和授权服务(JAAS)兼容自定义登录模块支持的 Elytron 安全域,来保护 JBoss EAP 服务器界面或部署的应用程序。使用安全域来创建安全域。
先决条件
您已将自定义登录模块打包为 JAR。
如需示例登录模块,请参阅 开发自定义的 JAAS 登录模块。
- JBoss EAP 正在运行。
流程
使用管理 CLI,将登录模块 JAR 作为模块添加到 JBoss EAP。
语法
module add --name=<name_of_the_login_moudle> --resources=<path_to_the_login_module_jar> --dependencies=org.wildfly.security.elytron
module add --name=<name_of_the_login_moudle> --resources=<path_to_the_login_module_jar> --dependencies=org.wildfly.security.elytronCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example
module add --name=exampleLoginModule --resources=<path_to_login_module>/custom-login-modules-1.0.jar --dependencies=org.wildfly.security.elytron
module add --name=exampleLoginModule --resources=<path_to_login_module>/custom-login-modules-1.0.jar --dependencies=org.wildfly.security.elytronCopy to Clipboard Copied! Toggle word wrap Toggle overflow 从登录模块和 JAAS 登录配置文件创建
jaas-realm。语法
/subsystem=elytron/jaas-realm=<jaas_realm_name>:add(entry=<entry-name>,path=<path_to_module_config_file>,module=<name_of_the_login_module>,callback-handler=<name_of_the_optional_callback_handler>)
/subsystem=elytron/jaas-realm=<jaas_realm_name>:add(entry=<entry-name>,path=<path_to_module_config_file>,module=<name_of_the_login_module>,callback-handler=<name_of_the_optional_callback_handler>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/jaas-realm=exampleSecurityRealm:add(entry=exampleConfiguration,path=<path_to_login_module>/JAAS-login-modules.conf,module=exampleLoginModule)
/subsystem=elytron/jaas-realm=exampleSecurityRealm:add(entry=exampleConfiguration,path=<path_to_login_module>/JAAS-login-modules.conf,module=exampleLoginModule)Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建一个引用
jaas-realm的安全域。语法
/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<jaas_realm_name>,realms=[{realm=<jaas_realm_name>}],permission-mapper=default-permission-mapper)/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<jaas_realm_name>,realms=[{realm=<jaas_realm_name>}],permission-mapper=default-permission-mapper)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,realms=[{realm=exampleSecurityRealm}],permission-mapper=default-permission-mapper) {"outcome" => "success"}/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,realms=[{realm=exampleSecurityRealm}],permission-mapper=default-permission-mapper) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
现在,您可以使用创建的安全域来向管理界面和应用程序添加身份验证和授权。如需更多信息,请参阅 保护管理界面和应用程序。
第 2 章 保护管理界面和应用程序 复制链接链接已复制到粘贴板!
2.1. 向管理界面添加身份验证和授权 复制链接链接已复制到粘贴板!
您可以为管理界面添加身份验证和授权,以便使用安全域来保护它们。要在添加身份验证和授权后访问管理界面,用户必须输入登录凭证。
您可以按照以下方法保护 JBoss EAP 管理界面:
管理 CLI
通过配置一个
sasl-authentication-factory。管理控制台
通过配置一个
http-authentication-factory.
先决条件
- 您已创建了一个引用安全域的安全域。
- JBoss EAP 正在运行。
流程
创建一个
http-authentication-factory或sasl-authentication-factory。创建一个
http-authentication-factory。语法
/subsystem=elytron/http-authentication-factory=<authentication_factory_name>:add(http-server-mechanism-factory=global, security-domain=<security_domain_name>, mechanism-configurations=[{mechanism-name=<mechanism-name>, mechanism-realm-configurations=[{realm-name=<realm_name>}]}])/subsystem=elytron/http-authentication-factory=<authentication_factory_name>:add(http-server-mechanism-factory=global, security-domain=<security_domain_name>, mechanism-configurations=[{mechanism-name=<mechanism-name>, mechanism-realm-configurations=[{realm-name=<realm_name>}]}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/http-authentication-factory=exampleAuthenticationFactory:add(http-server-mechanism-factory=global, security-domain=exampleSecurityDomain, mechanism-configurations=[{mechanism-name=BASIC, mechanism-realm-configurations=[{realm-name=exampleSecurityRealm}]}]) {"outcome" => "success"}/subsystem=elytron/http-authentication-factory=exampleAuthenticationFactory:add(http-server-mechanism-factory=global, security-domain=exampleSecurityDomain, mechanism-configurations=[{mechanism-name=BASIC, mechanism-realm-configurations=[{realm-name=exampleSecurityRealm}]}]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建一个
sasl-authentication-factory。语法
/subsystem=elytron/sasl-authentication-factory=<sasl_authentication_factory_name>:add(security-domain=<security_domain>,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=<mechanism-name>,mechanism-realm-configurations=[{realm-name=<realm_name>}]}])/subsystem=elytron/sasl-authentication-factory=<sasl_authentication_factory_name>:add(security-domain=<security_domain>,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=<mechanism-name>,mechanism-realm-configurations=[{realm-name=<realm_name>}]}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/sasl-authentication-factory=exampleSaslAuthenticationFactory:add(security-domain=exampleSecurityDomain,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=PLAIN,mechanism-realm-configurations=[{realm-name=exampleSecurityRealm}]}]) {"outcome" => "success"}/subsystem=elytron/sasl-authentication-factory=exampleSaslAuthenticationFactory:add(security-domain=exampleSecurityDomain,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=PLAIN,mechanism-realm-configurations=[{realm-name=exampleSecurityRealm}]}]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
更新管理界面。
使用
http-authentication-factory来保护管理控制台。语法
/core-service=management/management-interface=http-interface:write-attribute(name=http-authentication-factory, value=<authentication_factory_name>)
/core-service=management/management-interface=http-interface:write-attribute(name=http-authentication-factory, value=<authentication_factory_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 使用
sasl-authentication-factory来保护管理 CLI。语法
/core-service=management/management-interface=http-interface:write-attribute(name=http-upgrade,value={enabled=true,sasl-authentication-factory=<sasl_authentication_factory>})/core-service=management/management-interface=http-interface:write-attribute(name=http-upgrade,value={enabled=true,sasl-authentication-factory=<sasl_authentication_factory>})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
重新加载服务器。
reload
reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow
验证
要验证管理控制台是否需要身份验证和授权,请导航到位于
http://127.0.0.1:9990/console/index.html的管理控制台。会提示您输入用户名和密码。
要验证管理 CLI 是否需要身份验证和授权,请使用以下命令启动管理 CLI:
bin/jboss-cli.sh --connect
$ bin/jboss-cli.sh --connectCopy to Clipboard Copied! Toggle word wrap Toggle overflow 会提示您输入用户名和密码。
2.2. 使用安全域对应用程序用户进行身份验证和授权 复制链接链接已复制到粘贴板!
使用引用安全域的安全域来验证和授权应用用户。开发应用程序的流程仅作为示例提供。
2.2.1. 为 aggregate-realm 开发一个简单的 Web 应用程序 复制链接链接已复制到粘贴板!
您可以创建一个简单的 Web 应用来遵循配置安全域示例。
以下流程仅作为示例提供。如果您已有要保护的应用程序,则可以跳过这些步骤,直接来到 向应用程序添加身份验证和授权。
2.2.1.1. 为 web 应用程序开发创建一个 maven 项目 复制链接链接已复制到粘贴板!
要创建一个 web 应用,请创建一个具有所需依赖项和目录结构的 Maven 项目。
先决条件
- 您已安装了 Maven。如需更多信息,请参阅 下载 Apache Maven。
流程
使用
mvn命令建立一个 Maven 项目。该命令创建项目的目录结构以及pom.xml配置文件。语法
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 进入到应用程序根目录:
语法
cd <name-of-your-application>
$ cd <name-of-your-application>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
cd simple-webapp-example
$ cd simple-webapp-exampleCopy to Clipboard Copied! Toggle word wrap Toggle overflow 将生成的
pom.xml文件的内容替换为以下文本:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
验证
在应用程序根目录中,输入以下命令:
mvn install
$ mvn installCopy to Clipboard Copied! Toggle word wrap Toggle overflow 您会看到类似如下的输出:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
现在,您可以创建一个 web 应用程序。
2.2.1.2. 创建一个 Web 应用程序 复制链接链接已复制到粘贴板!
创建一个 Web 应用程序,其中包含一个 servlet,它将返回从登录的用户主体和属性中获取的用户名。如果没有登录的用户,servlet 将返回文本"NO AUTHENTICATED USER"。
先决条件
- 您已创建了一个 Maven 项目。
- JBoss EAP 正在运行。
流程
创建一个用于存储 Java 文件的目录。
语法
mkdir -p src/main/java/<path_based_on_artifactID>
$ mkdir -p src/main/java/<path_based_on_artifactID>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
mkdir -p src/main/java/com/example/app
$ mkdir -p src/main/java/com/example/appCopy to Clipboard Copied! Toggle word wrap Toggle overflow 前往新目录。
语法
cd src/main/java/<path_based_on_artifactID>
$ cd src/main/java/<path_based_on_artifactID>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
cd src/main/java/com/example/app
$ cd src/main/java/com/example/appCopy to Clipboard Copied! Toggle word wrap Toggle overflow 使用以下内容创建一个
securedServlet.java文件:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 在应用程序根目录中,使用以下命令编译应用程序:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 部署应用。
mvn wildfly:deploy
$ mvn wildfly:deployCopy to Clipboard Copied! Toggle word wrap Toggle overflow
验证
在浏览器中,导航到
http://localhost:8080/simple-webapp-example/secured。您会收到以下信息:
Secured Servlet Current Principal 'NO AUTHENTICATED USER'
Secured Servlet Current Principal 'NO AUTHENTICATED USER'Copy to Clipboard Copied! Toggle word wrap Toggle overflow 因为没有添加验证机制,所以您可以访问应用程序。
现在,您可以使用安全域来保护这个应用程序,这样只有经过身份验证的用户才可以访问它。
2.2.2. 向应用程序添加身份验证和授权 复制链接链接已复制到粘贴板!
您可以使用安全域向 Web 应用程序添加身份验证和授权,以对其进行保护。要在添加身份验证和授权后访问 web 应用程序,用户必须输入登录凭证。
先决条件
- 您已创建了一个引用安全域的安全域。
- 您已在 JBoss EAP 上部署了应用程序。
- JBoss EAP 正在运行。
流程
在
undertow 子系统中配置一个application-security-domain:语法
/subsystem=undertow/application-security-domain=<application_security_domain_name>:add(security-domain=<security_domain_name>)
/subsystem=undertow/application-security-domain=<application_security_domain_name>:add(security-domain=<security_domain_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=undertow/application-security-domain=exampleApplicationSecurityDomain:add(security-domain=exampleSecurityDomain) {"outcome" => "success"}/subsystem=undertow/application-security-domain=exampleApplicationSecurityDomain:add(security-domain=exampleSecurityDomain) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 配置应用程序的
web.xml以保护应用程序资源。语法
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意您可以使用不同的
auth-method。通过在应用程序中创建一个
jboss-web.xml文件,或者在undertow子系统中设置默认安全域,将应用程序配置为使用安全域。在应用程序的
WEB-INF目录中创建引用application-security-domain的jboss-web.xml文件。语法
<jboss-web> <security-domain> <!-- The security domain to associate with the application --></security-domain> </jboss-web>
<jboss-web> <security-domain> <!-- The security domain to associate with the application --></security-domain> </jboss-web>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
<jboss-web> <security-domain>exampleApplicationSecurityDomain</security-domain> </jboss-web>
<jboss-web> <security-domain>exampleApplicationSecurityDomain</security-domain> </jboss-web>Copy to Clipboard Copied! Toggle word wrap Toggle overflow 在
undertow子系统中,为应用程序设置默认安全域。语法
/subsystem=undertow:write-attribute(name=default-security-domain,value=<application_security_domain_to_use>)
/subsystem=undertow:write-attribute(name=default-security-domain,value=<application_security_domain_to_use>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
重新加载服务器。
reload
reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow
验证
在应用程序根目录中,使用以下命令编译应用程序:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 部署应用。
mvn wildfly:deploy
$ mvn wildfly:deployCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
在浏览器中,导航到
http://localhost:8080/simple-webapp-example/secured。您会收到一个登录提示,确认现在需要身份验证才能访问应用程序。
现在,您的应用程序已使用安全域进行了保护,用户可以在身份验证后登录。另外,只有具有指定角色的用户才可以访问应用程序。
第 3 章 在 Elytron 中配置审计日志记录 复制链接链接已复制到粘贴板!
您可以使用 Elytron 在触发事件时完成安全审核。安全审计指的是触发事件,如写入日志以响应授权或身份验证尝试。
对事件执行的安全审计类型取决于您的安全域配置。
3.1. Elytron 审计日志记录 复制链接链接已复制到粘贴板!
在使用 elytron 子系统启用审计日志记录后,您可以在应用服务器中记录 Elytron 身份验证和授权事件。Elytron 以 JSON 或 SIMPLE 格式存储审计日志条目。使用 SIMPLE 进行人类可读的文本格式或 JSON,以 JSON 形式存储各个事件。
Elytron 审计日志记录与其他类型的审计日志记录不同,如 JBoss EAP 管理接口的审计日志记录。
但是,Elytron 默认禁用审计日志记录,您可以通过配置以下任何日志处理程序来启用审计日志记录。您还可以将日志处理程序添加到安全域。
文件审计日志记录
如需更多信息,请参阅在 Elytron 中启用文件审计日志记录。
定期轮转文件审计日志记录
如需更多信息,请参阅在 Elytron 中启用定期轮转文件审计日志记录。
大小轮转文件审计日志记录
如需更多信息,请参阅在 Elytron 中启用大小轮转文件审计日志记录。
syslog审计日志记录如需更多信息,请参阅在 Elytron 中启用 syslog 审计日志记录。
自定义审计日志记录
如需更多信息,请参阅在 Elytron 中使用自定义安全事件监听程序。
您可以使用 aggregate-security-event-listener 资源 将安全事件发送到更多目的地,如日志记录器。aggregate-security-event-listener 资源 将所有事件发送到聚合监听器定义中指定的所有监听程序。
3.2. 在 Elytron 中启用文件审计日志记录 复制链接链接已复制到粘贴板!
文件审计日志记录将审计日志消息存储在文件系统中的一个文件中。
默认情况下,Elytron 将 local-audit 指定为文件审计日志记录器。
您必须启用 local-audit,以便它可以将 Elytron 审计日志写入单机服务器上的 EAP_HOME/standalone/log/audit.log,或者用于受管域的 EAP_HOME/domain/log/audit.log。
先决条件
您已保护了应用程序。
如需更多信息,请参阅在 Elytron 中创建一个
aggregate-realm。
流程
创建文件审计日志。
语法
/subsystem=elytron/file-audit-log=<audit_log_name>:add(path="<path_to_log_file>",format=<format_type>,synchronized=<whether_to_log_immediately>)
/subsystem=elytron/file-audit-log=<audit_log_name>:add(path="<path_to_log_file>",format=<format_type>,synchronized=<whether_to_log_immediately>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/file-audit-log=exampleFileAuditLog:add(path="file-audit.log",relative-to=jboss.server.log.dir,format=SIMPLE,synchronized=true)
/subsystem=elytron/file-audit-log=exampleFileAuditLog:add(path="file-audit.log",relative-to=jboss.server.log.dir,format=SIMPLE,synchronized=true)Copy to Clipboard Copied! Toggle word wrap Toggle overflow 将文件审计日志添加到安全域。
语法
/subsystem=elytron/security-domain=<security_domain_name>:write-attribute(name=security-event-listener,value=<audit_log_name>)
/subsystem=elytron/security-domain=<security_domain_name>:write-attribute(name=security-event-listener,value=<audit_log_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=exampleFileAuditLog)
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=exampleFileAuditLog)Copy to Clipboard Copied! Toggle word wrap Toggle overflow
验证
在浏览器中,登录您的安全应用。
例如,要登录到 使用安全域创建的应用程序来验证和授权应用程序用户,请导航到 http://localhost:8080/simple-webapp-example/secured 并登录。
导航到配置为存储审计日志的目录。如果您在流程中使用示例命令,则目录为 EAP_HOME/standalone/log。
请注意,创建一个名为
file-audit.log的文件。它包含通过登录到应用程序来触发的事件的日志。file-audit.log 文件示例
2023-10-24 23:31:04,WARNING,{event=SecurityPermissionCheckSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true,permission=[type=org.wildfly.security.auth.permission.LoginPermission,actions=,name=]} 2023-10-24 23:31:04,WARNING,{event=SecurityAuthenticationSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true}2023-10-24 23:31:04,WARNING,{event=SecurityPermissionCheckSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true,permission=[type=org.wildfly.security.auth.permission.LoginPermission,actions=,name=]} 2023-10-24 23:31:04,WARNING,{event=SecurityAuthenticationSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.3. 在 Elytron 中启用定期轮转文件审计日志记录 复制链接链接已复制到粘贴板!
您可以使用 elytron 子系统为单机服务器或作为受管域运行的服务器启用定期轮转文件审计日志记录。
定期轮转文件审计日志记录会根据您配置的调度自动轮转审计日志文件。定期轮转文件审计日志记录与默认文件审计日志记录类似,但定期轮转文件审计日志记录包含额外的属性: suffix。
suffix 属性的值是一个使用 java.time.format.DateTimeFormatter 格式指定的日期,如 .yyyy-MM-dd。Elytron 自动从后缀提供的值计算轮转周期。elytron 子系统在日志文件名称末尾附加后缀。
先决条件
您已保护了应用程序。
如需更多信息,请参阅在 Elytron 中创建一个
aggregate-realm。
流程
创建定期轮转文件审计日志。
语法
/subsystem=elytron/periodic-rotating-file-audit-log=<periodic_audit_log_name>:add(path="<periodic_audit_log_filename>",format=<record_format>,synchronized=<whether_to_log_immediately>,suffix="<suffix_in_DateTimeFormatter_format>")
/subsystem=elytron/periodic-rotating-file-audit-log=<periodic_audit_log_name>:add(path="<periodic_audit_log_filename>",format=<record_format>,synchronized=<whether_to_log_immediately>,suffix="<suffix_in_DateTimeFormatter_format>")Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/periodic-rotating-file-audit-log=examplePreiodicFileAuditLog:add(path="periodic-file-audit.log",relative-to=jboss.server.log.dir,format=SIMPLE,synchronized=true,suffix="yyyy-MM-dd")
/subsystem=elytron/periodic-rotating-file-audit-log=examplePreiodicFileAuditLog:add(path="periodic-file-audit.log",relative-to=jboss.server.log.dir,format=SIMPLE,synchronized=true,suffix="yyyy-MM-dd")Copy to Clipboard Copied! Toggle word wrap Toggle overflow 将定期轮转文件审计日志记录器添加到安全域。
语法
/subsystem=elytron/security-domain=<security_domain_name>:write-attribute(name=security-event-listener,value=<periodic_audit_log_name>)
/subsystem=elytron/security-domain=<security_domain_name>:write-attribute(name=security-event-listener,value=<periodic_audit_log_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=examplePreiodicFileAuditLog)
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=examplePreiodicFileAuditLog)Copy to Clipboard Copied! Toggle word wrap Toggle overflow
验证
在浏览器中,登录您的安全应用。
例如,要登录到 使用安全域创建的应用程序来验证和授权应用程序用户,请导航到 http://localhost:8080/simple-webapp-example/secured 并登录。
导航到配置为存储审计日志的目录。如果您在流程中使用示例命令,则目录为 EAP_HOME/standalone/log。
请注意,创建一个名为
periodic-file-audit.log的文件。它包含通过登录到应用程序来触发的事件的日志。periodic-file-audit.log 文件示例
2023-10-24 23:31:04,WARNING,{event=SecurityPermissionCheckSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true,permission=[type=org.wildfly.security.auth.permission.LoginPermission,actions=,name=]} 2023-10-24 23:31:04,WARNING,{event=SecurityAuthenticationSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true}2023-10-24 23:31:04,WARNING,{event=SecurityPermissionCheckSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true,permission=[type=org.wildfly.security.auth.permission.LoginPermission,actions=,name=]} 2023-10-24 23:31:04,WARNING,{event=SecurityAuthenticationSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.4. 在 Elytron 中启用大小轮转文件审计日志记录 复制链接链接已复制到粘贴板!
您可以使用 elytron 子系统为单机服务器或作为受管域运行的服务器启用大小轮转文件审计日志记录。
当日志文件达到配置的文件大小时,大小轮转文件审计日志记录会自动轮转审计日志文件。大小轮转文件审计日志记录与默认文件审计日志记录类似,但大小轮转文件审计日志记录包含额外的属性。
当日志文件大小超过 rotate-size 属性定义的限制时,Elytron 会将后缀 .1 附加到当前文件的末尾,并创建新的日志文件。对于每个现有日志文件,Elytron 将后缀递增一。例如,Elytron 将 audit_log.1 重命名为 audit_log.2。Elytron 继续递增,直到日志文件数量达到最大日志文件数,如 max-backup-index 定义。当日志文件超过 max-backup-index 值时,Elytron 会删除该文件。例如,如果 max-backup-index 将 "98" 定义为 max-backup-index 值,则 audit_log.99 文件将超过限制。
先决条件
您已保护了应用程序。
如需更多信息,请参阅在 Elytron 中创建一个
aggregate-realm。
流程
创建大小轮转文件审计日志。
语法
/subsystem=elytron/size-rotating-file-audit-log=<audit_log_name>:add(path="<path_to_log_file>",format=<record_format>,synchronized=<whether_to_log_immediately>,rotate-size="<max_file_size_before_rotation>",max-backup-index=<max_number_of_backup_files>)
/subsystem=elytron/size-rotating-file-audit-log=<audit_log_name>:add(path="<path_to_log_file>",format=<record_format>,synchronized=<whether_to_log_immediately>,rotate-size="<max_file_size_before_rotation>",max-backup-index=<max_number_of_backup_files>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/size-rotating-file-audit-log=exampleSizeFileAuditLog:add(path="size-file-audit.log",relative-to=jboss.server.log.dir,format=SIMPLE,synchronized=true,rotate-size="10m",max-backup-index=10)
/subsystem=elytron/size-rotating-file-audit-log=exampleSizeFileAuditLog:add(path="size-file-audit.log",relative-to=jboss.server.log.dir,format=SIMPLE,synchronized=true,rotate-size="10m",max-backup-index=10)Copy to Clipboard Copied! Toggle word wrap Toggle overflow 将大小轮转审计日志记录器添加到安全域。
语法
/subsystem=elytron/security-domain=<domain_size_logger>:write-attribute(name=security-event-listener,value=<audit_log_name>)
/subsystem=elytron/security-domain=<domain_size_logger>:write-attribute(name=security-event-listener,value=<audit_log_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=exampleSizeFileAuditLog)
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=exampleSizeFileAuditLog)Copy to Clipboard Copied! Toggle word wrap Toggle overflow
验证
在浏览器中,登录您的安全应用。
例如,要登录到 使用安全域创建的应用程序来验证和授权应用程序用户,请导航到 http://localhost:8080/simple-webapp-example/secured 并登录。
导航到配置为存储审计日志的目录。如果您在流程中使用示例命令,则目录为 EAP_HOME/standalone/log。
请注意,创建一个名为
size-file-audit.log的文件。它包含通过登录到应用程序来触发的事件的日志。size-file-audit.log 文件示例
2023-10-24 23:31:04,WARNING,{event=SecurityPermissionCheckSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true,permission=[type=org.wildfly.security.auth.permission.LoginPermission,actions=,name=]} 2023-10-24 23:31:04,WARNING,{event=SecurityAuthenticationSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true}2023-10-24 23:31:04,WARNING,{event=SecurityPermissionCheckSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true,permission=[type=org.wildfly.security.auth.permission.LoginPermission,actions=,name=]} 2023-10-24 23:31:04,WARNING,{event=SecurityAuthenticationSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.5. 在 Elytron 中启用 syslog 审计日志记录 复制链接链接已复制到粘贴板!
您可以使用 elytron 子系统为单机服务器或作为受管域运行的服务器启用 syslog 审计日志记录。使用 syslog 审计日志记录时,您可以将日志记录结果发送到 syslog 服务器,它比记录到本地文件提供了更多的安全选项。
syslog 处理程序指定用于连接 syslog 服务器的参数,如 syslog 服务器的主机名和 syslog 服务器侦听的端口。您可以定义多个 syslog 处理程序,并同时激活它们。
支持的日志格式包括 RFC5424 和 RFC3164。支持的传输协议包括 UDP、TCP 和 TCP (使用 SSL)。
当您为第一个实例定义 syslog 时,日志记录器会将包含消息的 INFORMATIONAL 优先级事件发送到 syslog 服务器,如下例所示:
"Elytron audit logging enabled with RFC format: <format>"
"Elytron audit logging enabled with RFC format: <format>"
<format > 指的是为审计日志处理器配置的 Request for Comments (RFC)格式,默认为 RFC5424。
先决条件
您已保护了应用程序。
如需更多信息,请参阅在 Elytron 中创建一个
aggregate-realm。
流程
添加
syslog处理程序。语法
/subsystem=elytron/syslog-audit-log=<syslog_audit_log_name>:add(host-name=<record_host_name>,port=<syslog_server_port_number>,server-address=<syslog_server_address>,format=<record_format>, transport=<transport_layer_protocol>)
/subsystem=elytron/syslog-audit-log=<syslog_audit_log_name>:add(host-name=<record_host_name>,port=<syslog_server_port_number>,server-address=<syslog_server_address>,format=<record_format>, transport=<transport_layer_protocol>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow 您还可以通过 TLS 将日志发送到
syslog服务器:syslog配置通过 TLS 发送日志的语法/subsystem=elytron/syslog-audit-log=<syslog_audit_log_name>:add(transport=SSL_TCP,server-address=<syslog_server_address>,port=<syslog_server_port_number>,host-name=<record_host_name>,ssl-context=<client_ssl_context>)
/subsystem=elytron/syslog-audit-log=<syslog_audit_log_name>:add(transport=SSL_TCP,server-address=<syslog_server_address>,port=<syslog_server_port_number>,host-name=<record_host_name>,ssl-context=<client_ssl_context>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow 将
syslog审计日志记录器添加到安全域。语法
/subsystem=elytron/security-domain=<security_domain_name>:write-attribute(name=security-event-listener,value=<syslog_audit_log_name>)
/subsystem=elytron/security-domain=<security_domain_name>:write-attribute(name=security-event-listener,value=<syslog_audit_log_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=exampleSyslog)
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=exampleSyslog)Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.6. 在 Elytron 中使用自定义安全事件监听程序 复制链接链接已复制到粘贴板!
您可以使用 Elytron 定义自定义事件监听程序。自定义事件监听程序处理传入的安全事件。您可以使用事件监听程序进行自定义审计日志记录,也可以使用事件监听程序针对内部身份存储验证用户。
使用 module 管理 CLI 命令添加和删除模块的功能仅作为技术预览功能提供。module 命令不适合在受管域中使用,或者在连接远程管理 CLI 时使用。您必须在生产环境中手动添加或删除模块。
红帽产品服务级别协议(SLA)不支持技术预览功能,且其功能可能并不完善,红帽不建议在生产环境中使用它们。这些技术预览功能可以使用户提早试用新的功能,并有机会在开发阶段提供反馈意见。
如需有关技术预览功能支持范围的信息,请参阅红帽客户门户网站上的 技术预览功能支持范围。
先决条件
您已保护了应用程序。
如需更多信息,请参阅在 Elytron 中创建一个
aggregate-realm。
流程
创建一个实施
java.util.function.Consumer<org.wildfly.security.auth.server.event.SecurityEvent>接口的类。创建使用指定接口的 Java 类示例:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 当用户成功或失败身份验证时,示例中的 Java 类会打印一条消息。
添加 JAR 文件,它将自定义事件监听程序作为 JBoss EAP 模块提供。
以下是管理 CLI 命令的示例,它将自定义事件监听程序作为模块添加到 Elytron 中。
使用
module命令将自定义事件监听程序作为模块添加到 Elytron 的示例:/subsystem=elytron/custom-security-event-listener=<listener_name>:add(module=<module_name>, class-name=<class_name>)
/subsystem=elytron/custom-security-event-listener=<listener_name>:add(module=<module_name>, class-name=<class_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow 引用安全域中的自定义事件监听程序。
在
ApplicationDomain中引用自定义事件监听程序的示例:/subsystem=elytron/security-domain=<domain_name>:write-attribute(name=security-event-listener, value=<listener_name>)
/subsystem=elytron/security-domain=<domain_name>:write-attribute(name=security-event-listener, value=<listener_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow 重新启动服务器。
reload
$ reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow 事件监听器从指定的安全域接收安全事件。
第 4 章 参考 复制链接链接已复制到粘贴板!
4.1. aggregate-realm 属性 复制链接链接已复制到粘贴板!
您可以通过设置其属性来配置 aggregate-realm。
| 属性 | 描述 |
|---|---|
| authentication-realm | 用于身份验证步骤的安全域的引用。这用于获取或验证凭证。 |
| authorization-realm | 用于加载授权步骤身份的安全域的引用。 |
| authorization-realms | 引用安全领域,以聚合加载授权步骤的身份。如果属性在多个授权域中定义,则将使用该属性第一次出现的值。 |
| principal-transformer | 引用主体转换器,以在加载身份验证的身份和加载授权的身份之间应用。 |
authorization-realm 和 authorization-realms 属性是互斥的。在域中仅定义两个属性中的一个。
4.2. cache-realm 属性 复制链接链接已复制到粘贴板!
您可以通过设置其属性来配置 caching-realm。
| 属性 | 描述 |
|---|---|
| maximum-age |
项目可以保留在缓存中的时间(毫秒)。 |
| maximum-entries |
在缓存中保留的最大条目数。默认值为 |
| realm |
对可缓存的安全域的引用,如 |
4.3. distributed-realm 属性 复制链接链接已复制到粘贴板!
您可以通过设置其属性来配置 distributed-realm。
| 属性 | 描述 |
|---|---|
| emit-events |
是否应发出 |
| ignore-unavailable-realms |
如果与任何身份存储的连接失败,则是否应检查后续域。将值设为
当值设为 |
| realms | 要搜索的安全域的列表。安全域按照其在此属性中提供的顺序调用。 |
4.4. failover-realm 属性 复制链接链接已复制到粘贴板!
您可以通过设置其属性来配置 failover-realm。
| 属性 | 描述 |
|---|---|
| delegate-realm | 默认要使用的安全域。 |
| emit-events |
指定是否应发出表示 |
| failover-realm |
在 |
4.5. file-audit-log 属性 复制链接链接已复制到粘贴板!
| 属性 | 描述 |
|---|---|
|
|
指定输出流是否在每个审计事件后清除。如果没有定义属性,则 |
|
|
指定审计文件编码。默认值为
|
|
|
默认值为 |
|
| 定义日志文件的位置。 |
|
| 可选属性。定义日志文件的位置。 |
|
|
默认值为 |
4.6. http-authentication-factory 属性 复制链接链接已复制到粘贴板!
您可以通过设置其属性来配置 http-authentication-factory。
| 属性 | 描述 |
|---|---|
| http-server-mechanism-factory |
|
| mechanism-configurations | 特定于机制的配置的列表。 |
| security-domain | 与资源关联的安全域。 |
| 属性 | 描述 |
|---|---|
| credential-security-factory | 用于获取机制所要求的凭证的安全因素。 |
| final-principal-transformer | 应用于此机制域的最后一个主体转换器。 |
| host-name | 此配置应用到的主机名。 |
| mechanism-name | 此配置仅应用于使用指定名称机制的情况。如果省略此属性,则它将匹配任何机制名称。 |
| mechanism-realm-configurations | 机制理解的域名称的定义的列表。 |
| pre-realm-principal-transformer | 在选择域之前要应用的主体转换器。 |
| post-realm-principal-transformer | 选择域之后要应用的主体转换器。 |
| protocol | 此配置适用的协议。 |
| realm-mapper | 机制使用的 realm mapper。 |
| 属性 | 描述 |
|---|---|
| final-principal-transformer | 应用于此机制域的最后一个主体转换器。 |
| post-realm-principal-transformer | 选择域之后要应用的主体转换器。 |
| pre-realm-principal-transformer | 在选择域之前要应用的主体转换器。 |
| realm-mapper | 机制使用的 realm mapper。 |
| realm-name | 按机制要显示的域的名称。 |
4.7. JAAS-realm 属性 复制链接链接已复制到粘贴板!
您可以通过设置其属性来配置 jaas-realm。除 entry 外的所有属性都是可选的。
| attribute | description |
|---|---|
|
|
与登录上下文一起使用的回调处理程序。可以使用安全属性 |
|
|
用于初始化 |
|
|
带有自定义 |
|
|
JAAS 配置文件的可选路径。您还可以使用 java 系统属性 |
|
|
如果您提供了 |
4.8. module 命令参数 复制链接链接已复制到粘贴板!
您可以在 module 命令中使用不同的参数。
| 参数 | 描述 |
|---|---|
| --absolute-resources |
使用这个参数指定要从
有关分隔符的详情,请参阅 |
| --allow-nonexistent-resources |
使用此参数为 |
| --dependencies | 使用此参数提供此模块依赖的逗号分隔的模块名称的列表。 |
| --export-dependencies | 使用此参数指定导出的依赖项。 module add --name=com.mysql --resources=/path/to/{MySQLDriverJarName} --export-dependencies=wildflyee.api,java.se
|
| --main-class | 使用此参数指定声明模块主方法的完全限定类名称。 |
| --module-root-dir |
如果您定义了要使用的外部 JBoss EAP 模块目录,而不是默认的 module add --module-root-dir=/path/to/my-external-modules/ --name=com.mysql --resources=/path/to/{MySQLDriverJarName} --dependencies=wildflyee.api,java.se
|
| --module-xml |
使用此参数为此新模块提供 |
| --name | 使用此参数提供要添加的模块的名称。此参数是必需的。 |
| --properties |
使用此参数提供逗号分隔的定义模块属性的 |
| --resource-delimiter |
使用此参数为提供给 |
| --resources |
使用此参数通过提供文件系统路径列表来指定此模块的资源。这些文件被复制到此模块目录中,并从其
有关分隔符的详情,请参阅 |
| --slot |
使用这个参数将模块添加到默认 module add --name=com.mysql --slot=8.0 --resources=/path/to/{MySQLDriverJarName} --dependencies=wildflyee.api,java.se
|
4.9. periodic-rotating-file-audit-log 属性 复制链接链接已复制到粘贴板!
| 属性 | 描述 |
|---|---|
|
|
指定输出流是否在每个审计事件后清除。如果没有定义属性,则 |
|
|
指定审计文件编码。默认值为
|
|
|
使用 |
|
| 定义日志文件的位置。 |
|
| 可选属性。定义日志文件的位置。 |
|
|
可选属性。在轮转的日志中添加日期后缀。您必须使用 |
|
|
默认值为 |
4.10. sasl-authentication-factory 属性 复制链接链接已复制到粘贴板!
您可以通过设置其属性来配置 sasl-authentication-factory。
| 属性 | 描述 |
|---|---|
| mechanism-configurations | 特定于机制的配置列表。 |
| sasl-server-factory | SASL 服务器与这个资源关联。 |
| security-domain | 与此资源关联的安全域。 |
| 属性 | 描述 |
|---|---|
| credential-security-factory | 用于获取机制所要求的凭证的安全因素。 |
| final-principal-transformer | 应用于此机制域的最后一个主体转换器。 |
| host-name | 此配置应用到的主机名。 |
| mechanism-name | 此配置仅应用于使用指定名称机制的情况。如果省略此属性,则它将匹配任何机制名称。 |
| mechanism-realm-configurations | 机制理解的域名称的定义的列表。 |
| protocol | 此配置适用的协议。 |
| post-realm-principal-transformer | 选择域之后要应用的主体转换器。 |
| pre-realm-principal-transformer | 在选择域之前要应用的主体转换器。 |
| realm-mapper | 机制使用的 realm mapper。 |
| 属性 | 描述 |
|---|---|
| final-principal-transformer | 应用于此机制域的最后一个主体转换器。 |
| post-realm-principal-transformer | 选择域之后要应用的主体转换器。 |
| pre-realm-principal-transformer | 在选择域之前要应用的主体转换器。 |
| realm-mapper | 机制使用的 realm mapper。 |
| realm-name | 按机制要显示的域的名称。 |
4.11. security-domain 属性 复制链接链接已复制到粘贴板!
您可以通过设置其属性来配置 security-domain。
| 属性 | 描述 |
|---|---|
| default-realm | 此安全域中包含的默认域。 |
| evidence-decoder | 对此域所使用的 EvidenceDecoder 的引用。 |
| outflow-anonymous | 此属性指定在无法流向安全域时应使用匿名身份,这在以下情况下发生:
出版匿名身份会清除之前为该域建立的任何身份。 |
| outflow-security-domains | 来自此域的安全身份应自动流向的安全域的列表。 |
| permission-mapper | 对此域使用的 PermissionMapper 的引用。 |
| post-realm-principal-transformer | 在域对提供的身份名称执行操作后,要应用的主体转换器的引用。 |
| pre-realm-principal-transformer | 在选择域之前对要应用的主体转换器的引用。 |
| principal-decoder | 对此域要使用的 PrincipalDecoder 的引用。 |
| realm-mapper | 对此域要使用的 RealmMapper 的引用。 |
| realms | 此安全域包含的域的列表。 |
| role-decoder | 对此域要使用的 RoleDecoder 的引用。 |
| role-mapper | 对此域要使用的 RoleMapper 的引用。 |
| security-event-listener | 对安全事件的监听程序的引用。 |
| trusted-security-domains | 此安全域信任的安全域的列表。 |
| trusted-virtual-security-domains | 此安全域信任的虚拟安全域的列表。 |
4.12. simple-role-decoder 属性 复制链接链接已复制到粘贴板!
您可以通过设置其属性来配置简单的角色解码器。
| 属性 | 描述 |
|---|---|
| attribute | 身份直接映射到角色的属性的名称。 |
4.13. size-rotating-file-audit-log 属性 复制链接链接已复制到粘贴板!
| 属性 | 描述 |
|---|---|
|
|
指定输出流是否在每个审计事件后清除。如果没有定义属性,则 |
|
|
指定审计文件编码。默认值为
|
|
|
默认值为 |
|
|
轮转时要备份的最大文件数。默认值为: |
|
| 定义日志文件的位置。 |
|
| 可选属性。定义日志文件的位置。 |
|
|
默认情况下,当您重新启动服务器时,Elytron 不会创建新的日志文件。将此属性设置为 |
|
|
日志文件在 Elytron 轮转日志前可以达到的最大大小。默认值为 |
|
|
可选属性。在轮转的日志中添加日期后缀。您必须使用 |
|
|
默认值为 |
4.14. syslog-audit-log attributes 复制链接链接已复制到粘贴板!
| 属性 | 描述 |
|---|---|
|
| 记录审计事件的格式。 支持的值:
默认值:
|
|
| 要嵌入到发送到 syslog 服务器的所有事件的主机名。 |
|
|
|
|
|
Elytron 在关闭连接前尝试向 支持的值:
默认值:
|
|
|
|
|
|
连接到 |
|
| 用于描述审计事件的 RFC 格式。 支持的值:
默认值:
|
|
|
用于连接到 支持的值:
默认值:
|