<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<%@ LANGUAGE="VBScript" %>
</HEAD>
<BODY>
<%
'Declare and assign CAS server variable
Dim casServer
casServer = "localhost:8443/cas"
'Declare additional variables used for redirect
Dim protocol, originatingURL, caseNetworkID
'Determine the protocol for the originitating page
if Request.ServerVariables("HTTPS") = "off" then
protocol = "http"
else
protocol = "https"
end if
'Construct the originatingURL variable based on ServerVariables
'originatingURL = protocol & "://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL")
originatingURL = protocol & "://localhost" & Request.ServerVariables("URL")
'Check to see if the 'ticket' variable was passed via the query string
if Request.QueryString("ticket") = "" then
'If no, then redirect to CAS
Response.Redirect("https://" & casServer & "/login?service=" & originatingURL)
else
'If yes, create MSXML object and attempt to validate the ticket
Dim objSvrHTTP, ticket, casResponse, casResponseArray
ticket = Request.QueryString("ticket")
'Set objSvrHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP")
Set objSvrHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.5.0")
objSvrHTTP.open "GET", "https://" & casServer & "/validate?ticket="+ ticket +"&service=" & originatingURL, false
objSvrHTTP.setOption(2) = 13056
objSvrHTTP.send
casResponse = objSvrHTTP.responseText
casResponseArray = Split(casResponse, Chr(10), -1, 1)
if casResponseArray(0) = "no" then
Response.Redirect("https://" & casServer & "/login?service=" & originatingURL)
else
caseNetworkID = casResponseArray(1)
Response.write caseNetworkID
end if
end if
%>
</BODY>
</HTML>
posted on 2006-11-15 09:07
robbin163 阅读(716)
评论(1) 编辑 收藏