From 44f6238fd5fe7675e7de43f4a42d1f7dabcfee4e Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Tue, 27 Nov 2012 17:01:59 -0500 Subject: [PATCH] Tweak to GCA config, fix send mail prompts, added authority.cmd --- src/com/gitblit/wicket/pages/BasePage.java | 33 ++++++++++++++++++++++++++------- 1 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/com/gitblit/wicket/pages/BasePage.java b/src/com/gitblit/wicket/pages/BasePage.java index dcca361..05640ad 100644 --- a/src/com/gitblit/wicket/pages/BasePage.java +++ b/src/com/gitblit/wicket/pages/BasePage.java @@ -55,6 +55,7 @@ import com.gitblit.Constants; import com.gitblit.Constants.AccessPermission; import com.gitblit.Constants.AccessRestrictionType; +import com.gitblit.Constants.AuthorizationControl; import com.gitblit.Constants.FederationStrategy; import com.gitblit.GitBlit; import com.gitblit.Keys; @@ -130,13 +131,16 @@ } private void login() { - Cookie[] cookies = ((WebRequest) getRequestCycle().getRequest()).getCookies(); - UserModel user = null; - if (GitBlit.self().allowCookieAuthentication() && cookies != null && cookies.length > 0) { - // Grab cookie from Browser Session - user = GitBlit.self().authenticate(cookies); - } else { - user = GitBlit.self().authenticate(((WebRequest) getRequestCycle().getRequest()).getHttpServletRequest()); + // try to authenticate by servlet request + UserModel user = GitBlit.self().authenticate(((WebRequest) getRequestCycle().getRequest()).getHttpServletRequest()); + + if (user == null) { + // try to authenticate by cookie + Cookie[] cookies = ((WebRequest) getRequestCycle().getRequest()).getCookies(); + if (GitBlit.self().allowCookieAuthentication() && cookies != null && cookies.length > 0) { + // Grab cookie from Browser Session + user = GitBlit.self().authenticate(cookies); + } } // Login the user @@ -255,6 +259,21 @@ } return map; } + + protected Map<AuthorizationControl, String> getAuthorizationControls() { + Map<AuthorizationControl, String> map = new LinkedHashMap<AuthorizationControl, String>(); + for (AuthorizationControl type : AuthorizationControl.values()) { + switch (type) { + case AUTHENTICATED: + map.put(type, getString("gb.allowAuthenticatedDescription")); + break; + case NAMED: + map.put(type, getString("gb.allowNamedDescription")); + break; + } + } + return map; + } protected TimeZone getTimeZone() { return GitBlit.getBoolean(Keys.web.useClientTimezone, false) ? GitBlitWebSession.get() -- Gitblit v1.9.1