使用提供的 CredentialTypeDemo.java 包 SDK 文件,并在 Automation 360 locker 操作中的密码字段配置 CredentialAllowPassword 注解。

示例: 查看 CredentialTypeDemo.java

使用位于 <latest package-sdk>2.0.9\src\main\java\com\automationanywhere\botcommand\samples\commands\basic\types 的以下 CredentialTypeDemo.java 文件作为配置凭据属性的示例。

@BotCommand @CommandPkg(label = "[[CredentialTypeDemo.label]]", description = "[[CredentialTypeDemo.description]]", icon = "sample.svg", name = "credentialTypeDemo") public class CredentialTypeDemo { private static Logger logger = LogManager.getLogger(CredentialTypeDemo.class); /** * 要接受凭据,索引中的 {@link AttributeType} 应为 * {@link AttributeType.CREDENTIAL CREDENTIAL}. 一个 {@link SecureString} * 为任何凭据类型提供。 */ @Execute public void printCredentials(@Idx(index = "1", type = AttributeType.CREDENTIAL) @Pkg(label = "[[CredentialTypeDemo.credentials.label]]") SecureString credentials) { // SecureString 提供了多种访问内部数据的方法。 // 让我们尝试获取用户名并将其打印到日志中。 // 将用户名作为字符串获取 String userName = credentials.getInsecureString(); logger.trace("从 getInsecureString 获取的用户名: {}", userName);
示例: 配置凭据属性 @Execute

配置索引类型标签、可选的描述credentialAllowPasswordAttribute。 在创建新包或更新现有包时,使用 CredentialAllowPassword 注解以允许凭据选择器选择标记为密码字段的凭据属性。

@Execute public void printCredentials(@Idx(index = "2", type = AttributeType.CREDENTIAL) @Pkg(label = "[[CredentialTypeDemo.credentialsAllowPasswordAttribute.label]]") @CredentialAllowPassword SecureString credentialAllowPasswordAttribute) {
Control Room 中配置属性

属性名称字段中,输入密码和可选的描述,在输入字段中,选择标准,并输入。 在安全字段中,选择仅在密码或掩码字段上使用属性

Control Room 中使用凭据属性
  • 选择一个凭据字段中,选择凭据。 在属性字段中,选择用户名。 在为用户提供凭据(可选)字段中,选择凭据,然后选择
  • 属性字段中,选择密码。 在提供密码凭据(可选)字段中,选择凭据,然后选择