Skip to content

tylermontneyacc/ExampleNuGetServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

An ASP.NET project with NuGet Server which requires a client certificate. Created for PowerShell/PowerShell#18209

Configuration

  • ASP.NET 4.8
  • NuGet Server 3.4.2
  • applicationhost.config
    • sslFlags: Ssl, SslNegotiateCert, SslRequireCert
    • iisClientCertificateMappingAuthentication: true

Using this project

You will need a certificate signed by a trusted CA, as IIS will only accept certs that it trusts.

  1. Import your trusted client certificate into PowerShell: $GoodCert = Get-ChildItem -Path "Cert:\LocalMachine\My" -Recurse | Where-Object { $_.Thumbprint -eq "123ABC..." }
  2. Generate a bad cert: $BadCert = New-SelfSignedCertificate -DnsName "www.fabrikam.com", "www.contoso.com" -CertStoreLocation "cert:\LocalMachine\My"
    • Remember to delete this once finished testing!
  3. Run the project in debug and copy the URL from the browser
  4. Invoke-WebRequest -Uri "https://localhost:12345/" should fail
  5. Invoke-WebRequest -Uri "https://localhost:12345/" -Certificate $GoodCert should succeed
  6. Invoke-WebRequest -Uri "https://localhost:12345/" -Certificate $BadCert should fail

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published