Demonstrates C# authentication against a Plack server. Example challenge-response captured with tcpflow:
005.009.157.150.41257-005.009.157.150.03000: GET / HTTP/1.1
Connection: keep-alive
Host: u.nix.is:3000
005.009.157.150.03000-005.009.157.150.41257: HTTP/1.0 401 Unauthorized
Date: Mon, 11 Feb 2013 23:58:20 GMT
Server: HTTP::Server::PSGI
Content-Type: text/plain
Content-Length: 22
WWW-Authenticate: Basic realm="XML Test"
005.009.157.150.03000-005.009.157.150.41257: Authorization required
005.009.157.150.41258-005.009.157.150.03000: GET / HTTP/1.0
Authorization: Basic dGhlIHhtbCB1c2VyOnNvbWUgcGFzcyB3b3Jk
Connection: keep-alive
Host: u.nix.is:3000
005.009.157.150.03000-005.009.157.150.41258: HTTP/1.0 200 OK
Date: Mon, 11 Feb 2013 23:58:20 GMT
Server: HTTP::Server::PSGI
Content-Type: text/xml
Content-Length: 69
005.009.157.150.03000-005.009.157.150.41258: <xml>Hello user 'the xml user', you made it past authentication</xml>
From this example request:
$ gmcs request.cs && mono request.exe
STATUS = OK
CONTENT = [[<xml>Hello user 'the xml user', you made it past authentication</xml>]]
Which yields these accesslog entries:
5.9.157.150 - - [12/Feb/2013:00:02:11 +0000] "GET / HTTP/1.1" 401 22 "-" "-"
(the xml user, some pass word)
5.9.157.150 - the xml user [12/Feb/2013:00:02:11 +0000] "GET / HTTP/1.0" 200 69 "-" "-"