Skip to content

Commit 73f35cc

Browse files
committed
Restore anonymous repositories browse capability
When porting the GitBlit plugin to GitBlit 1.7.0 we have lost the ability to browse anonymously the Gerrit repos according to the ACLs. Functionality is now restored and Gerrit’s visibility ACLs are honoured (only public repos are shown, not everything like in GitBlit anonymous browsing mode). Change-Id: Id53a9625fe5bc9a82d19e0f28fcac828e13a02de
1 parent e1cf464 commit 73f35cc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/java/com/googlesource/gerrit/plugins/gitblit/auth/GerritToGitBlitUserService.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,15 @@ public UserModel authenticate(HttpServletRequest httpRequest) {
142142
String gerritUsername =
143143
(String) httpRequest.getAttribute("gerrit-username");
144144
String gerritToken = (String) httpRequest.getAttribute("gerrit-token");
145+
httpRequest.getSession().setAttribute(Constants.AUTHENTICATION_TYPE,
146+
AuthenticationType.CONTAINER);
147+
145148
if (Strings.isNullOrEmpty(gerritUsername)
146149
|| Strings.isNullOrEmpty(gerritToken)) {
147-
return null;
150+
return GerritToGitBlitUserModel.getAnonymous(projectControl);
151+
} else {
152+
return authenticateSSO(gerritUsername, gerritToken);
148153
}
149-
150-
httpRequest.getSession().setAttribute(Constants.AUTHENTICATION_TYPE,
151-
AuthenticationType.CONTAINER);
152-
return authenticateSSO(gerritUsername, gerritToken);
153154
}
154155

155156
@Override

0 commit comments

Comments
 (0)