PasswordUtil Object

Description

Enables you to use a credential management service to manage secrets and passwords used in your UFT One tests.

Currently, UFT One supports only AWS Secrets Manager and Azure Key Vault service.

Methods

Method ConnectConnects UFT One to a credential management service.
Method DisconnectDisconnects UFT One from a credential management service.
Method GetSecret

Gets the value of a secret stored in a credential management service.

Method ListSecretsLists the names of secrets stored in a credential management service.
Method SetSecret

Creates a secret to be saved in a credential management service.

Method SettingEnables you to configure settings for connecting to a credential management service.

Back to top

Connect Method

Description

Connects UFT One to a credential management service.

Syntax

PasswordUtil.Connect(serviceName, [settings])

Argument

Type

Description

serviceName

String

The credential management service you want UFT One to connect to.

Possible values:

  • Azure Key Vault

  • AWS Secrets Manager

  • Empty string

settingsString

Optional. The settings required to connect to a credential management service.

Return Value

A Boolean.

IMPORTANT

Use one of the following ways to connect to a credential management service:

  • Define the connection information in the Tools > Options > GUI Testing > Credential Manager pane and then use the Connect method (use an empty string as serviceName and leave settings empty). See the example.

    Note: In this case, UFT One connects to only the credential management service selected in the Credential Manager pane.

  • Define the connection information using the Setting method and then use the Connect method with serviceName set to a service. See the example.

  • Use only the Connect method with both parameters specified. See the example.

Example

Back to top

Disconnect Method

Description

Disconnects UFT One from a credential management service.

Syntax

PasswordUtil.Disconnect([serviceName])

Argument

Type

Description

serviceName

String

Optional. The credential management service you want UFT One to disconnect from.

Possible values:

  • Azure Key Vault

  • AWS Secrets Manager

Return Value

None.

IMPORTANT

To connect to a different credential management service, make sure to add a PasswordUtil.Disconnect step to disconnect from the current connection.

Back to top

GetSecret Method

Description

Gets the value of a secret stored in a credential management service.

Syntax

PasswordUtil.GetSecret(name)

Argument

Type

Description

name

String

The name of a secret stored in a credential management service.

Return Value

A string.

Back to top

ListSecrets Method

Description

Lists the names of secrets stored in a credential management service.

Syntax

PasswordUtil.ListSecrets

Return Value

A string array.

Back to top

SetSecret Method

Description

Creates a secret to be saved in a credential management service.

Syntax

PasswordUtil.SetSecret(name, value)

Argument

Type

Description

name

String

The name of a secret to be saved in a credential management service.

value

String

The value of the secret.

Note: For a secret to be saved in AWS Secrets Manager, you can set the value to a single string or a JSON string with key-value pairs. However, a single string cannot be converted to a key-value secret on AWS Secrets Manager service page.

  • PasswordUtil.SetSecret "UFTPlaintext", "Secret"

  • PasswordUtil.SetSecret "UFTKeyValue", "{"SecretKey": "SecretValue"}"

Return Value

None

IMPORTANT

Make sure that you specify the KMS key ID before you use this method to create a secret in AWS Secrets Manager. You can either define the KMS key ID in the Tools > Options > GUI Testing > Credential Manager pane or use the Setting Method.

Back to top

Setting Method

Description

Enables you to configure settings for connecting to a credential management service.

Syntax

PasswordUtil.Setting(name, value)

Argument

Type

Description

name

String

The name of a parameter used for connecting to a credential management service.

Possible values:

  • tenantId: The ID of your Azure tenant.

  • clientId: The ID of your Azure client.

  • clientSecret: The password of your Azure client.

  • keyVaultName: The name of a key vault.

  • regionEndpoint: The endpoint of an AWS region.

  • accessKeyId: The AWS access key ID.

  • secretAccessKey: The AWS secret access key.

  • kmsKeyId: The KMS key ID. This parameter is optional in most cases but is mandatory when you specify the value of a secret to be stored in AWS Secrets Manager.

value

String

The value of the parameter.

Return Value

None

IMPORTANT

  • To successfully connect to Azure Key Vault service, you must specify the values of tenantId, clientId, clientSecret, and keyVaultName.

  • To successfully connect to AWS Secrets Manager service, you must specify the values of regionEndpoint, accessKeyId, and secretAccessKey.

  • This method overwrites the existing connection information defined in the Tools > Options > GUI Testing > Credential Manager pane.

Back to top

See also: