Aug 15 14 4:59 am
$baseuri = "http://www.myitforum.com/"
$username = "ad\Wir"
$password = "password"
#server will respond with 401 on first attempt, then Powershell will add the credentials and retry
$uri = New-Object System.Uri ($baseuri+"basic-auth/" + $username + "/" + $password)
$secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ($username, $secpasswd)
$r = Invoke-WebRequest -Uri $uri.AbsoluteUri -Credential $mycreds
$r.Content
$baseuri = "http://www.myitforum.com/"
$username = "ad\Wir"
$password = "password"
#preemtive authentication
$uri = New-Object System.Uri ($baseuri+"basic-auth/" + $username + "/" + $password)
$encoded = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($username+":"+$password ))
$headers = @{Authorization = "Basic "+$encoded}
Aug 15 14 10:05 am
Aug 15 14 11:06 am
adrien wrote:407 is an auth challenge from the proxy. So you either need to not require auth for that request at the proxy, or handle auth in your script.
Aug 15 14 6:04 pm
Aug 16 14 1:59 am
adrien wrote:Sorry - I missed what you were trying to do.
If you're building a request using Basic auth, make sure Basic is permitted in the WWW proxy, also make sure it's a Proxy-Authorization header rather than Authorization.
Aug 16 14 11:59 am
Aug 18 14 3:47 am
adrien wrote:Hi
so you're trying to test client cert based auth? You didn't mention certs before now, and I had to analyse your scripts to see you were trying to do Basic auth.
We don't have any scripts for this, haven't been asked for such things before.
For cert-based auth, you shouldn't put authorization headers in (such as auth Basic), just use a client cert that the WinGate server will trust, where the UPN in the certificate matches the user principal name on an account. The UPN (user principal name) is stored in Subject Alternative Name field in the certificate, with OID of szOID_NT_PRINCIPAL_NAME, ("1.3.6.1.4.1.311.20.2.3").
If you tried using a cert without this extension, the AD user database should have logged a warning, so check your logs.
It will also fail auth if the cert is revoked, the cert failed validation (isn't trusted somehow, or fails in some other way - e.g. expires). These are all logged
You can use a cert to auth against a user or computer account, only with the AD user database provider.
As for getting a script to use a client cert, sorry I have no idea. Dr Google should have a few ideas though
maybe http://stackoverflow.com/questions/12782371/powershell-https-get-using-client-certificate-from-certsore
Aug 18 14 11:05 am
Do you have any VBS, PowerShell or C# code that will prove that Wingate is working correctly when Certs are passed to it?
Aug 18 14 11:06 am