Merge branch 'stable-2.9'
* stable-2.9: Add support for JCE (Java Cryptography Extension) ciphers Buck: Respect gerrit-gwtui-common dependency for GWT plugins More improvements in the change info block UI Add a section about the submit type to the project owner guide Fix: Wrong exception mapping in ReceiveCommmits Fix REST example for removing included groups from a group rest-api-groups.txt: Correct input examples to use [] for lists Document project options Allow service users to access REST API if auth.gitBasicAuth = true Improve documentation about project creation Make singleusergroup a core plugin Rename 'Change Submit Action' in documentation to 'Submit Type' ProjectInfoScreen: Display submit type and content merge next to each other Add guide for project owners Improve description of the auth.gitBasicAuth parameter Conflicts: Documentation/config-gerrit.txt Documentation/rest-api-groups.txt gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritResources.java gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectInfoScreen.java Change-Id: I269f8f1395c352d8d90ba4f770a19296a50967de
This commit is contained in:
@@ -25,6 +25,7 @@ import com.google.gerrit.server.account.AccountManager;
|
||||
import com.google.gerrit.server.account.AccountState;
|
||||
import com.google.gerrit.server.account.AuthRequest;
|
||||
import com.google.gerrit.server.account.AuthResult;
|
||||
import com.google.gerrit.server.auth.NoSuchUserException;
|
||||
import com.google.gerrit.server.config.AuthConfig;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
@@ -155,6 +156,18 @@ class ProjectBasicAuthFilter implements Filter {
|
||||
ws.setAccessPathOk(AccessPath.GIT, true);
|
||||
ws.setAccessPathOk(AccessPath.REST_API, true);
|
||||
return true;
|
||||
} catch (NoSuchUserException e) {
|
||||
if (password.equals(who.getPassword(who.getUserName()))) {
|
||||
WebSession ws = session.get();
|
||||
ws.setUserAccountId(who.getAccount().getId());
|
||||
ws.setAccessPathOk(AccessPath.GIT, true);
|
||||
ws.setAccessPathOk(AccessPath.REST_API, true);
|
||||
return true;
|
||||
} else {
|
||||
log.warn("Authentication failed for " + username, e);
|
||||
rsp.sendError(SC_UNAUTHORIZED);
|
||||
return false;
|
||||
}
|
||||
} catch (AccountException e) {
|
||||
log.warn("Authentication failed for " + username, e);
|
||||
rsp.sendError(SC_UNAUTHORIZED);
|
||||
|
||||
Reference in New Issue
Block a user