diff --git a/.gitignore b/.gitignore index 72a324b..3677686 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ *.user *.userosscache *.sln.docstates +web-user-tokenized.config # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs diff --git a/GenerateTokenizedConfig.ps1 b/GenerateTokenizedConfig.ps1 new file mode 100644 index 0000000..6d00c64 --- /dev/null +++ b/GenerateTokenizedConfig.ps1 @@ -0,0 +1,26 @@ +function XmlDocTransform($xml, $xdt) +{ + if (!$xml -or !(Test-Path -path $xml -PathType Leaf)) { + throw "File not found. $xml"; + } + if (!$xdt -or !(Test-Path -path $xdt -PathType Leaf)) { + throw "File not found. $xdt"; + } + + Add-Type -LiteralPath "$PSScriptRoot\Microsoft.Web.XmlTransform.dll" + + $xmldoc = New-Object Microsoft.Web.XmlTransform.XmlTransformableDocument; + $xmldoc.PreserveWhitespace = $true + $xmldoc.Load($xml); + + $transf = New-Object Microsoft.Web.XmlTransform.XmlTransformation($xdt); + if ($transf.Apply($xmldoc) -eq $false) + { + throw "Transformation failed." + } + $xmldoc.Save($xml); +} + +Copy-Item "$PSScriptRoot\web-user.config" "$PSScriptRoot\web-user-tokenized.config" -Force + +XmlDocTransform "$PSScriptRoot\web-user-tokenized.config" "$PSScriptRoot\web-user-transform.xml" \ No newline at end of file diff --git a/Microsoft.Web.XmlTransform.dll b/Microsoft.Web.XmlTransform.dll new file mode 100644 index 0000000..34d67d5 Binary files /dev/null and b/Microsoft.Web.XmlTransform.dll differ diff --git a/appveyor.yml b/appveyor.yml index 05d2071..9d6e50d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,6 +18,7 @@ environment: before_build: - ps: .\CopySonarTarget.ps1 + - ps: .\GenerateTokenizedConfig.ps1 - nuget restore - cmd: if defined SonarToken (SonarQubeScanner\SonarQube.Scanner.MSBuild.exe begin /k:"IisRemoteUserTokenAuthentication" /v:0.4 /d:"sonar.host.url=https://sonarqube.com" /d:"sonar.login=%SonarToken%" /d:"sonar.verbose=true") @@ -50,11 +51,15 @@ after_test: - cmd: copy "%APPVEYOR_BUILD_FOLDER%\web-scanner.config" "%APPVEYOR_BUILD_FOLDER%\Staging\inetpub-scanner\web.config" - cmd: copy "%APPVEYOR_BUILD_FOLDER%\ConfigureServer.ps1" "%APPVEYOR_BUILD_FOLDER%\Staging\ConfigureServer.ps1" - 7z a RutaHttpModule.zip "%APPVEYOR_BUILD_FOLDER%\Staging\" + - cmd: copy "%APPVEYOR_BUILD_FOLDER%\web-user-tokenized.config" "%APPVEYOR_BUILD_FOLDER%\Staging\inetpub-user\web.config" + - 7z a RutaHttpModule-Tokenized.zip "%APPVEYOR_BUILD_FOLDER%\Staging\" - cmd: if defined SonarToken (SonarQubeScanner\SonarQube.Scanner.MSBuild.exe end /d:"sonar.login=%SonarToken%") artifacts: - path: RutaHttpModule.zip name: RutaHttpModule + - path: RutaHttpModule-Tokenized.zip + name: RutaHttpModule-Tokenized deploy: release: $(APPVEYOR_REPO_TAG_NAME) diff --git a/web-user-transform.xml b/web-user-transform.xml new file mode 100644 index 0000000..51fe067 --- /dev/null +++ b/web-user-transform.xml @@ -0,0 +1,21 @@ + + + + + + + __DowncaseGroups__ + + + __AppendString__ + + + __AdUserBaseDn__ + + + __AdGroupBaseDn__ + + + + \ No newline at end of file