I am trying to to build a plugin for JIRA where I was using REST API. Using Jersey client to connect web resource and getting the JSON response i.e ClientResponse. Here I am using Authorization in header and used Basic type authorization where it needs username and password. I want to use session or any other type of authorization technique because no one provide the password as plain text and then get encrypted both username and password and send the request. So my question is: is there any other way where REST API can be called in JIRA so that I can call other REST API without using password.
My code is :
Client client = Client.create();
String resturl="https://domainname.com/rest/gadget/1.0/currentUser";
WebResource webResource = client.resource(resturl);
ClientResponse response = webResource.header("Authorization", "Basic" + auth).type("application/json").get(ClientResponse.class);
int statusCode = response.getStatus();
String jsonResponse = response.getEntity(String.class);
w.write("Status:"+statusCode);
w.write("Response:"+jsonResponse);
I am getting the response from above code but nobody provides the password in plain text to access the resource. Anybody have any idea about that problem?