use of jetbrains.buildServer.server.rest.model.user.TwoFactorRecoveryKeys in project teamcity-rest by JetBrains.
the class TwoFactorSecretKeysUpdater method generateAndSetDraftCredentials.
/**
* Generates draft credentials to be confirmed for given user and writes them in temporary storage.
* Returns secret key, recovery keys and UUID for confirmation
*
* @param user owner of new credentials
* @return unconfirmed {@link TwoFactorCredentials}
*/
@NotNull
public TwoFactorCredentials generateAndSetDraftCredentials(@NotNull final SUser user) {
final String generatedKey = myGenerator.generateSecretKey();
final Set<String> generatedRecoveryKeys = myGenerator.generateRecoveryKeys();
final UUID uuid = myManager.addDraftCredentials(user, generatedKey, generatedRecoveryKeys);
return new TwoFactorCredentials(generatedKey, new TwoFactorRecoveryKeys(generatedRecoveryKeys), uuid);
}
Aggregations