private void Normal() { // parser will always merge headers to one line. string test = "Digest username=\"bob\"," + "realm=\"biloxi.com\"," + "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\"," + "uri=\"sip:[email protected]\"," + "qop=auth," + "nc=00000001," + "cnonce=\"0a4f113b\"," + "response=\"6629fae49393a05397450978507c4ef1\"," + "opaque=\"5ccc069c403ebaf9f0171e9517f40e41\""; var header = (Authorization)_parser.Parse("Authorization", new StringReader(test)); Assert.Equal("bob", header.UserName); Assert.Equal("biloxi.com", header.Realm); Assert.Equal("dcd98b7102dd2f0e8b11d0f600bfb0c093", header.Nonce); Assert.Equal("auth", header.Qop); Assert.Equal(1, header.NonceCounter); Assert.Equal("0a4f113b", header.ClientNonce); Assert.Equal("6629fae49393a05397450978507c4ef1", header.Response); Assert.Equal("5ccc069c403ebaf9f0171e9517f40e41", header.Opaque); Assert.Equal("sip", header.Uri.Scheme); Assert.Equal("bob", header.Uri.UserName); Assert.Equal("biloxi.com", header.Uri.Domain); }
public void TestParseAuthHeader() { var authParser = new AuthorizationParser (); var authHeader = "Signature keyId=\"some-key\",algorithm=\"hmac-sha256\",headers=\"date,(request-target)\",signature=\"9MmDJ/7WkGLsBvq9g3/TNhvXgFm5n11j0XqjvF2z9Rc=\""; var auth = authParser.Parse (authHeader); Assert.IsTrue (auth.Algorithm == "hmac-sha256"); Assert.AreEqual (auth.KeyId, "some-key"); }
public void TestParseAuthHeader() { var authParser = new AuthorizationParser(); var authHeader = "Signature keyId=\"some-key\",algorithm=\"hmac-sha256\",headers=\"date,(request-target)\",signature=\"9MmDJ/7WkGLsBvq9g3/TNhvXgFm5n11j0XqjvF2z9Rc=\""; var auth = authParser.Parse(authHeader); Assert.IsTrue(auth.Algorithm == "hmac-sha256"); Assert.AreEqual(auth.KeyId, "some-key"); }