Package com.warrenstrange.googleauth
Class GoogleAuthenticatorConfig
java.lang.Object
com.warrenstrange.googleauth.GoogleAuthenticatorConfig
public class GoogleAuthenticatorConfig extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGoogleAuthenticatorConfig.GoogleAuthenticatorConfigBuilder -
Constructor Summary
Constructors Constructor Description GoogleAuthenticatorConfig() -
Method Summary
Modifier and Type Method Description intgetCodeDigits()Returns the number of digits in the generated code.HmacHashFunctiongetHmacHashFunction()Returns the cryptographic hash function used to calculate the HMAC (Hash-based Message Authentication Code).intgetKeyModulus()Returns the key module.KeyRepresentationgetKeyRepresentation()Returns the key representation.intgetNumberOfScratchCodes()Returns the number of scratch codes to generate.intgetSecretBits()Returns the number of bits of the secret keys to generate.longgetTimeStepSizeInMillis()Returns the time step size, in milliseconds, as specified by RFC 6238.intgetWindowSize()Returns an integer value representing the number of windows of size timeStepSizeInMillis that are checked during the validation process, to account for differences between the server and the client clocks.
-
Constructor Details
-
GoogleAuthenticatorConfig
public GoogleAuthenticatorConfig()
-
-
Method Details
-
getKeyModulus
public int getKeyModulus()Returns the key module.- Returns:
- the key module.
-
getKeyRepresentation
Returns the key representation.- Returns:
- the key representation.
-
getCodeDigits
public int getCodeDigits()Returns the number of digits in the generated code.- Returns:
- the number of digits in the generated code.
-
getNumberOfScratchCodes
public int getNumberOfScratchCodes()Returns the number of scratch codes to generate. We are using Google's default of providing 5 scratch codes.- Returns:
- the number of scratch codes to generate.
-
getTimeStepSizeInMillis
public long getTimeStepSizeInMillis()Returns the time step size, in milliseconds, as specified by RFC 6238. The default value is 30.000.- Returns:
- the time step size in milliseconds.
-
getWindowSize
public int getWindowSize()Returns an integer value representing the number of windows of size timeStepSizeInMillis that are checked during the validation process, to account for differences between the server and the client clocks. The bigger the window, the more tolerant the library code is about clock skews.We are using Google's default behaviour of using a window size equal to 3. The limit on the maximum window size, present in older versions of this library, has been removed.
- Returns:
- the window size.
- See Also:
timeStepSizeInMillis
-
getSecretBits
public int getSecretBits()Returns the number of bits of the secret keys to generate. The length should always be a multiple of 8. The default value is 160 bits, and a value smaller than 128 is disallowed, as recommended by RFC 4226 ยง4.- Returns:
- the secret size in bits.
-
getHmacHashFunction
Returns the cryptographic hash function used to calculate the HMAC (Hash-based Message Authentication Code). This implementation uses the SHA1 hash function by default.- Returns:
- the HMAC hash function.
-