2.6.2. 使用聚合域配置身份验证和授权
要使用聚合域配置身份验证和授权,请创建一个聚合域,并配置安全域和应用安全域以使用聚合域。
先决条件
- 配置要聚合的安全域。 - 有关配置安全域的详情,请参考 如何配置身份管理指南中的 Elytron 子系统。 
- 配置要在安全域中使用的角色解码器。 - 有关角色解码器的详情,请参阅如何配置服务器安全指南中的创建 Elytron Role Decoder。 
流程
- 创建聚合域: - 使用一个授权域创建聚合域: - /subsystem=elytron/aggregate-realm=exampleAggregateRealm:add(authentication-realm=__SECURITY_REALM_FOR_AUTHENTICATION__, authorization-realm=__SECURITY_REALM_FOR_AUTHORIZATION__) - /subsystem=elytron/aggregate-realm=exampleAggregateRealm:add(authentication-realm=__SECURITY_REALM_FOR_AUTHENTICATION__, authorization-realm=__SECURITY_REALM_FOR_AUTHORIZATION__)- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- 创建具有多个授权域的聚合域: - /subsystem=elytron/aggregate-realm=exampleAggregateRealm: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=exampleAggregateRealm: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 
 
- 配置 - security-domain:- /subsystem=elytron/security-domain=exampleAggregateRealmSD:add(realms=[{realm=exampleAggregateRealm,role-decoder=__ROLE-DECODER__}],default-realm=exampleAggregateRealm,permission-mapper=default-permission-mapper)- /subsystem=elytron/security-domain=exampleAggregateRealmSD:add(realms=[{realm=exampleAggregateRealm,role-decoder=__ROLE-DECODER__}],default-realm=exampleAggregateRealm,permission-mapper=default-permission-mapper)- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- 在 - undertow子系统中配置- application-security-domain:- /subsystem=undertow/application-security-domain=exampleAggregareRealmApplicationDomain:add(security-domain=exampleAggregateRealmSD) - /subsystem=undertow/application-security-domain=exampleAggregareRealmApplicationDomain:add(security-domain=exampleAggregateRealmSD)- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- 配置应用程序的 - web.xml和- jboss-web.xml:- 您的 - web.xml和- jboss-web.xml必须更新为使用您在 JBoss EAP 中配置的- application-security-domain。例如,将 Web 应用程序配置为使用 Elytron 或传统安全性进行身份验证。