Additional AccountExternalId when creating account

The REST API for creating accounts does only support the creation
of accounts for users stored in Gerrit's internal user store.
The current implementation of CreateAccount only registers an
AccountExternalId of type SCHEME_USERNAME, while for example for
OAuth authentication SCHEME_EXTERNAL is required.

This patch adds a new extension point AccountExternalIdCreator
that can be implemented to inject additional AccountExternalId
entries for an account during account creation.

Change-Id: I53df8ae04a023fd32587136981347bdf176bb4ee
Signed-off-by: Michael Ochmann <michael.ochmann@sap.com>
diff --git a/Documentation/dev-plugins.txt b/Documentation/dev-plugins.txt
index 13b6978..6019150 100644
--- a/Documentation/dev-plugins.txt
+++ b/Documentation/dev-plugins.txt
@@ -1954,6 +1954,32 @@
 No Guice bindings or modules are required. Gerrit will automatically
 discover and bind the implementation.
 
+[[accountcreation]]
+== Account Creation
+
+Plugins can hook into the
+link:rest-api-accounts.html#create-account[account creation] REST API and
+inject additional external identifiers for an account that represents a user
+in some external user store. For that, an implementation of the extension
+point `com.google.gerrit.server.api.accounts.AccountExternalIdCreator`
+must be registered.
+
+[source,java]
+----
+class MyExternalIdCreator implements AccountExternalIdCreator {
+  @Override
+  public List<AccountExternalId> create(Account.Id id, String username,
+      String email) {
+    // your code
+  }
+}
+
+bind(AccountExternalIdCreator.class)
+  .annotatedWith(UniqueAnnotations.create())
+  .to(MyExternalIdCreator.class);
+}
+----
+
 [[download-commands]]
 == Download Commands