Search in sources :

Example 6 with AccountSshKey

use of com.google.gerrit.server.account.AccountSshKey in project gerrit by GerritCodeReview.

the class VersionedAuthorizedKeysOnInit method addKey.

public AccountSshKey addKey(String pub) {
    checkState(keys != null, "SSH keys not loaded yet");
    int seq = keys.isEmpty() ? 1 : keys.size() + 1;
    AccountSshKey key = new VersionedAuthorizedKeys.SimpleSshKeyCreator().create(accountId, seq, pub);
    keys.add(Optional.of(key));
    return key;
}
Also used : AccountSshKey(com.google.gerrit.server.account.AccountSshKey) VersionedAuthorizedKeys(com.google.gerrit.server.account.VersionedAuthorizedKeys)

Aggregations

AccountSshKey (com.google.gerrit.server.account.AccountSshKey)6 InvalidSshKeyException (com.google.gerrit.exceptions.InvalidSshKeyException)2 Strings (com.google.common.base.Strings)1 ByteSource (com.google.common.io.ByteSource)1 Account (com.google.gerrit.entities.Account)1 GroupReference (com.google.gerrit.entities.GroupReference)1 InternalGroup (com.google.gerrit.entities.InternalGroup)1 EmailException (com.google.gerrit.exceptions.EmailException)1 NoSuchGroupException (com.google.gerrit.exceptions.NoSuchGroupException)1 SshKeyInput (com.google.gerrit.extensions.api.accounts.SshKeyInput)1 AuthType (com.google.gerrit.extensions.client.AuthType)1 BadRequestException (com.google.gerrit.extensions.restapi.BadRequestException)1 RawInput (com.google.gerrit.extensions.restapi.RawInput)1 ResourceNotFoundException (com.google.gerrit.extensions.restapi.ResourceNotFoundException)1 ConsoleUI (com.google.gerrit.pgm.init.api.ConsoleUI)1 InitFlags (com.google.gerrit.pgm.init.api.InitFlags)1 InitStep (com.google.gerrit.pgm.init.api.InitStep)1 SequencesOnInit (com.google.gerrit.pgm.init.api.SequencesOnInit)1 AccountResource (com.google.gerrit.server.account.AccountResource)1 AccountState (com.google.gerrit.server.account.AccountState)1