I have exactly the same issue as here: Jira user creation via REST results in 401 - This resource requires WebSudo. However, in my case, I want to connect with Java Http Client.
I've examined documentation and I've tried to:
Put credentials in header
{ final String encoding = Base64.getEncoder().encodeToString((SERVICE_DESK_ADMIN + ":" + SERVICE_DESK_ADMIN_KEY).getBytes("UTF-8")); httpPost.setHeader(HttpHeaders.AUTHORIZATION, "Basic " + encoding); }
Try to implement preemptive authorization described here: HttpClient Basic Authentication
In both cases, I got the same response from server:
{
"message" : "This resource requires WebSudo.",
"status-code" : 401
}
In the preemptive case, I've spotted in log something like this:
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
My questions are:
- From the log, is the last line indicates that my configuration is not working?
- Does anybody have success in adding a user to the service desk via rest API with the usage of HTTP client?