do not require the READ permission for channel connections. The connected session will be authenticated later

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@29623 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2010-03-31 01:25:10 +00:00
1 parent cfe3f7315e
commit 79b0db483f
1 file changed
+5 -1
+5 -1
View File
@@ -2823,13 +2823,16 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
* Handles HTTP requests for duplex channels for CLI.
*/
public void doCli(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, InterruptedException {
checkPermission(READ);
if(!"POST".equals(Stapler.getCurrentRequest().getMethod())) {
// for GET request, serve _cli.jelly, assuming this is a browser
checkPermission(READ);
req.getView(this,"_cli.jelly").forward(req,rsp);
return;
}
// do not require any permission to establish a CLI connection
// the actual authentication for the connecting Channel is done by CLICommand
UUID uuid = UUID.fromString(req.getHeader("Session"));
rsp.setHeader("Hudson-Duplex",""); // set the header so that the client would know
@@ -3334,6 +3337,7 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
|| rest.startsWith("/signup")
|| rest.startsWith("/jnlpJars/")
|| rest.startsWith("/tcpSlaveAgentListener")
|| rest.startsWith("/cli"))
|| rest.startsWith("/securityRealm"))
return this; // URLs that are always visible without READ permission
throw e;