Class ExternalIdReader
java.lang.Object
com.google.gerrit.server.account.externalids.storage.notedb.ExternalIdReader
Class to read external IDs from NoteDb.
In NoteDb external IDs are stored in the All-Users repository in a Git Notes branch called refs/meta/external-ids where the sha1 of the external ID is used as note name. Each note content is a git config file that contains an external ID. It has exactly one externalId subsection with an accountId and optionally email and password:
[externalId "username:jdoe"] accountId = 1003407 email = [email protected] password = bcrypt:4:LCbmSBDivK/hhGVQMfkDpA==:XcWn0pKYSVU/UJgOvhidkEtmqCp6oKB7
-
Constructor Summary
ConstructorsConstructorDescriptionExternalIdReader
(GitRepositoryManager repoManager, AllUsersName allUsersName, com.google.gerrit.metrics.MetricMaker metricMaker, ExternalIdFactoryNoteDbImpl externalIdFactory, AuthConfig authConfig) -
Method Summary
Modifier and TypeMethodDescriptioncom.google.common.collect.ImmutableSet<ExternalId>
all
(org.eclipse.jgit.lib.ObjectId rev) Reads and returns all external IDs from the specified revision of therefs/meta/external-ids
branch.void
static org.eclipse.jgit.notes.NoteMap
readNoteMap
(org.eclipse.jgit.revwalk.RevWalk rw, org.eclipse.jgit.lib.ObjectId rev) org.eclipse.jgit.lib.ObjectId
static org.eclipse.jgit.lib.ObjectId
readRevision
(org.eclipse.jgit.lib.Repository repo) void
setFailOnLoad
(boolean failOnLoad)
-
Constructor Details
-
ExternalIdReader
@Inject public ExternalIdReader(GitRepositoryManager repoManager, AllUsersName allUsersName, com.google.gerrit.metrics.MetricMaker metricMaker, ExternalIdFactoryNoteDbImpl externalIdFactory, AuthConfig authConfig)
-
-
Method Details
-
readRevision
public static org.eclipse.jgit.lib.ObjectId readRevision(org.eclipse.jgit.lib.Repository repo) throws IOException - Throws:
IOException
-
readNoteMap
public static org.eclipse.jgit.notes.NoteMap readNoteMap(org.eclipse.jgit.revwalk.RevWalk rw, org.eclipse.jgit.lib.ObjectId rev) throws IOException - Throws:
IOException
-
setFailOnLoad
public void setFailOnLoad(boolean failOnLoad) -
checkReadEnabled
- Throws:
IOException
-
readRevision
- Throws:
IOException
-
all
public com.google.common.collect.ImmutableSet<ExternalId> all(org.eclipse.jgit.lib.ObjectId rev) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException Reads and returns all external IDs from the specified revision of therefs/meta/external-ids
branch.- Parameters:
rev
- the revision from which the external IDs should be read, ifnull
the external IDs are read from the current tip, ifObjectId.zeroId()
it's assumed that therefs/meta/external-ids
branch doesn't exist and the loaded external IDs will be empty- Returns:
- all external IDs that were read from the specified revision
- Throws:
IOException
org.eclipse.jgit.errors.ConfigInvalidException
-