Skip to Content
0

Apache Cordova saves SAPUI5 credentials even when app is killed

Nov 20, 2016 at 02:18 PM

79

avatar image

Hello Experts,

I'm using Apache Cordova in my SAPUI5 application in order to use the camera.

The app works, however, session is not cleared (user is still authenticated when re-opening the app).

Scenario 1:
1) Open the app
2) Enter credentials
3) Work with the app
4) Move the app to background (by using back button or launching another app)
5) Move the app to foreground - session is still alive and user is authenticated (which is OK)

Scenario 2:
1) App was killed from task manager
2) When opening the app - session is still alive (which is NOT OK)

The problem: When running Scenario 2 I want to clear the session...

Also, different model data is still bounded to UI controls.


How can I solve this issue?

Android version is 5.01
Mobile device is LG4
Cordova version is: 6.4.0
SAPUI5 version is: 1.28.38

Regards,

Omri

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Omri Cohen Nov 20, 2016 at 03:41 PM
0

Hi,

Solved it on my own by deleting the relevant cookies (in my case it's jsp):

Cookie cookie = new Cookie("MYSAPSSO2","");
cookie.setPath("/");
cookie.setDomain(myDomain);
cookie.setMaxAge(0);
response.addCookie(cookie);

Cookie cookie2 = new Cookie("JSESSIONID","");
cookie2.setPath("/");
cookie2.setDomain(myDomain);
cookie2.setMaxAge(0);
response.addCookie(cookie2);

I'm calling the code in the onInit of the component.

Regards,

Omri

Share
10 |10000 characters needed characters left characters exceeded