Support cookie validation
You can set a cookie to the cloud app launcher and the
application; and the cookie will be automatically carried in the HTTP
request header of every client request.
Once a cookie is set to the cloud app launcher and the
application, the cookie can be validated against the validation scripts
or the SSO server etc. And the validation results will determine whether
the launcher and/or the application allow to download the requested
files and/or connect with the database.
Notice that
-
Currently you can only set the name and value for a cookie,
and cannot set the other cookie attributes (including Domain,
Expires, Path etc.); and you must set the cookie in the key-value
pairs, for example, “key1=value1; key2=value2”. -
The cookie must be passed into the launcher and the
application by the index.html file, therefore, you will have to
start the application from the index.html (by accessing the app URL
in the Web browser); you cannot start the application from the app
shortcut on the desktop or start menu. -
Make sure the cookie will stay valid if you select “Download
the app files as necessary” because files will be downloaded only
when requested. Set an appropriate expiration period for the
cookie. -
The application URL and the Web API URL should use the same
domain name, otherwise the cookie will become invalid because of the
cross domain security issue. -
If you have changed the JavaScript file (cloudapplauncher.js)
on the server, the client that has accessed this application before
should clear the browser cache (for example, “Cached images and
files” in Chrome should be cleared) in order to download the updated
file successfully.
To set a cookie to the cloud app launcher
and the application,
You need to modify the JavaScript file (cloudapplauncher.js) on
the server to set a cookie to the cloud app launcher.
This file is located in the application folder > “js”
sub-folder on the server, for example,
C:inetpubwwwrootsalesdemo_cloudjscloudapplauncher.js.
For example, the following JavaScript will set the cookie by
obtaining the cookie from document.cookie. However, if the cookie is set
to HttpOnly, it cannot be accessed from document.cookie by
JavaScript.
|
1 2 3 4 5 |
function getCookie(){ var strCookie = ""; strCookie = <span><strong>document.cookie</strong></span>; return strCookie; } |
For example, the following JavaScript will set the cookie by
obtaining the cookie from the application URL, for example,
http://localhost:5000/test?name=admin;pw=123.
|
1 2 3 4 5 |
function getCookie(){ var strCookie = ""; strCookie = <span><strong>window.parent.parent.location.search.split("?")[1]</strong></span>; return strCookie; } |