設定並使用認證允許密碼註解
使用提供的 CredentialTypeDemo.java 軟件包 SDK 文件,並在 Automation 360 locker 操作中爲密碼字段配置 CredentialAllowPassword 註釋。
使用以下 CredentialTypeDemo.java 文件:最新的 package-sdk>2.0.9\src\main\java\com\automationAnywhere \botcommand\samples\commands\basic \types 作爲如何配置憑據屬性的示例。
@BotCommand
@CommandPkg(label = "[[CredentialTypeDemo.label]]",
description = "[[CredentialTypeDemo.description]]", icon = "sample.svg", name = "credentialTypeDemo")
public class CredentialTypeDemo {
private static Logger logger = LogManager.getLogger(CredentialTypeDemo.class);
/**
* To accept credentials the {@link AttributeType} in index should be
* {@link AttributeType.CREDENTIAL CREDENTIAL}. A {@link SecureString} is
* provided for any credentials type.
*/
@Execute
public void printCredentials(@Idx(index = "1", type = AttributeType.CREDENTIAL)
@Pkg(label = "[[CredentialTypeDemo.credentials.label]]")
SecureString credentials) {
// SecureString provides multiple way to access the data inside.
// Let's try to get the user name and print it in logs.
// To get the username as String
String userName = credentials.getInsecureString();
logger.trace("User name from getInsecureString : {}", userName);
配置 索引、 類型、 標籤、可選描述和 credentialAllowPasswordAttribute。建立新套件或更新現有套件時、請使用 CredentialAllowPassword 附註、讓認證挑選器挑選標示為密碼欄位的認證屬性。
@Execute
public void printCredentials(@Idx(index = "2", type = AttributeType.CREDENTIAL)
@Pkg(label = "[[CredentialTypeDemo.credentialsAllowPasswordAttribute.label]]")
@CredentialAllowPassword SecureString credentialAllowPasswordAttribute) {
設定中的屬性 Control Room
在 “屬性名稱” 字段中,輸入 密碼 和可選 描述,在 “輸入 ”字段中,選擇 “標準”,然後輸入 值。 在安全字段中,選擇 僅在密碼或屏蔽字段上使用屬性。
使用中的認證屬性 Control Room
- 在 Pick a credential (選擇一個憑據)字段中,選擇 Credential(憑據) 在屬性字段中,選擇 用戶名。在 “爲用戶提供憑據(可選) ”字段中,選擇 “憑據”, 然後 選擇。
- 在屬性字段中,選擇 密碼。在 “提供密碼的憑據(可選) ”字段中,選擇 “憑據”, 然後 選擇。