• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • github-oauth-plugin
    • Jenkins 1.599
      github-oauth plugin 0.20

      I'm using the github-oauth plugin for authentication and the Github Commiter Authorization Strategy and I'm unable to use the jenkins-cli with it. Running this command:

      java -jar jenkins-cli.jar -s http://localhost:8080 who-am-i --username <username> --password <jenkins-api-token> 

      results in an error:

      "--username" is not a valid option
      java -jar jenkins-cli.jar who-am-i
      Reports your credential and permissions.
      

      I've also tried ssh key auth with the -i flag but get a similar error about -i being an invalid option.

      Is there another way to use jenkins-cli with github auth?

          [JENKINS-27045] Cannot use jenkins-cli with github oauth plugin

          Code changed in jenkins
          User: Sam Gleske
          Path:
          src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java
          http://jenkins-ci.org/commit/github-oauth-plugin/d9f6ee0771dab210b9c88865e6c74cc5de58679e
          Log:
          JENKINS-27045 Jenkins CLI -username/-password

          options.

          Here's an example:

          java -jar jenkins-cli.jar -s http://localhost:8080 -noKeyAuth who-am-i \
          --username samrocketman --password-file ./personal-access-token

          Unfortunately, Jenkins core prevents Jenkins CLI LoginCommand from
          working correctly because it only stores the Username and mishandles
          creating the authentication token. This is a [bug in core][1].

          [1]: https://github.com/jenkinsci/jenkins/blob/jenkins-2.47/core/src/main/java/hudson/cli/ClientAuthenticationCache.java#L65-L75

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Sam Gleske Path: src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java http://jenkins-ci.org/commit/github-oauth-plugin/d9f6ee0771dab210b9c88865e6c74cc5de58679e Log: JENKINS-27045 Jenkins CLI - username/ -password options. Here's an example: java -jar jenkins-cli.jar -s http://localhost:8080 -noKeyAuth who-am-i \ --username samrocketman --password-file ./personal-access-token Unfortunately, Jenkins core prevents Jenkins CLI LoginCommand from working correctly because it only stores the Username and mishandles creating the authentication token. This is a [bug in core] [1] . [1] : https://github.com/jenkinsci/jenkins/blob/jenkins-2.47/core/src/main/java/hudson/cli/ClientAuthenticationCache.java#L65-L75

          Code changed in jenkins
          User: Sam Gleske
          Path:
          .mvn/jvm.config
          src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java
          src/test/java/org/jenkinsci/plugins/GithubSecurityRealmTest.java
          http://jenkins-ci.org/commit/github-oauth-plugin/3f64c19adf34802b989717e7c73068959d2c1f74
          Log:
          JENKINS-27045 Jenkins CLI -username/-password

          options.

          Here's an example:

          java -jar jenkins-cli.jar -s http://localhost:8080 -noKeyAuth who-am-i \
          --username samrocketman --password-file ./personal-access-token

          Unfortunately, Jenkins core prevents Jenkins CLI LoginCommand from
          working correctly because it only stores the Username and mishandles
          creating the authentication token. This is a [bug in core][1].

          [1]: https://github.com/jenkinsci/jenkins/blob/jenkins-2.47/core/src/main/java/hudson/cli/ClientAuthenticationCache.java#L65-L75

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Sam Gleske Path: .mvn/jvm.config src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java src/test/java/org/jenkinsci/plugins/GithubSecurityRealmTest.java http://jenkins-ci.org/commit/github-oauth-plugin/3f64c19adf34802b989717e7c73068959d2c1f74 Log: JENKINS-27045 Jenkins CLI - username/ -password options. Here's an example: java -jar jenkins-cli.jar -s http://localhost:8080 -noKeyAuth who-am-i \ --username samrocketman --password-file ./personal-access-token Unfortunately, Jenkins core prevents Jenkins CLI LoginCommand from working correctly because it only stores the Username and mishandles creating the authentication token. This is a [bug in core] [1] . [1] : https://github.com/jenkinsci/jenkins/blob/jenkins-2.47/core/src/main/java/hudson/cli/ClientAuthenticationCache.java#L65-L75

          Code changed in jenkins
          User: Sam Gleske
          Path:
          src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java
          http://jenkins-ci.org/commit/github-oauth-plugin/d5eb51c87f5d9fd71e0ae9093495328a751a081d
          Log:
          JENKINS-27045 Jenkins CLI -username/-password

          options.

          Here's an example:

          java -jar jenkins-cli.jar -s http://localhost:8080 -noKeyAuth who-am-i \
          --username samrocketman --password-file ./personal-access-token

          Unfortunately, Jenkins core prevents Jenkins CLI LoginCommand from
          working correctly because it only stores the Username and mishandles
          creating the authentication token. This is a [bug in core][1].

          [1]: https://github.com/jenkinsci/jenkins/blob/jenkins-2.47/core/src/main/java/hudson/cli/ClientAuthenticationCache.java#L65-L75

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Sam Gleske Path: src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java http://jenkins-ci.org/commit/github-oauth-plugin/d5eb51c87f5d9fd71e0ae9093495328a751a081d Log: JENKINS-27045 Jenkins CLI - username/ -password options. Here's an example: java -jar jenkins-cli.jar -s http://localhost:8080 -noKeyAuth who-am-i \ --username samrocketman --password-file ./personal-access-token Unfortunately, Jenkins core prevents Jenkins CLI LoginCommand from working correctly because it only stores the Username and mishandles creating the authentication token. This is a [bug in core] [1] . [1] : https://github.com/jenkinsci/jenkins/blob/jenkins-2.47/core/src/main/java/hudson/cli/ClientAuthenticationCache.java#L65-L75

          Code changed in jenkins
          User: Sam Gleske
          Path:
          .mvn/jvm.config
          LICENSE.txt
          src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java
          src/test/java/org/jenkinsci/plugins/GithubSecurityRealmTest.java
          http://jenkins-ci.org/commit/github-oauth-plugin/3eeba9ca2e24d00a2f6677a44c41c9527df0b9b1
          Log:
          Merge pull request #77 from jenkinsci/jenkins-cli-token

          JENKINS-27045 Jenkins CLI -username/-password options

          Compare: https://github.com/jenkinsci/github-oauth-plugin/compare/120f8ec9a7a5...3eeba9ca2e24

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Sam Gleske Path: .mvn/jvm.config LICENSE.txt src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java src/test/java/org/jenkinsci/plugins/GithubSecurityRealmTest.java http://jenkins-ci.org/commit/github-oauth-plugin/3eeba9ca2e24d00a2f6677a44c41c9527df0b9b1 Log: Merge pull request #77 from jenkinsci/jenkins-cli-token JENKINS-27045 Jenkins CLI - username/ -password options Compare: https://github.com/jenkinsci/github-oauth-plugin/compare/120f8ec9a7a5...3eeba9ca2e24

          Jesse Glick added a comment -

          So should this now be Resolved/Fixed?

          Jesse Glick added a comment - So should this now be Resolved/Fixed?

          What version of the core is needed to test this?

          Joshua Hoblitt added a comment - What version of the core is needed to test this?

          Sam Gleske added a comment -

          Sam Gleske added a comment - jhoblitt https://github.com/jenkinsci/github-oauth-plugin/blob/github-oauth-0.25/pom.xml#L16-L17

          Sam Gleske added a comment -

          Sam Gleske added a comment - Resolved by https://github.com/jenkinsci/github-oauth-plugin/pull/77

          FTR this is no longer working since 2.165 and https://github.com/jenkinsci/jenkins/pull/3838 (removing of remoting for CLI)

          Wadeck Follonier added a comment - FTR this is no longer working since 2.165 and https://github.com/jenkinsci/jenkins/pull/3838 (removing of remoting for CLI)

          Jesse Glick added a comment -

          You ought to be able to use -auth with an API token.

          https://github.com/jenkinsci/github-oauth-plugin/pull/119 deletes the obsolete CliAuthenticator implementation.

          Jesse Glick added a comment - You ought to be able to use -auth with an API token. https://github.com/jenkinsci/github-oauth-plugin/pull/119 deletes the obsolete CliAuthenticator implementation.

            sag47 Sam Gleske
            heydrick Eric Heydrick
            Votes:
            4 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: