• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • cli
    • None
    • Platform: All, OS: All

      After the changes in JENKINS-3796, container managed authentication no longer works for CLI.

      Make the necessary changes to maintain the extensibility provided in JENKINS-3796, but also allow container based auth.

          [JENKINS-6587] Allow CLI Container Managed Authentication

          jpederzolli created issue -
          jpederzolli made changes -
          Description Original: Currently there is no way to supply Hudson credentials to hudson-cli, making it
          unusable to those who do not allow anonymous access to Hudson.
          New: After the changes in JENKINS-3796, container managed authentication no longer works for CLI.

          Make the necessary changes to maintain the extensibility provided in JENKINS-3796, but also allow container based auth.
          Issue Type Original: Improvement [ 4 ] New: Bug [ 1 ]
          jpederzolli made changes -
          Fix Version/s New: current [ 10162 ]
          Assignee New: jpederzolli [ jpederzolli ]
          jpederzolli made changes -
          Fix Version/s Original: current [ 10162 ]

          jpederzolli added a comment -

          The reason for this issue is the following:

          The changes in JENKINS-3796 removed the passing of the Authentication object to the CliManagerImpl and made the CLI authentication more extensible. The one problem with it is that you need the Authentication to be passed into the CliManagerImpl class if one is using the LegacySecurityRealm (i.e. container auth). Without this issue being fixed, the CLI user will always be 'anonymous' if container based authentication is relied upon.

          A summary of the changes:

          1) Restore CliManager constructor to take an Authentication object which in turn will be passed on to the CLICommand implementation.
          2) Create an overloaded createCliAuthenticator method in SecurityRealm which takes an Authentication object
          3) Let it be up to the SecurityRealm implementation if createCliAuthenticator will consider the Authentication object when creating the CliAuthenticator
          4) Only the LegacySecurityRealm (currently at least) will override createCliAuthenticator(CLICommand command, Authentication auth) and use the Authentication object passed in for the creation of its CliAuthenticator. No other SecurityRealms will be affected by these changes.
          5) Update GroovyshCommand to include updates that appear to have been missed in JENKINS-3796 along with changes relative to this ticket.

          jpederzolli added a comment - The reason for this issue is the following: The changes in JENKINS-3796 removed the passing of the Authentication object to the CliManagerImpl and made the CLI authentication more extensible. The one problem with it is that you need the Authentication to be passed into the CliManagerImpl class if one is using the LegacySecurityRealm (i.e. container auth). Without this issue being fixed, the CLI user will always be 'anonymous' if container based authentication is relied upon. A summary of the changes: 1) Restore CliManager constructor to take an Authentication object which in turn will be passed on to the CLICommand implementation. 2) Create an overloaded createCliAuthenticator method in SecurityRealm which takes an Authentication object 3) Let it be up to the SecurityRealm implementation if createCliAuthenticator will consider the Authentication object when creating the CliAuthenticator 4) Only the LegacySecurityRealm (currently at least) will override createCliAuthenticator(CLICommand command, Authentication auth) and use the Authentication object passed in for the creation of its CliAuthenticator. No other SecurityRealms will be affected by these changes. 5) Update GroovyshCommand to include updates that appear to have been missed in JENKINS-3796 along with changes relative to this ticket.

          jpederzolli added a comment -

          proposed changes

          jpederzolli added a comment - proposed changes
          jpederzolli made changes -
          Attachment New: cli_auth_updates.diff [ 19443 ]

          Code changed in hudson
          User: : jpederzolli
          Path:
          trunk/hudson/main/core/src/main/java/hudson/cli/CLICommand.java
          trunk/hudson/main/core/src/main/java/hudson/cli/CliManagerImpl.java
          trunk/hudson/main/core/src/main/java/hudson/cli/GroovyshCommand.java
          trunk/hudson/main/core/src/main/java/hudson/cli/declarative/CLIRegisterer.java
          trunk/hudson/main/core/src/main/java/hudson/model/Hudson.java
          trunk/hudson/main/core/src/main/java/hudson/security/LegacySecurityRealm.java
          trunk/hudson/main/core/src/main/java/hudson/security/SecurityRealm.java
          trunk/hudson/main/test/src/test/java/hudson/model/listeners/ItemListenerTest.java
          http://jenkins-ci.org/commit/31878
          Log:
          Issue: JENKINS-6587

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : jpederzolli Path: trunk/hudson/main/core/src/main/java/hudson/cli/CLICommand.java trunk/hudson/main/core/src/main/java/hudson/cli/CliManagerImpl.java trunk/hudson/main/core/src/main/java/hudson/cli/GroovyshCommand.java trunk/hudson/main/core/src/main/java/hudson/cli/declarative/CLIRegisterer.java trunk/hudson/main/core/src/main/java/hudson/model/Hudson.java trunk/hudson/main/core/src/main/java/hudson/security/LegacySecurityRealm.java trunk/hudson/main/core/src/main/java/hudson/security/SecurityRealm.java trunk/hudson/main/test/src/test/java/hudson/model/listeners/ItemListenerTest.java http://jenkins-ci.org/commit/31878 Log: Issue: JENKINS-6587

          Code changed in hudson
          User: : jpederzolli
          Path:
          trunk/www/changelog.html
          http://jenkins-ci.org/commit/31879
          Log:
          Issue: JENKINS-6587

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : jpederzolli Path: trunk/www/changelog.html http://jenkins-ci.org/commit/31879 Log: Issue: JENKINS-6587
          jpederzolli made changes -
          Fix Version/s New: current [ 10162 ]
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

            jpederzolli jpederzolli
            jpederzolli jpederzolli
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: