Java Jira ServiceDesk用户创建-此资源需要WebSudo
我的问题与这里完全相同:。然而,在我的例子中,我想连接JavaHTTP客户机 我检查了文档,并尝试: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
{
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客户端与我的问题无关
- 使用HTTP客户端在JIRA中创建用户有两种可能的解决方案:
- Veeeery丑陋-我注意到创建用户的第一个Http帖子返回cookies。现在,当获取这些cookie并将它们放到下一个Http post并将登录更改为电子邮件时,将导致工作(用户将成功创建)。然而,正如我所说的,这是丑陋的,完全违背了REST的思想,因为REST应该是无状态的
- 禁用WebSudo-。小警告,要使其正常工作,您必须重新启动jira李>