1.2. Elytron 中的凭证类型
Elytron 提供了以下三种凭证类型来满足您的各种安全需求,您可将这些凭据存储在 Elytron 的凭据存储中。
- PasswordCredential
使用这个凭证类型,您可以安全地存储纯文本或未加密的密码。对于需要密码的 JBoss EAP 资源,请使用指向 PasswordCredential 而不是纯文本密码的引用来维护密码的保密。
连接到数据库的示例
data-source add ... --user-name=db_user --password=StrongPassword
data-source add ... --user-name=db_user --password=StrongPassword
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 在这个示例数据库连接命令中,您可以看到密码:
StrongPassword
。这意味着其他人也可以在服务器配置文件中看到它。使用 PasswordCredential 连接到数据库的示例
data-source add ... --user-name=db_user --credential-reference={store=exampleKeyStoreCredentialStore, alias=passwordCredentialAlias}
data-source add ... --user-name=db_user --credential-reference={store=exampleKeyStoreCredentialStore, alias=passwordCredentialAlias}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 当使用凭证引用而不是密码连接到数据库时,其他人只能看到配置文件中的凭证引用,而不是您的密码
- KeyPairCredential
您可以将 Secure Shell(SSH)和公钥密码标准(PKCS)密钥对用作 KeyPairCredential。密钥对包括共享的公钥和只有给定用户知道的私钥。
您只能使用 WildFly Elytron 工具管理 KeyPairCredential。
- SecretKeyCredential
- SecretKeyCredential 是高级加密标准(AES)密钥,可用于在 Elytron 中创建加密的表达式。