Custom Interface

The Custom interface type is used to interact with interfaces that are not defined as dedicated interface types in Fabric, such as SSH or any interface that requires a user, password, port and host.

A Custom interface type can be used to store encrypted passwords. For example, to connect to a website using a user and a password, use the getCustomProperties API in the user code to get the password's original value.

To create a new interface, do the following:

  1. Go to Project Tree > Shared Objects, right click Interfaces, select New Interface and then select Custom from the Interface Type dropdown menu to open the New Interface window.

    image

  2. Populate the connection's settings and click Save.

Connection Settings

 Parameter  Description
 Host  Hostname or IP address of the server.
 Port  Port ID.
 User  Username.
 Password  Password.
 Data  Any additional parameters defined for the customer interface.

Example of Using a Custom Interface to Connect to a Session

  1. Define a Custom interface.

  2. In the Fabric user code, get the connection's details using the getCustomProperties() API as follows:

String remoteFile = "/home/k2view/Test-Automaton-Report.html";
Map<String, String> props = getCustomProperties("CustomInterface");
String user = props.get("User");
String password = props.get("Password");
String host = props.get("Host");
int port = Integer.parseInt(props.get("Port"));
JSch jsch = new JSch();
Session session = jsch.getSession(user, host, port);
session.setPassword(password);
session.connect();
log.info("Connection established.");
ChannelSftp sftpChannel = (ChannelSftp) session.openChannel("sftp");
sftpChannel.connect();
log.info("SFTP Channel created.");
InputStream inputStream = sftpChannel.get(remoteFile);

Example of Using a Custom Interface to Encode a Password

  1. Define a Custom interface type.
  2. In the Fabric user code, get the connection's details using the getCustomProperties() API as follows:
Map <String,String> mapInterface = getCustomProperties("myCustInterface");
final String USERNAME = mapInterface.get("User");
final String PASSWORD = mapInterface.get("Password");

String encodedUPass = Base64.getEncoder().encodeToString((USERNAME+":"+PASSWORD).getBytes(StandardCharsets.UTF_8.name()));

Previous

Custom Interface

The Custom interface type is used to interact with interfaces that are not defined as dedicated interface types in Fabric, such as SSH or any interface that requires a user, password, port and host.

A Custom interface type can be used to store encrypted passwords. For example, to connect to a website using a user and a password, use the getCustomProperties API in the user code to get the password's original value.

To create a new interface, do the following:

  1. Go to Project Tree > Shared Objects, right click Interfaces, select New Interface and then select Custom from the Interface Type dropdown menu to open the New Interface window.

    image

  2. Populate the connection's settings and click Save.

Connection Settings

 Parameter  Description
 Host  Hostname or IP address of the server.
 Port  Port ID.
 User  Username.
 Password  Password.
 Data  Any additional parameters defined for the customer interface.

Example of Using a Custom Interface to Connect to a Session

  1. Define a Custom interface.

  2. In the Fabric user code, get the connection's details using the getCustomProperties() API as follows:

String remoteFile = "/home/k2view/Test-Automaton-Report.html";
Map<String, String> props = getCustomProperties("CustomInterface");
String user = props.get("User");
String password = props.get("Password");
String host = props.get("Host");
int port = Integer.parseInt(props.get("Port"));
JSch jsch = new JSch();
Session session = jsch.getSession(user, host, port);
session.setPassword(password);
session.connect();
log.info("Connection established.");
ChannelSftp sftpChannel = (ChannelSftp) session.openChannel("sftp");
sftpChannel.connect();
log.info("SFTP Channel created.");
InputStream inputStream = sftpChannel.get(remoteFile);

Example of Using a Custom Interface to Encode a Password

  1. Define a Custom interface type.
  2. In the Fabric user code, get the connection's details using the getCustomProperties() API as follows:
Map <String,String> mapInterface = getCustomProperties("myCustInterface");
final String USERNAME = mapInterface.get("User");
final String PASSWORD = mapInterface.get("Password");

String encodedUPass = Base64.getEncoder().encodeToString((USERNAME+":"+PASSWORD).getBytes(StandardCharsets.UTF_8.name()));

Previous