Support to get/set/delete/generate an HTTP password via REST
The HTTP password of a user can now be retrieved by GET on /accounts/<account-id>/password.http. By PUT on /accounts/<account-id>/password.http a new HTTP password can be generated or set. Directly setting an HTTP password is only allowed for Gerrit administrators. By DELETE on /accounts/<account-id>/password.http the HTTP password can be cleared. The WebUI is adapted to use the new REST endpoints to generate/clear the HTTP password. The old RPCs for this are deleted. Change-Id: I1424f1d4b45e5409095b51f05c9c6afe26e66800 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
committed by
Edwin Kempin
parent
12c35d3ed8
commit
d9cdf5eea4
@@ -29,8 +29,6 @@ import com.google.gerrit.httpd.rpc.UiRpcModule;
|
||||
import com.google.gerrit.lifecycle.LifecycleModule;
|
||||
import com.google.gerrit.server.CmdLineParserModule;
|
||||
import com.google.gerrit.server.RemotePeer;
|
||||
import com.google.gerrit.server.account.ClearPassword;
|
||||
import com.google.gerrit.server.account.GeneratePassword;
|
||||
import com.google.gerrit.server.config.AuthConfig;
|
||||
import com.google.gerrit.server.config.CanonicalWebUrl;
|
||||
import com.google.gerrit.server.config.FactoryModule;
|
||||
@@ -130,10 +128,8 @@ public class WebModule extends FactoryModule {
|
||||
bind(GerritConfig.class).toProvider(GerritConfigProvider.class);
|
||||
DynamicSet.setOf(binder(), WebUiPlugin.class);
|
||||
|
||||
factory(ClearPassword.Factory.class);
|
||||
install(new AsyncReceiveCommits.Module());
|
||||
install(new CmdLineParserModule());
|
||||
factory(GeneratePassword.Factory.class);
|
||||
|
||||
bind(SocketAddress.class).annotatedWith(RemotePeer.class).toProvider(
|
||||
HttpRemotePeerProvider.class).in(RequestScoped.class);
|
||||
|
||||
@@ -39,8 +39,6 @@ import com.google.gerrit.server.account.AccountCache;
|
||||
import com.google.gerrit.server.account.AccountException;
|
||||
import com.google.gerrit.server.account.AccountManager;
|
||||
import com.google.gerrit.server.account.ChangeUserName;
|
||||
import com.google.gerrit.server.account.ClearPassword;
|
||||
import com.google.gerrit.server.account.GeneratePassword;
|
||||
import com.google.gerrit.server.account.GroupCache;
|
||||
import com.google.gerrit.server.account.Realm;
|
||||
import com.google.gerrit.server.contact.ContactStore;
|
||||
@@ -70,8 +68,6 @@ class AccountSecurityImpl extends BaseServiceImplementation implements
|
||||
private final AccountManager accountManager;
|
||||
private final boolean useContactInfo;
|
||||
|
||||
private final ClearPassword.Factory clearPasswordFactory;
|
||||
private final GeneratePassword.Factory generatePasswordFactory;
|
||||
private final ChangeUserName.CurrentUser changeUserNameFactory;
|
||||
private final DeleteExternalIds.Factory deleteExternalIdsFactory;
|
||||
private final ExternalIdDetailFactory.Factory externalIdDetailFactory;
|
||||
@@ -86,8 +82,6 @@ class AccountSecurityImpl extends BaseServiceImplementation implements
|
||||
final EmailTokenVerifier etv, final ProjectCache pc,
|
||||
final SshKeyCache skc, final AccountByEmailCache abec,
|
||||
final AccountCache uac, final AccountManager am,
|
||||
final ClearPassword.Factory clearPasswordFactory,
|
||||
final GeneratePassword.Factory generatePasswordFactory,
|
||||
final ChangeUserName.CurrentUser changeUserNameFactory,
|
||||
final DeleteExternalIds.Factory deleteExternalIdsFactory,
|
||||
final ExternalIdDetailFactory.Factory externalIdDetailFactory,
|
||||
@@ -105,8 +99,6 @@ class AccountSecurityImpl extends BaseServiceImplementation implements
|
||||
|
||||
useContactInfo = contactStore != null && contactStore.isEnabled();
|
||||
|
||||
this.clearPasswordFactory = clearPasswordFactory;
|
||||
this.generatePasswordFactory = generatePasswordFactory;
|
||||
this.changeUserNameFactory = changeUserNameFactory;
|
||||
this.deleteExternalIdsFactory = deleteExternalIdsFactory;
|
||||
this.externalIdDetailFactory = externalIdDetailFactory;
|
||||
@@ -179,18 +171,6 @@ class AccountSecurityImpl extends BaseServiceImplementation implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generatePassword(AccountExternalId.Key key,
|
||||
AsyncCallback<AccountExternalId> callback) {
|
||||
Handler.wrap(generatePasswordFactory.create(key)).to(callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPassword(AccountExternalId.Key key,
|
||||
AsyncCallback<AccountExternalId> callback) {
|
||||
Handler.wrap(clearPasswordFactory.create(key)).to(callback);
|
||||
}
|
||||
|
||||
public void myExternalIds(AsyncCallback<List<AccountExternalId>> callback) {
|
||||
externalIdDetailFactory.create().to(callback);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user