Exemple #1
0
        public void RadiusServer_Interop()
        {
            Assert.Inconclusive("The trial period for the RADIUS client tool has expired.");

            // Verify that my RADIUS server code can work against a client from
            // another vendor.

            RadiusServer         server         = new RadiusServer();
            RadiusServerSettings serverSettings = new RadiusServerSettings();

            serverSettings.RealmFormat = RealmFormat.Email;
            serverSettings.Devices.Add(new RadiusNasInfo(IPAddress.Loopback, "hello"));
            serverSettings.Devices.Add(new RadiusNasInfo(NetHelper.GetActiveAdapter(), "hello"));

            try
            {
                server.Start(serverSettings);
                server.LoadAccountsFromString(@"

    // This is a comment line

    r1;jeff;password123
    r2;jeff;passwordXXX
    r1;jane;bigfish
    ");

                Assert.IsTrue(RadiusTestClient.Authenticate(server.EndPoint, "hello", "jeff@r1", "password123"));
                Assert.IsTrue(RadiusTestClient.Authenticate(server.EndPoint, "hello", "jeff@r2", "passwordXXX"));
                Assert.IsTrue(RadiusTestClient.Authenticate(server.EndPoint, "hello", "jane@r1", "bigfish"));

                Assert.IsFalse(RadiusTestClient.Authenticate(server.EndPoint, "hello", "jeff@r1", "PASSWORD123"));
                Assert.IsFalse(RadiusTestClient.Authenticate(server.EndPoint, "hello", "jeff", "password123"));
                Assert.IsFalse(RadiusTestClient.Authenticate(server.EndPoint, "hello", "jeff@r3", "password123"));
                Assert.IsFalse(RadiusTestClient.Authenticate(server.EndPoint, "badsecret", "jeff@r1", "password123"));
            }
            finally
            {
                server.Stop();
            }
        }
Exemple #2
0
        public void RadiusServer_RadiusTestApps()
        {
            Assert.Inconclusive("The trial period for the RADIUS client tool has expired.");

            // Verify that the RadiusServerTest and RadiusClientTest classes
            // work properly against each other.

            RadiusTestServer               server = null;
            Dictionary <string, string>    users;
            Dictionary <IPAddress, string> devices;

            users = new Dictionary <string, string>();
            users.Add("jeff", "password1");
            users.Add("joe", "password2");

            devices = new Dictionary <IPAddress, string>();
            devices.Add(IPAddress.Loopback, "secret");
            devices.Add(NetHelper.GetActiveAdapter(), "secret");

            server = new RadiusTestServer();
            server.Start(users, devices);

            try
            {
                Assert.IsTrue(RadiusTestClient.Authenticate(server.EndPoint, "secret", "jeff", "password1"));
                Assert.IsTrue(RadiusTestClient.Authenticate(server.EndPoint, "secret", "joe", "password2"));

                Assert.IsFalse(RadiusTestClient.Authenticate(server.EndPoint, "secret", "jeff", "passwordX"));
                Assert.IsFalse(RadiusTestClient.Authenticate(server.EndPoint, "secret", "billy", "x"));
                Assert.IsFalse(RadiusTestClient.Authenticate(server.EndPoint, "xxxx", "jeff", "password1"));
            }
            finally
            {
                server.Stop();
            }
        }