1.7. 使用 Elytron 客户端的凭证存储示例
连接到 JBoss EAP(如 Jakarta Enterprise Bean)的客户端可以使用 Elytron 客户端进行身份验证。无法访问正在运行的 JBoss EAP 服务器的用户可以使用 WildFly Elytron 工具创建和修改凭证存储,然后客户端可以使用 Elytron 客户端访问凭证存储中的敏感字符串。
以下示例演示了如何在 Elytron 客户端配置文件中使用凭证存储。
带有 Credential Store 的 custom-config.xml 示例
<configuration>
<authentication-client xmlns="urn:elytron:client:1.7">
...
<credential-stores>
<credential-store name="my_store">
<protection-parameter-credentials>
<credential-store-reference clear-text="pass123"/>
</protection-parameter-credentials>
<attributes>
<attribute name="location" value="/path/to/my_store.jceks"/>
</attributes>
</credential-store>
</credential-stores>
...
<authentication-configurations>
<configuration name="my_user">
<set-host name="localhost"/>
<set-user-name name="my_user"/>
<set-mechanism-realm name="ManagementRealm"/>
<use-provider-sasl-factory/>
<credentials>
<credential-store-reference store="my_store" alias="my_user"/>
</credentials>
</configuration>
</authentication-configurations>
...
</authentication-client>
</configuration>