In cases where it is desirable for an operator to be able to log into an InteractX Runtime workstation without having to type in a username and password, VBA can help log them in automatically. This allows the username and password to be supplied from any source.
[Link to sample: VBALoginExample.zip]
Possible use cases are:
- Logging in with an RFID tag and an RFID scanner connected to the PLC
- Logging in via a selection table in InteractX
- Logging in based on logic in the PLC
InteractX ships with a function called
LoginUser() that can be used to log a user in with a username and password given as a string:
Private Sub bLogin_ChangeValue(ByVal NewValue As Variant) ' Attempt login with given information. Dim retVal As Variant retVal = Application.LoginUser(Tags.strLoginString.Value, "password") End Sub
The sample included in this article shows one practical implementation of this feature. In the sample, a user is logged in whenever the value of the
bLogin local changes. This tag and the
strLoginString tag could easily be provided by a PLC to automate the login process.
Another potential use case is for two-factor authentication using "something you have" and "something you know" (coded badge and password respectively). By requiring the operator to supply a password in addition to an identity token, like an RFID badge code sent from the PLC, security can be enhanced.