jenkinsci/jenkins — pull request #445 by lacostej (2012-04-18 06:31:40+00:00)
Title: JENKINS-8214 Added a DISCOVER permission to allow anonymous users to be ...

...presented the login screen when accessing job URLs

To solve this issue, I had first implemented an option in the main jenkins configuration, but after talking with Kohsuke yesterday in Paris, I am now using a new permission. Please let me know if the new permission name and description are meaningful/good enough.

The exception causes information to be logged in the console, which may be too unwanted. We could replace it with a more direct stapler redirection:

String url = Stapler.getCurrentRequest().getOriginalRequestURI();
try {
Stapler.getCurrentResponse().sendRedirect("/login?from=" + url);
} finally {
return null;
}

I only tested this locally.