Remove unneeded link and unlink methods from Realm
Non of the Realm implementations did anything in these methods. Change-Id: Id336254f2465d7ed569f4622af8538a364e441a5 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -344,8 +344,6 @@ public class AccountManager {
|
||||
public AuthResult link(Account.Id to, AuthRequest who)
|
||||
throws AccountException, OrmException {
|
||||
try (ReviewDb db = schema.open()) {
|
||||
who = realm.link(db, to, who);
|
||||
|
||||
AccountExternalId.Key key = id(who);
|
||||
AccountExternalId extId = getAccountExternalId(db, key);
|
||||
if (extId != null) {
|
||||
@@ -435,8 +433,6 @@ public class AccountManager {
|
||||
public AuthResult unlink(Account.Id from, AuthRequest who)
|
||||
throws AccountException, OrmException {
|
||||
try (ReviewDb db = schema.open()) {
|
||||
who = realm.unlink(db, from, who);
|
||||
|
||||
AccountExternalId.Key key = id(who);
|
||||
AccountExternalId extId = getAccountExternalId(db, key);
|
||||
if (extId != null) {
|
||||
|
||||
@@ -17,7 +17,6 @@ package com.google.gerrit.server.account;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.AuthType;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.config.AuthConfig;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
@@ -74,16 +73,6 @@ public class DefaultRealm extends AbstractRealm {
|
||||
return who;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthRequest link(ReviewDb db, Account.Id to, AuthRequest who) {
|
||||
return who;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthRequest unlink(ReviewDb db, Account.Id from, AuthRequest who) {
|
||||
return who;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateAccount(final AuthRequest who, final Account account) {
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ package com.google.gerrit.server.account;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.Account.FieldName;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
|
||||
/** Fake implementation of {@link Realm} that does not communicate. */
|
||||
public class FakeRealm extends AbstractRealm {
|
||||
@@ -30,16 +29,6 @@ public class FakeRealm extends AbstractRealm {
|
||||
return who;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthRequest link(ReviewDb db, Account.Id to, AuthRequest who) {
|
||||
return who;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthRequest unlink(ReviewDb db, Account.Id to, AuthRequest who) {
|
||||
return who;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateAccount(AuthRequest who, Account account) {
|
||||
// Do nothing.
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
package com.google.gerrit.server.account;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
|
||||
import java.util.Set;
|
||||
@@ -29,12 +28,6 @@ public interface Realm {
|
||||
|
||||
AuthRequest authenticate(AuthRequest who) throws AccountException;
|
||||
|
||||
AuthRequest link(ReviewDb db, Account.Id to, AuthRequest who)
|
||||
throws AccountException;
|
||||
|
||||
AuthRequest unlink(ReviewDb db, Account.Id to, AuthRequest who)
|
||||
throws AccountException;
|
||||
|
||||
void onCreateAccount(AuthRequest who, Account account);
|
||||
|
||||
/** @return true if the user has the given email address. */
|
||||
|
||||
@@ -282,16 +282,6 @@ public class LdapRealm extends AbstractRealm {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthRequest link(ReviewDb db, Account.Id to, AuthRequest who) {
|
||||
return who;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthRequest unlink(ReviewDb db, Account.Id from, AuthRequest who) {
|
||||
return who;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateAccount(final AuthRequest who, final Account account) {
|
||||
usernameCache.put(who.getLocalUser(), Optional.of(account.getId()));
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.google.gerrit.extensions.auth.oauth.OAuthUserInfo;
|
||||
import com.google.gerrit.extensions.registration.DynamicMap;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.Account.FieldName;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.account.AbstractRealm;
|
||||
import com.google.gerrit.server.account.AccountException;
|
||||
import com.google.gerrit.server.account.AccountManager;
|
||||
@@ -113,17 +112,6 @@ public class OAuthRealm extends AbstractRealm {
|
||||
return who;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthRequest link(ReviewDb db, Account.Id to, AuthRequest who) {
|
||||
return who;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthRequest unlink(ReviewDb db, Account.Id to, AuthRequest who)
|
||||
throws AccountException {
|
||||
return who;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateAccount(AuthRequest who, Account account) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user