2.4.3. 使用 JAAS 保护管理接口
JAAS 是 JBoss EAP 用于管理安全性的声明式安全 API。有关 JAAS 和声明性安全性的详情和背景,请参阅红帽 JBoss 企业应用平台安全架构指南中 https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.3/html-single/security_architecture/#declarative_security_and_jaas 的声明安全性和 JAAS 部分。
当 JBoss EAP 实例配置为在ADMIN_ONLY 模式中运行时,不支持使用 JAAS 来保护管理接口。如需有关ADMIN_ONLY 模式的更多信息,请参阅 JBoss EAP 配置指南的 ADMIN_ONLY 模式中运行 JBoss EAP 部分。
要使用 JAAS 在管理接口中进行身份验证,必须执行以下步骤:
创建安全域.
在本例中,使用
UserRoles
登录模块创建了一个安全域,但也可以使用其他登录模块:/subsystem=security/security-domain=UsersLMDomain:add(cache-type=default) /subsystem=security/security-domain=UsersLMDomain/authentication=classic:add /subsystem=security/security-domain=UsersLMDomain/authentication=classic/login-module=UsersRoles:add(code=UsersRoles, flag=required,module-options=[("usersProperties"=>"users.properties"),("rolesProperties"=>"roles.properties")])
/subsystem=security/security-domain=UsersLMDomain:add(cache-type=default) /subsystem=security/security-domain=UsersLMDomain/authentication=classic:add /subsystem=security/security-domain=UsersLMDomain/authentication=classic/login-module=UsersRoles:add(code=UsersRoles, flag=required,module-options=[("usersProperties"=>"users.properties"),("rolesProperties"=>"roles.properties")])
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建具有 JAAS 身份验证的安全域。
/core-service=management/security-realm=SecurityDomainAuthnRealm:add /core-service=management/security-realm=SecurityDomainAuthnRealm/authentication=jaas:add(name=UsersLMDomain)
/core-service=management/security-realm=SecurityDomainAuthnRealm:add /core-service=management/security-realm=SecurityDomainAuthnRealm/authentication=jaas:add(name=UsersLMDomain)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 更新
http-interface
管理接口以使用新的安全域。/core-service=management/management-interface=http-interface/:write-attribute(name=security-realm,value=SecurityDomainAuthnRealm)
/core-service=management/management-interface=http-interface/:write-attribute(name=security-realm,value=SecurityDomainAuthnRealm)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 可选:分配组成员资格。
属性
assign-groups
确定是否将来自安全域的用户成员资格信息用于安全域中的组分配。当设置为true
时,此组分配用于基于角色的访问控制(RBAC)。/core-service=management/security-realm=SecurityDomainAuthnRealm/authentication=jaas:write-attribute(name=assign-groups,value=true)
/core-service=management/security-realm=SecurityDomainAuthnRealm/authentication=jaas:write-attribute(name=assign-groups,value=true)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow