on 01-26-2021 9:05 AM
Dear Community,
We have a SAPUI5 app and we need to implement the logout feature in it as it won't be part of the portal. The app is communicating with the backend service via the approuter and is deployed using html5 repository.
We are able to logout the user by calling the logout endpoint using window.location.replace('/do/logout'), but we are not being able to redirect the user to our custom logout page. Only the central login page appears after logout.
If we try to do a AJAX call to the logout endpoint the session cookies are kept, no real logout happens. Navigating back to the app we are able to access the it without relogin.
How can we avoid using the window.location (as our static code checks will complain about this) and redirect the user to a custom logout page?
Here is our xs-app.json:
{
"welcomeFile": "index.html",
"authenticationMethod": "route",
"logout": {
"logoutEndpoint": "/do/logout"
},
"routes": [
{
"source": "^/rest(.*)$",
"target": "$1",
"authenticationType": "xsuaa",
"scope": [
"$XSAPPNAME.SettingsRead",
"$XSAPPNAME.PartitioningCreateInitial",
"$XSAPPNAME.LogEventsRead",
"$XSAPPNAME.ChartExecute"
],
"destination": "etd-cloud-rest"
},
{
"source": "^/internal/rest/(.*)$",
"target": "/internal/$1",
"authenticationType": "xsuaa",
"scope": [
"$XSAPPNAME.TenantSelect"
],
"destination": "etd-cloud-rest"
},
{
"source": "^/odata(.*)$",
"target": "$1",
"authenticationType": "xsuaa",
"scope": [
"$XSAPPNAME.SettingsRead",
"$XSAPPNAME.SettingsManageEventStorageWrite",
"$XSAPPNAME.SettingsTimeZoneWrite",
"$XSAPPNAME.SettingsRetentionPeriodWrite",
"$XSAPPNAME.ValuelistRead",
"$XSAPPNAME.ValuelistWrite",
"$XSAPPNAME.LogEventsRead",
"$XSAPPNAME.AlertsRead"
],
"destination": "etd-cloud-odata"
},
{
"source": "^/internal/odata/(.*)$",
"target": "/internal/$1",
"authenticationType": "xsuaa",
"scope": [
"$XSAPPNAME.TenantSelect"
],
"destination": "etd-cloud-odata"
},
{
"source": "^/query(.*)$",
"target": "$1",
"authenticationType": "xsuaa",
"destination": "etd-cloud-query"
},
{
"source": "^/internal/query/(.*)$",
"target": "/internal/$1",
"authenticationType": "xsuaa",
"scope": [
"$XSAPPNAME.TenantSelect"
],
"destination": "etd-cloud-query"
}
]
}
Hi Luisa,
You say that your application uses html5 apps repo but I don't see any route in xs-app.json that points to, for example:
{
"source": "^(/.*)","target": "$1","service": "html5-apps-repo-rt","authenticationType": "xsuaa"}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Luisa,
Oh, this is the central approuter xs-app.json. Then why you have all these routes in central xs-app.json?. All html5 application routes (to html5 application backend) should be placed in the html5 application xs-app.json.
If you modeled it that way because it did not work for you it is probably because your ui is sending requests with absolute URLs --> for example dataSource: odata/.. (without leading slash).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.