0

I was trying to access jenkins via api

When a api call is made in POSTMAN it is working perfectly fine, but if the same is accessed in an application(written in react), getting the following error

To run : "java -jar jenkins.war"

url : localhost:8080

Some of the thing I tried(which didnt work are) i) Disabling CSRF and ii) Disabling Security(It worked but this is not the solution as it will allow anyone to access it)

  "type": "default",
  "status": 403,
  "ok": false,
  "headers": {
    "map": {
      "content-length": "813",
      "x-permission-implied-by": "hudson.model.Hudson.Administer",
      "x-you-are-in-group-disabled": "JENKINS-39402: use -Dhudson.security.AccessDeniedException2.REPORT_GROUP_HEADERS=true or use /whoAmI to diagnose",
      "content-type": "text/html;charset=utf-8",
      "x-content-type-options": "nosniff",
      "date": "Sun, 28 Jul 2019 10:21:02 GMT",
      "server": "Jetty(9.4.z-SNAPSHOT)",
      "x-required-permission": "hudson.model.Hudson.Read",
      "x-you-are-authenticated-as": "anonymous",
      "x-jenkins-session": "63af948b",
      "x-jenkins": "2.176.2",
      "x-hudson": "1.395"
    }
  },
  "url": "http://admin:admin@localhost:8080/api/json",
  "_bodyInit": {
    "_data": {
      "size": 813,
      "offset": 0,
      "blobId": "dc017047-59b3-4dba-8762-38bc4d701714",
      "__collector": null
    }
  },
  "_bodyBlob": {
    "_data": {
      "size": 813,
      "offset": 0,
      "blobId": "dc017047-59b3-4dba-8762-38bc4d701714",
      "__collector": null
    }
  }
}

I am new to coding and new to jenkins, so i wasn't able to figure it out.

Thanks in advance

Developer
  • 9
  • 3
  • Did you do as instructed in the error message (`$.headers.map.'x-you-are-in-group-disabled'`)? – chrylis -cautiouslyoptimistic- Jul 28 '19 at 12:32
  • @chrylis I am not able to locate that. If possible can you please share how to do it? – Developer Jul 28 '19 at 13:06
  • `"JENKINS-39402: use -Dhudson.security.AccessDeniedException2.REPORT_GROUP_HEADERS=true or use /whoAmI to diagnose"` – chrylis -cautiouslyoptimistic- Jul 28 '19 at 14:51
  • @chrylis so i should be changing this. But I am not aware of the location to change it in jenkins. I searched for that particular field in "Configure System" and "Configure Global Security" in "Manage Jenkins" couldn't locate it. – Developer Jul 28 '19 at 15:10
  • @chrylis Also can you please let me know how to find the code of jenkins in my machine. Til now i am making changes only as configuration but not customisation. And I believe, this requires customisation work. Please correct me if I am wrong – Developer Jul 28 '19 at 15:15

0 Answers0