Class MockTwoFactorPasswordGenerator
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.auth.MockTwoFactorPasswordGenerator
-
- All Implemented Interfaces:
TwoFactorPasswordGenerator
public class MockTwoFactorPasswordGenerator extends Object implements TwoFactorPasswordGenerator
-
-
Constructor Summary
Constructors Constructor Description MockTwoFactorPasswordGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<Integer>
generatePasswords(String secretKey, long timestamp)
Generates and returns all TOTP passwords that will be considered as correct, using secret key and UNIX timestamp.Set<String>
generateRecoveryKeys()
Generates set of recovery keys with cryptographically strong generator.String
generateSecretKey()
Generates secret key with cryptographically strong generatorvoid
reset()
void
setCorrectPassword(String mockSecretKey, int password)
void
setCorrectPasswords(String mockSecretKey, Set<Integer> passwords)
-
-
-
Method Detail
-
generatePasswords
@NotNull public Set<Integer> generatePasswords(@NotNull String secretKey, long timestamp)
Description copied from interface:TwoFactorPasswordGenerator
Generates and returns all TOTP passwords that will be considered as correct, using secret key and UNIX timestamp. The multiple correct passwords are allowed to prevent time desynchroniation between client and server. For example, password from previous 30-sec. epoch can be allowed.- Specified by:
generatePasswords
in interfaceTwoFactorPasswordGenerator
- Parameters:
secretKey
- secret keytimestamp
- current UNIX timestamp in seconds- Returns:
- set of all correct password
-
setCorrectPasswords
public void setCorrectPasswords(@NotNull String mockSecretKey, @NotNull Set<Integer> passwords)
-
setCorrectPassword
public void setCorrectPassword(@NotNull String mockSecretKey, int password)
-
generateSecretKey
@NotNull public String generateSecretKey()
Description copied from interface:TwoFactorPasswordGenerator
Generates secret key with cryptographically strong generator- Specified by:
generateSecretKey
in interfaceTwoFactorPasswordGenerator
- Returns:
- generated secret key
-
generateRecoveryKeys
@NotNull public Set<String> generateRecoveryKeys()
Description copied from interface:TwoFactorPasswordGenerator
Generates set of recovery keys with cryptographically strong generator.- Specified by:
generateRecoveryKeys
in interfaceTwoFactorPasswordGenerator
- Returns:
- set with generated recovery keys
-
reset
public void reset()
-
-