Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Jira ServiceDesk用户创建-此资源需要WebSudo_Java_Rest_Jira_Jira Rest Api - Fatal编程技术网

Java Jira ServiceDesk用户创建-此资源需要WebSudo

Java Jira ServiceDesk用户创建-此资源需要WebSudo,java,rest,jira,jira-rest-api,Java,Rest,Jira,Jira Rest Api,我的问题与这里完全相同:。然而,在我的例子中,我想连接JavaHTTP客户机 我检查了文档,并尝试: 将凭证放入标题中 { final String encoding = Base64.getEncoder().encodeToString((SERVICE_DESK_ADMIN + ":" + SERVICE_DESK_ADMIN_KEY).getBytes("UTF-8")); httpPost.setHeader(HttpHeaders.AUTHORIZATION, "Ba

我的问题与这里完全相同:。然而,在我的例子中,我想连接JavaHTTP客户机

我检查了文档,并尝试:

  • 将凭证放入标题中

    {
        final String encoding = Base64.getEncoder().encodeToString((SERVICE_DESK_ADMIN + ":" + SERVICE_DESK_ADMIN_KEY).getBytes("UTF-8"));
        httpPost.setHeader(HttpHeaders.AUTHORIZATION, "Basic " + encoding);
    }
    
  • 尝试实现此处描述的抢先授权:

  • 在这两种情况下,我从服务器得到了相同的响应:

    {
      "message" : "This resource requires WebSudo.",
      "status-code" : 401
    }
    
    在先发制人的案例中,我在日志中发现了如下内容:

    2020/03/03 16:41:45:774 CET [DEBUG] MainClientExec - Connection can be kept alive indefinitely
    2020/03/03 16:41:45:774 CET [DEBUG] HttpAuthenticator - Authentication required
    2020/03/03 16:41:45:774 CET [DEBUG] HttpAuthenticator - <here_is_address>:443 requested authentication
    2020/03/03 16:41:45:774 CET [DEBUG] TargetAuthenticationStrategy - Authentication schemes in the order of preference: [Negotiate, Kerberos, NTLM, CredSSP, Digest, Basic]
    2020/03/03 16:41:45:774 CET [DEBUG] TargetAuthenticationStrategy - Challenge for Negotiate authentication scheme not available
    2020/03/03 16:41:45:774 CET [DEBUG] TargetAuthenticationStrategy - Challenge for Kerberos authentication scheme not available
    2020/03/03 16:41:45:774 CET [DEBUG] TargetAuthenticationStrategy - Challenge for NTLM authentication scheme not available
    2020/03/03 16:41:45:774 CET [DEBUG] TargetAuthenticationStrategy - Challenge for CredSSP authentication scheme not available
    2020/03/03 16:41:45:774 CET [DEBUG] TargetAuthenticationStrategy - Challenge for Digest authentication scheme not available
    2020/03/03 16:41:45:774 CET [DEBUG] TargetAuthenticationStrategy - Challenge for Basic authentication scheme not available
    
    2020/03/03 16:41:45:774 CET[DEBUG]MainClientExec-连接可以无限期保持活动状态
    2020/03/03 16:41:45:774 CET[DEBUG]HttpAuthenticator-需要身份验证
    2020/03/03 16:41:45:774 CET[DEBUG]HttpAuthenticator-:443请求的身份验证
    2020/03/03 16:41:45:774 CET[DEBUG]TargetAuthenticationStrategy-按优先顺序排列的身份验证方案:[协商、Kerberos、NTLM、CredSSP、摘要、基本]
    2020/03/03 16:41:45:774 CET[DEBUG]TargetAuthenticationStrategy-协商身份验证方案挑战不可用
    2020/03/03 16:41:45:774 CET[DEBUG]TargetAuthenticationStrategy-Kerberos身份验证方案挑战不可用
    2020/03/03 16:41:45:774 CET[DEBUG]TargetAuthenticationStrategy-NTLM身份验证方案挑战不可用
    2020/03/03 16:41:45:774 CET[DEBUG]TargetAuthenticationStrategy-对CredSSP身份验证方案的挑战不可用
    2020/03/03 16:41:45:774 CET[DEBUG]TargetAuthenticationStrategy-摘要身份验证方案挑战不可用
    2020/03/03 16:41:45:774 CET[DEBUG]TargetAuthenticationStrategy-基本身份验证方案挑战不可用
    
    我的问题是:

  • 从日志中,最后一行是否表示我的配置不工作
  • 有人使用HTTP客户端通过rest API成功地将用户添加到服务台吗
    以下是我问题的答案:

    • HTTP客户端与我的问题无关
    • 使用HTTP客户端在JIRA中创建用户有两种可能的解决方案:
    • Veeeery丑陋-我注意到创建用户的第一个Http帖子返回cookies。现在,当获取这些cookie并将它们放到下一个Http post并将登录更改为电子邮件时,将导致工作(用户将成功创建)。然而,正如我所说的,这是丑陋的,完全违背了REST的思想,因为REST应该是无状态的
    • 禁用WebSudo-。小警告,要使其正常工作,您必须重新启动jira
    我选择了第二个解决方案,现在它就像一个魅力