SSOLogon.csp


<%     

    '''''''''''''''''''''''''''''''''''''''''''''

    'This file attempts to logon a user using the Single Sign On

    'method.  If the logon fails, then the user is directed to a

    'logon form.  Note that both the WCS and the Web Server

    'must be configured for SSO before this works.

%>


<%@ Language=VBScript %>

<HTML>

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=charset=UTF-8">

<BODY>

<%



On Error Resume Next


    Dim UserID, Password, APS, Aut

    

    'Retrieve the name of the server to logon to.

    APS = Request.ServerVariables ("WCS_NAME_SERVER")


    'The UserID and Password are empty for SSO.

    UserID = ""

    Password= ""

    

    'NT Authentication must be used in order to use SSO.

    Aut = "secWindowsNT"


    'Don't cache the page.

    Response.Expires = 0

    

    Dim SessionManager


    'Create an Enterprise SessionManager.

    Set SessionManager = Server.CreateObject("CrystalEnterprise.SessionMgr")

    

    If Err.Number <> 0 then

        Response.Write "Couldn't create SessionManager."

        'Handle error here.

    Else

        Dim Sess

        'Log the user onto Crystal Enterprise using SSO.

        'Note that the authentication type is secWindowsNT

        'and that the UserID and password are blank.

        Set Sess = SessionManager.Logon(UserID, Password, APS, Aut)

        

        'Check to see if logon failed.

        If Err.Number <> 0 then


            'Redirect the user back to the logon page.

            Response.Redirect "LogonForm.csp"

        Else

            Dim IStore

            Dim LogonTokenMgr

            

            'Create the InfoStore object.

            Set IStore = Sess.Service ("", "InfoStore")


            'Store the InfoStore object in the session.

            Session("IStore") = IStore


            'Retrieve the LogonTokenManager.

            Set LogonTokenMgr = Sess.LogonTokenMgr

            

            'Session("IStore") = Sess.LogonTokenMgr

            

            'Retrieve a Logon Token and store it in the user's cookie file for later use.

            Response.Cookies("LogonToken") = LogonTokenMgr.CreateLogonTokenEx("", 60, 100)


            'Redirect the user to the site's home page.    

            Response.Redirect "home.csp?FolderID=0"        

        End If

    End If

%>

</BODY>

</HTML>






Crystal Decisions, Inc.
http://www.crystaldecisions.com
Support services:
http://support.crystaldecisions.com