gerrit-server: use hashed passwords for HTTP.

Consequences:
* Removes the GET endpoint for the HTTP password
* Removes digest authentication
* Removes auth.gitBasicAuth config option.

With the move to NoteDB, the per-account data (including the HTTP
password) will be stored in a branch in the All-Users repo, where
it is subject to Gerrit ACLs.  Since these are notoriously hard to
setup correctly, we want to avoid storing the password in plaintext.

With this change, we support hashed passwords, and a schema upgrade
populates the existing 'password' field using previous passwords.

Tested migration manually:

  * ran schema upgrade
  * verified that schema upgrade inserts hashed passwords with gsql.
  * verified that the password still works with the new code.

Tested passwords manually:
  * verified that correct passwords get accepted when using curl --user.
  * verified that wrong passwords get rejected when using curl --user.

Change-Id: I26f5bcd7848040107e3721eeabf75baeb79c1724
This commit is contained in:
Han-Wen Nienhuys
2017-02-15 16:36:04 +01:00
committed by Edwin Kempin
parent 64f54cce18
commit 84d830b5b3
32 changed files with 327 additions and 530 deletions

View File

@@ -87,6 +87,8 @@ public final class AccountExternalId {
@Column(id = 3, notNull = false)
protected String emailAddress;
// Encoded version of the hashed and salted password, to be interpreted by the
// {@link HashedPassword} class.
@Column(id = 4, notNull = false)
protected String password;
@@ -140,12 +142,12 @@ public final class AccountExternalId {
return null != scheme ? getExternalId().substring(scheme.length() + 1) : null;
}
public String getPassword() {
return password;
public void setPassword(String hashed) {
password = hashed;
}
public void setPassword(String p) {
password = p;
public String getPassword() {
return password;
}
public boolean isTrusted() {