From 8f50853cf767c869d63f39c23073b6beb7e0593d Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Thu, 03 Jul 2014 16:57:47 -0400 Subject: [PATCH] Dropped WebListener annotation --- src/main/java/com/gitblit/servlet/AuthenticationFilter.java | 36 +++++++++++++++++------------------- 1 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/gitblit/servlet/AuthenticationFilter.java b/src/main/java/com/gitblit/servlet/AuthenticationFilter.java index 54c7014..35a6236 100644 --- a/src/main/java/com/gitblit/servlet/AuthenticationFilter.java +++ b/src/main/java/com/gitblit/servlet/AuthenticationFilter.java @@ -58,10 +58,18 @@ protected transient Logger logger = LoggerFactory.getLogger(getClass()); - protected final IAuthenticationManager authenticationManager; + protected IAuthenticationManager authenticationManager; protected AuthenticationFilter(IAuthenticationManager authenticationManager) { this.authenticationManager = authenticationManager; + } + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + } + + @Override + public void destroy() { } /** @@ -91,8 +99,12 @@ * @return url */ protected String getFullUrl(HttpServletRequest httpRequest) { - String servletUrl = httpRequest.getContextPath() + httpRequest.getServletPath(); - String url = httpRequest.getRequestURI().substring(servletUrl.length()); + String contextPath = httpRequest.getContextPath(); + String servletPath = httpRequest.getServletPath(); + String pathInfo = httpRequest.getPathInfo(); + String servletUrl = contextPath + servletPath; + String requestURI = httpRequest.getRequestURI(); + String url = requestURI.substring(servletUrl.length()); String params = httpRequest.getQueryString(); if (url.length() > 0 && url.charAt(0) == '/') { url = url.substring(1); @@ -138,20 +150,6 @@ } /** - * @see javax.servlet.Filter#init(javax.servlet.FilterConfig) - */ - @Override - public void init(final FilterConfig config) throws ServletException { - } - - /** - * @see javax.servlet.Filter#destroy() - */ - @Override - public void destroy() { - } - - /** * Wraps a standard HttpServletRequest and overrides user principal methods. */ public static class AuthenticatedRequest extends HttpServletRequestWrapper { @@ -184,7 +182,7 @@ // Gitblit does not currently use actual roles in the traditional // servlet container sense. That is the reason this is marked // deprecated, but I may want to revisit this. - return user.canAccessRepository(role); + return user.hasRepositoryPermission(role); } @Override @@ -192,4 +190,4 @@ return user; } } -} \ No newline at end of file +} -- Gitblit v1.9.1