Package ch.autumo.beetroot.utils.web
Class TwoFA
java.lang.Object
ch.autumo.beetroot.utils.web.TwoFA
2-FA Google Authenticator.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringcreate6DigitTOTPCode(String secretUserKey) Create 5-digit TOTP (time-based one-time password) code for a user secret key.static StringcreateQRCode(String barCodeData, int height, int width) Create QR code.static StringGenerate a secret user key with specific length.static StringcreateSecretUserKey(int len) Generate a secret user key with specific length.static StringgetGoogleAuthenticatorBarCode(String secretUserKey, String email) Create Google Authenticator bar code.
-
Constructor Details
-
TwoFA
public TwoFA()
-
-
Method Details
-
createSecretUserKey
Generate a secret user key with specific length. Note: Only initially for every user once!- Returns:
- secret user key
-
createSecretUserKey
Generate a secret user key with specific length. Note: Only initially for every user once!- Parameters:
len- length- Returns:
- secret user key
-
create6DigitTOTPCode
Create 5-digit TOTP (time-based one-time password) code for a user secret key.- Parameters:
secretUserKey- secret user key- Returns:
- code
-
getGoogleAuthenticatorBarCode
public static String getGoogleAuthenticatorBarCode(String secretUserKey, String email) throws UtilsException Create Google Authenticator bar code.- Parameters:
secretUserKey- secret user keyemail- email of user- Returns:
- bar code
- Throws:
UtilsException- utilities exception
-
createQRCode
Create QR code.- Parameters:
barCodeData- Google authenticator bar code.height- height of QR code imagewidth- width of QR code image- Returns:
- path to QR code image file
- Throws:
UtilsException- utilities exception
-