From 99aaa67beccd8570cb3934dcd690156e9fefb507 Mon Sep 17 00:00:00 2001 From: mindless Date: Fri, 27 Aug 2010 20:34:29 +0000 Subject: [PATCH] [FIXED HUDSON-6628] There is some code duplication in main() methods between CLICommand and the anonymous CLICommand subclass in CLIRegisterer.. the latter was missing the loadStoredAuthentication call which enables CLI login command. CLI login now works for CLI commands defined via @CLIMethod annotation. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@34178 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/cli/declarative/CLIRegisterer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/cli/declarative/CLIRegisterer.java b/core/src/main/java/hudson/cli/declarative/CLIRegisterer.java index 4b84b5f7e0..eb3da68bf5 100644 --- a/core/src/main/java/hudson/cli/declarative/CLIRegisterer.java +++ b/core/src/main/java/hudson/cli/declarative/CLIRegisterer.java @@ -148,7 +148,10 @@ public class CLIRegisterer extends ExtensionFinder { // fill up all the binders parser.parseArgument(args); - sc.setAuthentication(authenticator.authenticate()); // run the CLI with the right credential + Authentication auth = authenticator.authenticate(); + if (auth==Hudson.ANONYMOUS) + auth = loadStoredAuthentication(); + sc.setAuthentication(auth); // run the CLI with the right credential hudson.checkPermission(Hudson.READ); // resolve them