Esempio n. 1
0
        public void MissingAuth_Fails()
        {
            var request = HttpTestUtils.CreateHttpListenerRequest();
            var auth    = new TestRpcServerBasicAuth();
            var result  = auth.Authenticate(request);

            Assert.IsNull(result.ClientID);
            Assert.IsFalse(result.Success);
        }
Esempio n. 2
0
        public void CorrectAuth_Succeeds()
        {
            var request = HttpTestUtils.CreateHttpListenerRequest(client =>
                                                                  client.DefaultRequestHeaders.Add("Authorization", "Basic b3R0bzpPVFRP")); // otto:OTTO
            var auth   = new TestRpcServerBasicAuth();
            var result = auth.Authenticate(request);

            Assert.AreEqual("otto", result.ClientID);
            Assert.IsTrue(result.Success);
        }
Esempio n. 3
0
        public void WrongAuth_Fails()
        {
            var request = HttpTestUtils.CreateHttpListenerRequest(client =>
                                                                  client.DefaultRequestHeaders.Add("Authorization", "Basic b3R0bzpoYW5z")); // otto:hans
            var auth   = new TestRpcServerBasicAuth();
            var result = auth.Authenticate(request);

            Assert.AreEqual("otto", result.ClientID);
            Assert.IsFalse(result.Success);
        }