I
I
IGrch2017-10-26 15:21:42
JIRA
IGrch, 2017-10-26 15:21:42

Why doesn't the JIRA REST API allow LDAP users?

Through the JIRA REST API, I create incidents from the corporate website.
With login of the administrator and agents everything works, and with other users (are drawn from LDAP) a problem.
Incidents are not created, the response does not come, I suspect that at the stage of checking the login / password. In Jira, in the settings in the rights, I gave the creation to everyone. What else have I not learned?

<div id="wrapper">
  <h1>Create Issue</h1>
  <form id="create-form">
    Summary: <input type="text" name="summary" id="summary" value=""/>
    Description: <input type="text" name="description" id="description" value="" />
    Issue Type: <input type="text" name="type" id="type" value=""/>
    Username: <input type="text" name="user" id="user" value=""/>
    Password: <input type="password" name="pass" id="pass" value=""/>
    <input type="button" id="button" value="Create Issue"/>
  </form>
</div>
<script>
$('#button').click(function() {
   $.ajax({
     type: "POST",
     url: "jiraapi.php",
     data: $('#create-form').serialize(),
     success: function(data){
      alert(data);
     },
     dataType: "html"
  });
});
</script>

<?php
  $base64_usrpwd = base64_encode($_POST['user'].':'.$_POST['pass']);
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, 'http://localhost:8080/rest/api/2/issue/');
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json',
                        'Authorization: Basic '.$base64_usrpwd)); 
  
  $arr['project'] = array( 'key' => 'TP');
  $arr['summary'] = $_POST['summary'];
  $arr['description'] = $_POST['description'];
  $arr['issuetype'] = array( 'name' => $_POST['type']);
  
  $json_arr['fields'] = $arr;
  
  $json_string = json_encode ($json_arr);
  curl_setopt($ch, CURLOPT_POSTFIELDS,$json_string);
  $result = curl_exec($ch);
  curl_close($ch);
  
  echo $result;
?>

alert comes an empty window. If the login / password is not correct, it sends a 401, but here it’s just empty without a response

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question