You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi,
While integrating with JIRA using the Java Rest client, I got a socket timeout issue. Based on the discussion on this forum, I tried to create my own Authentication Handler. But I am not sure, what attributes to set in Builder Object. Can you please help us with this?
import org.apache.commons.codec.binary.Base64;
import com.atlassian.httpclient.api.Request.Builder;
import com.atlassian.jira.rest.client.api.AuthenticationHandler;
public class JiraCustomHandler implements AuthenticationHandler {
private final String username;
private final String password;
public JiraCustomHandler(String username, String password) {
this.username = username;
this.password = password;
}
@Override
public void configure(Builder builder) {
builder.setAttribute("PROPERTY_CONNECT_TIMEOUT", "22000");
builder.setHeader("Authorization", "Basic " + encodeCredentials());
}
private String encodeCredentials() {
byte[] credentials = (this.username + ':' + this.password).getBytes();
return new String(Base64.encodeBase64(credentials));
}
}