From 74d2607b8de4df3ecf99effcfe71d66fbbce1694 Mon Sep 17 00:00:00 2001 From: OHTAKE Tomohiro Date: Fri, 17 Aug 2012 16:54:38 +0900 Subject: [PATCH] [FIXED JENKINS-7894] Prevent parameter values from disappearing when user is not logged in --- changelog.html | 3 +++ .../java/hudson/security/HudsonAuthenticationEntryPoint.java | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/changelog.html b/changelog.html index afa74a9a4b..8e13feacee 100644 --- a/changelog.html +++ b/changelog.html @@ -72,6 +72,9 @@ Upcoming changes (issue 14769)
  • Description preview and syntax highlighting broken since 1.477. +
  • + Parameter values disappear if user is not logged in + (issue 7894) diff --git a/core/src/main/java/hudson/security/HudsonAuthenticationEntryPoint.java b/core/src/main/java/hudson/security/HudsonAuthenticationEntryPoint.java index 79cf8ed68e..6a3c21efec 100644 --- a/core/src/main/java/hudson/security/HudsonAuthenticationEntryPoint.java +++ b/core/src/main/java/hudson/security/HudsonAuthenticationEntryPoint.java @@ -23,6 +23,7 @@ */ package hudson.security; +import com.google.common.base.Strings; import org.acegisecurity.AuthenticationException; import org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint; @@ -74,8 +75,10 @@ public class HudsonAuthenticationEntryPoint extends AuthenticationProcessingFilt rsp.sendError(SC_FORBIDDEN); } else { // give the opportunity to include the target URL + String uriFrom = req.getRequestURI(); + if(!Strings.isNullOrEmpty(req.getQueryString())) uriFrom += "?" + req.getQueryString(); String loginForm = req.getContextPath()+getLoginFormUrl(); - loginForm = MessageFormat.format(loginForm, URLEncoder.encode(req.getRequestURI(),"UTF-8")); + loginForm = MessageFormat.format(loginForm, URLEncoder.encode(uriFrom,"UTF-8")); req.setAttribute("loginForm", loginForm); rsp.setStatus(SC_FORBIDDEN);