Jira ServiceDesk 用户创建 - 此资源需要 WebSudo
Jira ServiceDesk User Creation - This resource requires WebSudo
我遇到的问题与此处完全相同:。但是,就我而言,我想连接 Java Http 客户端。
我已检查文档并尝试:
将凭据放入 header
{
final String encoding = Base64.getEncoder().encodeToString((SERVICE_DESK_ADMIN + ":" + SERVICE_DESK_ADMIN_KEY).getBytes("UTF-8"));
httpPost.setHeader(HttpHeaders.AUTHORIZATION, "Basic " + encoding);
}
尝试实现这里描述的抢先授权:HttpClient Basic Authentication
在这两种情况下,我从服务器得到了相同的响应:
{
"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
我的问题是:
- 从日志来看,最后一行是否表明我的配置不起作用?
- 是否有人使用 HTTP 客户端通过 rest API 成功将用户添加到服务台?
这是我的问题的答案:
- HTTP 客户端与我的问题无关
- 使用 HTTP 客户端在 JIRA 中创建用户有两种可能的解决方案:
- Veeeeery 丑陋 - 我注意到第一个 Http post 创建用户,returns cookie。现在,当获取这些 cookie 并将它们放入下一个 Http post 并将登录更改为电子邮件时,将导致工作(用户将成功创建)。然而,正如我所说,它很丑陋并且完全违背了 REST 理念,因为 REST 应该是无状态的。
- 禁用 WebSudo - Disable WEBSUDO in Jira。小警告,要使此工作正常,您必须重新启动 jira。
我选择了第二种解决方案,现在它运行得非常棒。
我遇到的问题与此处完全相同:
我已检查文档并尝试:
将凭据放入 header
{ final String encoding = Base64.getEncoder().encodeToString((SERVICE_DESK_ADMIN + ":" + SERVICE_DESK_ADMIN_KEY).getBytes("UTF-8")); httpPost.setHeader(HttpHeaders.AUTHORIZATION, "Basic " + encoding); }
尝试实现这里描述的抢先授权:HttpClient Basic Authentication
在这两种情况下,我从服务器得到了相同的响应:
{
"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
我的问题是:
- 从日志来看,最后一行是否表明我的配置不起作用?
- 是否有人使用 HTTP 客户端通过 rest API 成功将用户添加到服务台?
这是我的问题的答案:
- HTTP 客户端与我的问题无关
- 使用 HTTP 客户端在 JIRA 中创建用户有两种可能的解决方案:
- Veeeeery 丑陋 - 我注意到第一个 Http post 创建用户,returns cookie。现在,当获取这些 cookie 并将它们放入下一个 Http post 并将登录更改为电子邮件时,将导致工作(用户将成功创建)。然而,正如我所说,它很丑陋并且完全违背了 REST 理念,因为 REST 应该是无状态的。
- 禁用 WebSudo - Disable WEBSUDO in Jira。小警告,要使此工作正常,您必须重新启动 jira。
我选择了第二种解决方案,现在它运行得非常棒。