Search in sources :

Example 1 with TwoFactorRecoveryKeys

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);
}
Also used : TwoFactorRecoveryKeys(jetbrains.buildServer.server.rest.model.user.TwoFactorRecoveryKeys) UUID(java.util.UUID) TwoFactorCredentials(jetbrains.buildServer.server.rest.model.user.TwoFactorCredentials) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

UUID (java.util.UUID)1 TwoFactorCredentials (jetbrains.buildServer.server.rest.model.user.TwoFactorCredentials)1 TwoFactorRecoveryKeys (jetbrains.buildServer.server.rest.model.user.TwoFactorRecoveryKeys)1 NotNull (org.jetbrains.annotations.NotNull)1