https://github.com/citrix/citrix-auth-mfa-script-samples
https://github.com/citrix/citrix-auth-mfa-script-samples
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/citrix/citrix-auth-mfa-script-samples
- Owner: citrix
- Created: 2022-10-06T17:53:39.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-17T21:21:09.000Z (about 3 years ago)
- Last Synced: 2025-01-27T06:43:18.416Z (about 1 year ago)
- Language: C#
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Examples of scripts for authentication against Citrix MFA
Includes examples for Javascript, Python and C#
All examples use Selenium and an external library to calculate the TOTP code for MFA.
The MFA_SECRET in each example is the MFA key or secret generated at the time of registering an MFA device.
Citrix displays the QR and the key. The QR code contains the key, but the key can be copied down and supplied to the scripts below.
The same key can be used in multiple devices and they will generate the same TOTP code so long as the client and server clocks are in sync.
## C#
TOTP Library: **TwoStepsAuthenticator** - (https://github.com/glacasa/TwoStepsAuthenticator)
Required Nuget Packages:
- DotNetSeleniumExtras.WaitHelpers
- Selenium.WebDriver
- Selenium.WebDriver.ChromeDriver
- TwoStepsAuthenticator
TOTP code Example:
```
var authenticator = new TwoStepsAuthenticator.TimeAuthenticator();
var code = authenticator.GetCode(MFA_SECRET);
```
## Python
TOTP Library: **Pythoauth** - (https://github.com/pyauth/pyotp)
Python Packages:
- pyotp
- Selenium
TOTP code Example:
```
var totp = pyotp.TOTP(MFA_SECRET)
var code = totp.now()
```
## Javascript
TOTP Library: **OTPLib** - (https://github.com/yeojz/otplib)
Uses NodeJS. Requires the packages:
- selenium-webdriver
- otplib
TOTP code Example:
```
const otplib = require('otplib');
const secret = 'mfaSecret';
const token = otplib.authenticator.generate(MFA_SECRET);
```