CoSign: Collaborative Single Sign-On  
AnnouncementsDiscussion
 

cosign-discuss at umich.edu
general discussion of cosign development and deployment
 

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: logout vbscript



I delete all cookies older that one day with script below.
Konstantin.

'kvoyk -- this script scheduled to run with 'Scheduled Tasks' 
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService. _
    ExecQuery("Select * from CIM_DataFile where Path = '\\Program
Files\\IISCosign\\CookieDB\\'")
For Each objFile in colFiles
    CreationDate = WMIDateStringToDate(objFile.CreationDate)
    'numberofHours shows how old cookie I want to delete. I delete cookie
older that 24 hours.
    NumberOfHours=24
    if DateDiff("h",  Cdate(CreationDate),Now)>=NumberOfHours then
       Set objFSO = CreateObject("Scripting.FileSystemObject")
       objFSO.DeleteFile("C:" & objFile.Path & "\" & objFile.FileName)
    end if
Next

'convert WMI date to Time value
Function WMIDateStringToDate(dtmInstallDate)
    WMIDateStringToDate = CDate(Mid(dtmInstallDate, 5, 2) & "/" & _
        Mid(dtmInstallDate, 7, 2) & "/" & Left(dtmInstallDate, 4) _
            & " " & Mid (dtmInstallDate, 9, 2) & ":" & _
                Mid(dtmInstallDate, 11, 2) & ":" & Mid(dtmInstallDate, _
                    13, 2))
End Function

-----Original Message-----
From: Sweetman, David [mailto:dsweetma@xxxxxxxxxxxx] 
Sent: Wednesday, November 02, 2005 10:43 AM
To: chrislafty@xxxxxxx; Malestein, Jarod Douwe
Cc: cosign-discuss@xxxxxxxxx
Subject: RE: logout vbscript

Chris - What if you also delete the server-side cookie?  Here's a code
snippet that does that via VBScript:

Servicename = "InsertYourCoSignServiceNameHere"
Servername = "InsertYourServerNameHere"

s= request.ServerVariables(2)
buf = split(s,chr(10))
  for each b in buf
    if instr(b,"; " & ServiceName)>0 then
       ck = Right(b, Len(b) - Instr(b, Servername & "=") - 10)
       ck = Left(ck, (Len(ck) - 1))
    end if
  next
 set fs = server.CreateObject("Scripting.FileSystemObject")
 dirPath = "C:\Program Files\CoSign\CookieDB\"

pt = dirPath & ck
if (fs.fileexists(pt)) then
   fs.deletefile(pt) 
end if



David Sweetman
Windows Enterprise Systems Administrator
Michigan Administrative Information Services
University of Michigan

-----Original Message-----
From: Christopher Lafty [mailto:chl114@xxxxxxx] 
Sent: Tuesday, November 01, 2005 9:01 PM
To: Malestein, Jarod Douwe
Cc: chrislafty@xxxxxxx; cosign-discuss@xxxxxxxxx
Subject: Re: logout vbscript

Yep, it's in the same directory as my cosign protected application...

-C

jarod@xxxxxxxxx wrote:

>
> Chris,
>
> I haven't had a chance to try out your script yet.  It certainly looks

> like it's
> doing all the right things!  Just to be sure, the logout script is 
> behind a
> cosign-protected URL, right?
>
> --Jarod
>
> Quoting Christopher Lafty <chl114@xxxxxxx>:
>
>> I'm trying to build a logout script in vbscript, but it doesn't seem
to
>> function.  Here it is:
>> <%
>>    Session.Abandon
>>
>>    'get cosign cookie name as string
>>    cosignCookie =
CStr(Request.ServerVariables("HTTP_COSIGN_SERVICE"))
>>
>>    Response.Cookies(cosignCookie)="null"
>>    Response.Cookies(cosignCookie).Expires = Date()-1000
>>    Response.Cookies(cosignCookie).Domain ="/"
>>    Response.Cookies(cosignCookie).Secure=True
>>
>>    Response.redirect "https://webaccess.psu.edu/cgi-bin/logout";
>> %>
>>
>> Any takers?  I would use php or perl, but don't have the option.
>>
>> Thanks,
>> Chris
>>
>> -- 
>>
>>
>>
>>
>>
>>
>>
>> .....................................
>> :: Christopher Lafty
>> :: Web Site Administrator
>> :: Department of Biology
>> :: Pennsylvania State University
>> :: chrislafty@xxxxxxx
>> .....................................
>>
>>
>>
>>
>>
>
>
>
>

-- 







.....................................
:: Christopher Lafty
:: Web Site Administrator
:: Department of Biology
:: Pennsylvania State University
:: chrislafty@xxxxxxx
.....................................





 
Copyright © 2002 - 2004 Regents of the University of Michigan :  Page last updated 15-December-2010