11 Dim line, lineArray, lineIndex
14 Dim customData, msiProperties, InstallDir, ShibFileExtension
17 Set WebObj = GetObject("IIS://LocalHost/W3SVC")
20 'Get the INSTALLDIR and SHIB_FILE_EXTENSION values via CustomActionData
21 customData = Session.Property("CustomActionData")
22 msiProperties = split(customData,";@;")
23 InstallDir = msiProperties(0)
24 ShibFileExtension = msiProperties(1)
26 'Remove all trailing backslashes to normalize
27 do while (mid(InstallDir,Len(InstallDir),1) = "\")
28 InstallDir = mid(InstallDir,1,Len(InstallDir)-1)
30 ShibISAPIPath = InstallDir & "\libexec\isapi_shib.dll"
31 'Make sure ShibFileExtension is in proper format
32 'First, strip any preceding periods
33 do while (mid(ShibFileExtension,1,1) = ".")
34 ShibFileExtension = mid(ShibFileExtension,2,Len(ShibFileExtension)-1)
36 'If there is nothing left (or was nothing to begin with), use the default
37 if (ShibFileExtension = "") then
38 ShibFileExtension = ".sso"
41 ShibFileExtension = "." & ShibFileExtension
44 'Specify other ISAPI Filter details
45 FilterName = "Shibboleth"
46 FilterPath = ShibISAPIPath
49 Set FiltersObj = GetObject("IIS://LocalHost/W3SVC/Filters")
50 LoadOrder = FiltersObj.FilterLoadOrder
51 'Check to see if 'Shibboleth' is already sequenced
52 existsFlag = "not_exist"
53 lineArray = split(LoadOrder, ",")
54 for each line in lineArray
55 if (line = FilterName) then
59 if (existsFlag = "not_exist") then
60 If LoadOrder <> "" Then
61 LoadOrder = LoadOrder & ","
63 LoadOrder = LoadOrder & FilterName
64 FiltersObj.FilterLoadOrder = LoadOrder
67 'msgbox "Shib Filter already sequenced"
70 Set FilterObj = FiltersObj.Create("IIsFilter", FilterName)
72 'Open existing filter for updating
74 Set FilterObj = GetObject("IIS://LocalHost/W3SVC/Filters/" & FilterName)
76 FilterObj.FilterPath = FilterPath
77 FilterObj.FilterDescription = FilterDesc
80 'Create file extension mapping to ISAPI filter
81 ScriptMaps = WebObj.ScriptMaps
83 newScriptLine = ShibFileExtension & "," & ShibISAPIPath & ",1"
84 existsFlag = "not_exist"
86 for each line in ScriptMaps
87 lineArray = split(line,",")
88 if (lineArray(0) = ShibFileExtension) then
92 lineIndex = lineIndex + 1
94 if (existsFlag = "not_exist") then
95 redim preserve ScriptMaps(UBound(ScriptMaps)+1)
96 ScriptMaps(UBound(ScriptMaps)) = newScriptLine
97 WebObj.ScriptMaps = ScriptMaps
100 'msgbox ".sso already exists: " & lineIndex
101 'We already warned user in dialog that this value would be updated
102 ScriptMaps(lineIndex) = newScriptLine
103 WebObj.ScriptMaps = ScriptMaps
108 'Web Services Extension
110 WebSvcExts = WebObj.WebSvcExtRestrictionList
112 newWebSvcExtLine = "1," & ShibISAPIPath & ",1,ShibGroup,Shibboleth Web Service Extension"
114 existsFlag = "not_exist"
116 for each line in WebSvcExts
117 lineArray = split(line,",")
118 if (lineArray(1) = ShibISAPIPath) then
119 existsFlag = "exists"
122 lineIndex = lineIndex + 1
125 if (existsFlag = "not_exist") then
126 redim preserve WebSvcExts(UBound(WebSvcExts)+1)
127 WebSvcExts(UBound(WebSVCExts)) = newWebSvcExtLine
128 WebObj.WebSvcExtRestrictionList = WebSvcExts
131 'msgbox "Shibboleth Web Services Extension already exists: " & lineIndex
132 'We already warned user in dialog that this value would be updated
133 WebSvcExts(lineIndex) = newWebSvcExtLine
134 WebObj.WebSvcExtRestrictionList = WebSvcExts