Authentication inside a Jira Plugin

HI Everyone,
I’m currently implementing a Jira plugin where I make some calls to the Tempo for Jira Plugin REST APIs. Basically a Jira system administrator logs into Jira and uploads an excel file with some data. This data are then used by the plugin’s back-end as input data for the REST API Calls. I am using Jersey API client version 1.8-atlassian-16.
I was able to make everything work by using Basic Authentication to make the REST calls but this implies saving username and password in the Java code which is not the best.
As suggested here, I managed to pass the user’s cookies to the Jersey Client Request but I got 401 error when trying to make REST API Calls.
Apart from Basic Authentication, is there any other way to authenticate into Jira from inside a Jira Plugin and use Jersey for REST API Calls?

Thank you!
Giorgia