How to use JIRA users for a separate Java application

Hi All,

I have a java spring web application, In this application i want to add login modules which will use JIRA users credential to login in Java application. It should work with all details of JIRA users (Like session, session time out and other user functionality ). What is the best approach to achieve this ?

I go through the REST API but and try basic authentication (Not try Cookie based because it is going to remove as per documentation) but not able to get user session and also i notice for each different user login it overwrite the already login user session. I want a secure user authentication from JAVA application as we have for JIRA login.

Ex:- I have two user in JIRA. I login in Java application with two user in different system. While sending request to get information from JIRA server it is overwriting the previous user session. Is there any way to make it secure and for each user create a new session and close session on logout from Java application.