Now that you have created an EnterpriseSession
and an InfoStore
object, you can query the APS. However, your session with the APS will eventually time out, depending on how long you set the session to hold the InfoStore
object. Instead of going through the logon process again, you can create a LogonToken
and then use this token to reinstate the session.
To request a LogonToken
from the server, use the LogonTokenMgr
property that is provided by the EnterpriseSession
object. Once you have retrieved the LogonToken, store it as a cookie with the name, "LogonToken". This name will be used to retrieve the value later on, allowing the user to be validated without having to supply a user name, password, APS name, and authentication type. See Retrieving the InfoStore object.
Note: The cookie, which is a value stored on the user's local disk by the web browser, can only be returned to the machine that stored the cookie. For example, if a user who is browsing the web encounters Server A, and that server writes a cookie to the user's local disk, the user can jump to Server B, and Server B would not have access to Server A's cookies. This ensures the security of cookies written to the user's local disk.
LogonTokenMgr = Sess.LogonTokenMgr;
SetCookie("LogonToken",LogonTokenMgr.CreateLogonTokenEx("", 60, 100));
A token is retrieved and stored in a cookie using the line of code that reads
SetCookie("LogonToken",LogonTokenMgr.CreateLogonTokenEx("", 60, 100));
You can use CreateLogonTokenEx
to specify the computer on which you want to use the token, as well as the maximum number of days and the maximum number of times the token can be used. See CreateLogonTokenEx Method. In the above case, the LogonToken
expires after 60 minutes or after being used 100 times.
The function that stored the token (SetCookie), is not a part of the SDK: it belongs in the previously mentioned helper file, helper_js.csp, which is included in Logon.csp using the include directive.
Licensing and session handling
Crystal Decisions, Inc. http://www.crystaldecisions.com Support services: http://support.crystaldecisions.com |