Session when login using Java Engine API

1
0
-1

Hi, im new Bonita, currenly i build Web Spring use Bonita Engine API community version.
The problem is a Session when i code login and logout. That mean If user1 login and perform start process, execute...etc, it work as well. But if when user2 login(user1 before login), the session will be replate by the last user(user2) and now user1 with any request will be use session of user2.
The problem same with logout when i can't specialize who will logout cause it just remove session not sessionId so it will record the last session who login last time.
Code login:

private static APISession session = null;
public String login(String user1, String pass){
        LoginAPI loginAPI = TenantAPIAccessor.getLoginAPI();
        session = loginAPI.login(user1, pass);
}

Code logout:

loginAPI.logout(session)

Any idea will be helpful, thanks

Comments

Submitted by julio.rey_1395310 on Mon, 03/25/2019 - 17:09

Did you use your session as Application Bean in Spring? I am not seeing your solution but... you must use a LoginAPI with Session Scope(Spring).. or get session in every Http Request, Could you have a login/logout in each Http Request (Spring Interceptor).

Submitted by nampham97se_1390962 on Mon, 03/25/2019 - 18:40

Thanks for answer, with option get session in every request, it mean login/logout every try-catch-final like example? it maybe not good solution for web client.
I will look up solution use a LoginAPI with Session Scope Spring and will be reply early result.
Do you want communication like email or social etc will be helpful faster?

Submitted by julio.rey_1395310 on Mon, 03/25/2019 - 20:28

If you have a web service (Rest) where each request... has a AccessToken I think that the most simple solution is a login-logout per request... If you have a traditional web app, with cookies and HttpSession Servlet... I think that using Session as Session Attribute could be a good choice (I don't know if the Bonita Session will be expiring, then You can to check to re-login if you Bonita Session expired and you WebApp session is alive)
Yes, you can... julio.rey@gmail.com

Submitted by nampham97se_1390962 on Tue, 03/26/2019 - 17:39

Hi, i have resolved this problem. Cause i use static in session, so Web is singleton variable session make it can't save all request :). I have too more problem about Bonita, I will send mail u soon.
Have a nice day.

No answers yet.
Notifications