Package com.google.gerrit.server.account
Class VersionedAuthorizedKeys
java.lang.Object
com.google.gerrit.server.git.meta.VersionedMetaData
com.google.gerrit.server.account.VersionedAuthorizedKeys
'authorized_keys' file in the refs/users/CD/ABCD branches of the All-Users repository.
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Read/write SSH keys by user ID.static interface
static class
Nested classes/interfaces inherited from class com.google.gerrit.server.git.meta.VersionedMetaData
VersionedMetaData.BatchMetaDataUpdate, VersionedMetaData.PathInfo
-
Field Summary
Fields inherited from class com.google.gerrit.server.git.meta.VersionedMetaData
inserter, newTree, projectName, reader, revision, rw
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Returns name of the reference storing this configuration.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
(Collection<AccountSshKey> newKeys) Sets new SSH keys.Methods inherited from class com.google.gerrit.server.git.meta.VersionedMetaData
commit, commit, commit, commitToNewRef, getObjectId, getPathInfos, getRevision, load, load, load, load, load, openUpdate, openUpdate, readConfig, readConfig, readFile, readTree, readUTF8, saveConfig, saveFile, saveUTF8, set, set, set
-
Constructor Details
-
VersionedAuthorizedKeys
-
-
Method Details
-
getRefName
Description copied from class:VersionedMetaData
Returns name of the reference storing this configuration.- Specified by:
getRefName
in classVersionedMetaData
-
onLoad
Description copied from class:VersionedMetaData
Set up the metadata, parsing any state from the loaded revision.- Specified by:
onLoad
in classVersionedMetaData
- Throws:
IOException
-
onSave
Description copied from class:VersionedMetaData
Save any changes to the metadata in a commit.- Specified by:
onSave
in classVersionedMetaData
- Returns:
- true if the commit should proceed, false to abort.
- Throws:
IOException
-
setKeys
Sets new SSH keys.The existing SSH keys are overwritten.
- Parameters:
newKeys
- the new public SSH keys
-