第 3 章 配置具有身份域的 Elytron ,以允许轻松验证和授权本地用户
您可以使用 Elytron 提供的 identity-realm 来允许本地用户连接到 JBoss EAP 管理界面。
JBoss EAP 管理 CLI 被预先配置为使用名为 local 的 identity-realm。这允许本地用户连接,而不用提供凭证。身份域只能与 JBOSS-LOCAL-USER 机制一起使用。
3.1. 保护带有身份域的管理界面 复制链接链接已复制到粘贴板!
您可以使用带有 JBOSS-LOCAL-USER 机制的 identity-realm 安全域来保护管理界面。
先决条件
- JBoss EAP 正在运行。
流程
创建一个本地
identity-realm。语法
/subsystem=elytron/identity-realm=<local_identity_realm_name>:add(identity="$local",attribute-name=<attribute_name>,attribute-values=<attribute_value>)
/subsystem=elytron/identity-realm=<local_identity_realm_name>:add(identity="$local",attribute-name=<attribute_name>,attribute-values=<attribute_value>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/identity-realm=exampleLocalIdentityRealm:add(identity="$local",attribute-name=AttributeName,attribute-values=Value)
/subsystem=elytron/identity-realm=exampleLocalIdentityRealm:add(identity="$local",attribute-name=AttributeName,attribute-values=Value)Copy to Clipboard Copied! Toggle word wrap Toggle overflow 可选 如果要为 $local 以外的本地
identity-realm使用名称,请修改configurable-sasl-server-factory=<sasl_server_factory>中的wildfly.sasl.local-user.default-user属性的值。语法
/subsystem=elytron/configurable-sasl-server-factory=<sasl_server_factory>:write-attribute(name=properties,value={"wildfly.sasl.local-user.default-user" => "<new_local_username>", "wildfly.sasl.local-user.challenge-path" => expression "${jboss.server.temp.dir}/auth"})/subsystem=elytron/configurable-sasl-server-factory=<sasl_server_factory>:write-attribute(name=properties,value={"wildfly.sasl.local-user.default-user" => "<new_local_username>", "wildfly.sasl.local-user.challenge-path" => expression "${jboss.server.temp.dir}/auth"})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/configurable-sasl-server-factory=configured:write-attribute(name=properties,value={"wildfly.sasl.local-user.default-user" => "john", "wildfly.sasl.local-user.challenge-path" => expression "${jboss.server.temp.dir}/auth"})/subsystem=elytron/configurable-sasl-server-factory=configured:write-attribute(name=properties,value={"wildfly.sasl.local-user.default-user" => "john", "wildfly.sasl.local-user.challenge-path" => expression "${jboss.server.temp.dir}/auth"})Copy to Clipboard Copied! Toggle word wrap Toggle overflow
创建一个引用您创建的
identity-realm的安全域。语法
/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<local_identity_realm_name>,permission-mapper=<permission_mapper_name>,realms=[{realm=<Local_identity_realm_name>}])/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<local_identity_realm_name>,permission-mapper=<permission_mapper_name>,realms=[{realm=<Local_identity_realm_name>}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleLocalIdentityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleLocalIdentityRealm}])/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleLocalIdentityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleLocalIdentityRealm}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow 添加 SASL 身份验证工厂。
语法
/subsystem=elytron/sasl-authentication-factory=<sasl_auth_factory_name>:add(security-domain=<security_domain_name>,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=JBOSS-LOCAL-USER}])/subsystem=elytron/sasl-authentication-factory=<sasl_auth_factory_name>:add(security-domain=<security_domain_name>,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=JBOSS-LOCAL-USER}])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=JBOSS-LOCAL-USER}])/subsystem=elytron/sasl-authentication-factory=exampleSaslAuthenticationFactory:add(security-domain=exampleSecurityDomain,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=JBOSS-LOCAL-USER}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow 为您的管理界面启用 SASL 身份验证工厂。
语法
/core-service=management/management-interface=http-interface:write-attribute(name=http-upgrade,value={enabled=true,sasl-authentication-factory=<sasl_auth_factory_name>})/core-service=management/management-interface=http-interface:write-attribute(name=http-upgrade,value={enabled=true,sasl-authentication-factory=<sasl_auth_factory_name>})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/core-service=management/management-interface=http-interface:write-attribute(name=http-upgrade,value={enabled=true,sasl-authentication-factory=exampleSaslAuthenticationFactory})/core-service=management/management-interface=http-interface:write-attribute(name=http-upgrade,value={enabled=true,sasl-authentication-factory=exampleSaslAuthenticationFactory})Copy to Clipboard Copied! Toggle word wrap Toggle overflow 重新加载您的管理界面。
reload
$ reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow