Skip to content

Commit

Permalink
[FIXED JENKINS-7894] Prevent parameter values from disappearing when …
Browse files Browse the repository at this point in the history
…user is not logged in
  • Loading branch information
ohtake committed Aug 17, 2012
1 parent 36ab713 commit 74d2607
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -72,6 +72,9 @@
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-14769">issue 14769</a>)
<li class=bug>
Description preview and syntax highlighting broken since 1.477.
<li class=bug>
Parameter values disappear if user is not logged in
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-7894">issue 7894</a>)
</ul>
</div><!--=TRUNK-END=-->

Expand Down
Expand Up @@ -23,6 +23,7 @@
*/
package hudson.security;

import com.google.common.base.Strings;
import org.acegisecurity.AuthenticationException;
import org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint;

Expand Down Expand Up @@ -74,8 +75,10 @@ public void commence(ServletRequest request, ServletResponse response, Authentic
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);
Expand Down

0 comments on commit 74d2607

Please sign in to comment.