Supporting cookie validation
You can now 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 based on the validation results,
the launcher and/or the application can be determined whether to allow
to download the requested files.
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.
To set a cookie to the cloud app launcher
and the application,
You can modify the JavaScript file (launcher.js) on the Web
server to set a cookie to the cloud app launcher.
launcher.js is located in the application folder > “js”
sub-folder on the Web server, for example,
C:inetpubwwwrootsalesdemo_localjslauncher.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 6 7 8 9 10 11 12 13 14 15 16 |
function getCookie(){ var strCookie = ""; strCookie = <span><strong>document.cookie</strong></span>; return strCookie; } function getCmdline(Url){ var strCookie = getCookie(); var strUrl = Url; if(strCookie.length > 0) { strUrl += " -cookie "; strUrl += strCookie; } return strUrl; } |
For example, the following JavaScript will set the cookie by
obtaining the cookie from the application URL, for example,
http://localhost/test?name=admin;pw=123.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
function getCookie(){ var strCookie = ""; strCookie = <span><strong>window.parent.parent.location.search.split("?")[1]</strong></span>; return strCookie; } function getCmdline(Url){ var strCookie = getCookie(); var strUrl = Url; if(strCookie.length > 0) { strUrl += " -cookie "; strUrl += strCookie; } return strUrl; } |