Package sk.iway.iwcm.system.googleauth
Class GoogleAuthenticatorQRGenerator
java.lang.Object
sk.iway.iwcm.system.googleauth.GoogleAuthenticatorQRGenerator
This class provides helper methods to create a QR code containing the
provided credential. The generated QR code can be fed to the Google
Authenticator application so that it can configure itself with the data
contained therein.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
getOtpAuthTotpURL
(String issuer, String accountName, GoogleAuthenticatorKey credentials) Returns the basic otpauth TOTP URI.static String
getOtpAuthURL
(String issuer, String accountName, GoogleAuthenticatorKey credentials) Returns the URL of a Google Chart API call to generate a QR barcode to be loaded into the Google Authenticator application.
-
Constructor Details
-
GoogleAuthenticatorQRGenerator
public GoogleAuthenticatorQRGenerator()
-
-
Method Details
-
getOtpAuthURL
public static String getOtpAuthURL(String issuer, String accountName, GoogleAuthenticatorKey credentials) Returns the URL of a Google Chart API call to generate a QR barcode to be loaded into the Google Authenticator application. The user scans this bar code with the application on their smart phones or enters the secret manually. The current implementation supports the following features:- Label, made up of an optional issuer and an account name.
- Secret parameter.
- Issuer parameter.
- Parameters:
issuer
- The issuer name. This parameter cannot contain the colon (:) character. This parameter can be null.accountName
- The account name. This parameter shall not be null.credentials
- The generated credentials. This parameter shall not be null.- Returns:
- the Google Chart API call URL to generate a QR code containing the provided information.
- See Also:
-
getOtpAuthTotpURL
public static String getOtpAuthTotpURL(String issuer, String accountName, GoogleAuthenticatorKey credentials) Returns the basic otpauth TOTP URI. This URI might be sent to the user via email, QR code or some other method. Use a secure transport since this URI contains the secret. The current implementation supports the following features:- Label, made up of an optional issuer and an account name.
- Secret parameter.
- Issuer parameter.
- Parameters:
issuer
- The issuer name. This parameter cannot contain the colon (:) character. This parameter can be null.accountName
- The account name. This parameter shall not be null.credentials
- The generated credentials. This parameter shall not be null.- Returns:
- an otpauth scheme URI for loading into a client application.
- See Also:
-