public class VersionedAuthorizedKeys extends VersionedMetaData
The `authorized_keys' files stores the public SSH keys of the user. The file format matches the standard SSH file format, which means that each key is stored on a separate line (see https://en.wikibooks.org/wiki/OpenSSH/Client_Configuration_Files#.7E.2F.ssh.2Fauthorized_keys).
The order of the keys in the file determines the sequence numbers of the keys. The first line corresponds to sequence number 1.
Invalid keys are marked with the prefix # INVALID
.
To keep the sequence numbers intact when a key is deleted, a # DELETED
line is
inserted at the position where the key was deleted.
Other comment lines are ignored on read, and are not written back when the file is modified.
Modifier and Type | Class and Description |
---|---|
static class |
VersionedAuthorizedKeys.Accessor |
static interface |
VersionedAuthorizedKeys.Factory |
static class |
VersionedAuthorizedKeys.SimpleSshKeyCreator |
VersionedMetaData.BatchMetaDataUpdate, VersionedMetaData.PathInfo
inserter, newTree, reader, revision
Constructor and Description |
---|
VersionedAuthorizedKeys(SshKeyCreator sshKeyCreator,
Account.Id accountId) |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
getRefName() |
protected void |
onLoad()
Set up the metadata, parsing any state from the loaded revision.
|
protected boolean |
onSave(org.eclipse.jgit.lib.CommitBuilder commit)
Save any changes to the metadata in a commit.
|
void |
setKeys(java.util.Collection<AccountSshKey> newKeys)
Sets new SSH keys.
|
commit, commitToNewRef, getObjectId, getPathInfos, getRevision, load, load, load, load, load, openUpdate, readConfig, readFile, readTree, readUTF8, saveConfig, saveFile, saveUTF8, set, set, set
@Inject public VersionedAuthorizedKeys(SshKeyCreator sshKeyCreator, Account.Id accountId)
protected java.lang.String getRefName()
getRefName
in class VersionedMetaData
protected void onLoad() throws java.io.IOException
VersionedMetaData
onLoad
in class VersionedMetaData
java.io.IOException
protected boolean onSave(org.eclipse.jgit.lib.CommitBuilder commit) throws java.io.IOException
VersionedMetaData
onSave
in class VersionedMetaData
java.io.IOException
public void setKeys(java.util.Collection<AccountSshKey> newKeys)
The existing SSH keys are overwritten.
newKeys
- the new public SSH keys