Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-44980

Calling pipeline steps functions gives error that not logged in -- though successfully authenticated in plugin configuration

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • jira-steps-plugin
    • None

      For example, trying to run the code (I changed the issue key)

      def issue = jiraGetIssue site: "JIRA", idOrKey: 'PROJ-12345'
      echo issue.data.toString()

      gives the error message:
      ERROR: {"errorMessages":["You do not have the permission to see the specified issue.","Login Required"],"errors":{}}
      but on the plugin configuration page, a user (that has correct permissions in JIRA) is set up with correct username and password – testing connection shows success. 

        1. Empty UserName Password.png
          545 kB
          Naresh Rayapati
        2. getIssue script.png
          11 kB
          Justin Duda
        3. getProjects() success.png
          36 kB
          Justin Duda
        4. getProjects script.png
          10 kB
          Justin Duda
        5. Issue.png
          13 kB
          Justin Duda
        6. Jenkins - Config.png
          89 kB
          Naresh Rayapati
        7. Jenkins- Config.png
          40 kB
          Justin Duda
        8. Jenkins - Job.png
          129 kB
          Naresh Rayapati
        9. Jenkins - Plugin Version.png
          27 kB
          Naresh Rayapati
        10. Jenkins version.png
          18 kB
          Justin Duda
        11. JIRA Home Page.png
          455 kB
          Naresh Rayapati
        12. JIRA - Issue.png
          387 kB
          Naresh Rayapati
        13. JIRA - version.png
          23 kB
          Justin Duda
        14. Login Error (getIssue).png
          81 kB
          Justin Duda

          [JENKINS-44980] Calling pipeline steps functions gives error that not logged in -- though successfully authenticated in plugin configuration

          Justin Duda created issue -

          Justin Duda added a comment -

          For example, trying to run the code (I changed the issue key)

          def issue = jiraGetIssue site: "JIRA", idOrKey: 'PROJ-12345'
          echo issue.data.toString()

          gives the error message:
          ERROR: {"errorMessages":["You do not have the permission to see the specified issue.","Login Required"],"errors":{}}
          but on the plugin configuration page, a user (that has correct permissions in JIRA) is set up with correct username and password – testing connection shows success. 

           

          Justin Duda added a comment - For example, trying to run the code (I changed the issue key) def issue = jiraGetIssue site: "JIRA", idOrKey: 'PROJ-12345' echo issue.data.toString() gives the error message: ERROR: {"errorMessages": ["You do not have the permission to see the specified issue.","Login Required"] ,"errors":{}} but on the plugin configuration page, a user (that has correct permissions in JIRA) is set up with correct username and password – testing connection shows success.   
          Justin Duda made changes -
          Summary Original: Calling pipeline steps functions gives error that not logged in but successfully authenticated in plugin configuration New: Calling pipeline steps functions gives error that not logged in -- though am successfully authenticated in plugin configuration
          Justin Duda made changes -
          Summary Original: Calling pipeline steps functions gives error that not logged in -- though am successfully authenticated in plugin configuration New: Calling pipeline steps functions gives error that not logged in -- though successfully authenticated in plugin configuration
          Justin Duda made changes -
          Description New: For example, trying to run the code (I changed the issue key)
          {quote}def issue = jiraGetIssue site: "JIRA", idOrKey: 'PROJ-12345'
          echo issue.data.toString()
          {quote}
          gives the error message:
          ERROR: \{"errorMessages":["You do not have the permission to see the specified issue.","Login Required"],"errors":\{}}
          but on the plugin configuration page, a user (that has correct permissions in JIRA) is set up with correct username and password – testing connection shows success. 

          • Check your JIRA project settings that this user has the permission to view that issue, as this error message is from the JIRA.
          • Hope you have saved the config after you see the test connection success message.
          • What version are you testing this against, I tested this only with 6.4.13.
          • Which type of authentication are you trying to use Basic/OAuth.
          • Can you try a simple http get on that issue outside this plugin to see if that is working with credentials you have. (with basic username and password)

          Naresh Rayapati added a comment - Check your JIRA project settings that this user has the permission to view that issue, as this error message is from the JIRA. Hope you have saved the config after you see the test connection success message. What version are you testing this against, I tested this only with 6.4.13. Which type of authentication are you trying to use Basic/OAuth. Can you try a simple http get on that issue outside this plugin to see if that is working with credentials you have. (with basic username and password)

          Justin Duda added a comment - - edited
          • The user is configured to access the issue (and do much more).
          • The config was saved – double checked, and the testing connection still shows success
          • I am using the plugin (JIRA Steps) version 1.2.2, and JIRA version 7.3.6
          • Using basic auth (which works fine in HTTP request)
          • HTTP get request works fine outside of the plugin with the same credentials

          From looking at the error message, it seems that the problem is that it is not logging into JIRA with the user configured in the plugin settings, but instead using the Anonymous user which does not have permission to view the issue (or do much else). 

          Thanks nrayapati

          Justin Duda added a comment - - edited The user is configured to access the issue (and do much more). The config was saved – double checked, and the testing connection still shows success I am using the plugin (JIRA Steps) version 1.2.2, and JIRA version 7.3.6 Using basic auth (which works fine in HTTP request) HTTP get request works fine outside of the plugin with the same credentials From looking at the error message, it seems that the problem is that it is not logging into JIRA with the user configured in the plugin settings, but instead using the Anonymous user which does not have permission to view the issue (or do much else).  Thanks nrayapati
          Naresh Rayapati made changes -
          Attachment New: Jenkins - Plugin Version.png [ 38548 ]
          Attachment New: JIRA - Issue.png [ 38549 ]
          Attachment New: JIRA Home Page.png [ 38550 ]
          Attachment New: Jenkins - Job.png [ 38551 ]
          Attachment New: Jenkins - Config.png [ 38552 ]

          Naresh Rayapati added a comment - - edited

          jdudatt I tried to replicate your scenario, and couldn't reproduce the issue that you are reporting. Not sure where you are trying different than me, but please find the screenshots.

          Here is the pipeline script:

          def issue = jiraGetIssue idOrKey: 'TEST-1', site: 'JIRA'
          echo issue.data.fields.description.toString()
          jiraAddComment idOrKey: 'TEST-1', site: 'JIRA', comment: 'Testing from Jenkins'
          
          

          Naresh Rayapati added a comment - - edited jdudatt I tried to replicate your scenario, and couldn't reproduce the issue that you are reporting. Not sure where you are trying different than me, but please find the screenshots. Here is the pipeline script: def issue = jiraGetIssue idOrKey: 'TEST-1' , site: 'JIRA' echo issue.data.fields.description.toString() jiraAddComment idOrKey: 'TEST-1' , site: 'JIRA' , comment: 'Testing from Jenkins'

          Naresh Rayapati added a comment - - edited

          There is no way that this plugin tries as an anonymous, it always uses either Basic or OAuth method, it could be that username and password that you have saved is not allowed to login, or the JIRA version that you have installed is not supporting basic authentication.

          Or may be not sure if the Jenkins version is causing some problems, what jenkins version you have installed?

          Refer to the signinginterceptor here https://github.com/jenkinsci/jira-steps-plugin/blob/master/src/main/java/org/thoughtslive/jenkins/plugins/jira/login/SigningInterceptor.java#L32-L39 if you would like to try manually posting a request with this header.

          Naresh Rayapati added a comment - - edited There is no way that this plugin tries as an anonymous, it always uses either Basic or OAuth method, it could be that username and password that you have saved is not allowed to login, or the JIRA version that you have installed is not supporting basic authentication. Or may be not sure if the Jenkins version is causing some problems, what jenkins version you have installed? Refer to the signinginterceptor here https://github.com/jenkinsci/jira-steps-plugin/blob/master/src/main/java/org/thoughtslive/jenkins/plugins/jira/login/SigningInterceptor.java#L32-L39 if you would like to try manually posting a request with this header.

            nrayapati Naresh Rayapati
            jdudatt Justin Duda
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: