public void RadiusClient_Interop() { if (EnvironmentVars.Get("LT_TESTBIN") == null) { Assert.Inconclusive("[LT_TESTBIN] environment variable does not exist."); } // Verify that my RADIUS client code can work against a server from // another vendor. RadiusTestServer server = new RadiusTestServer(); Dictionary <string, string> users; Dictionary <IPAddress, string> devices; RadiusClient client = new RadiusClient(); RadiusClientSettings clientSettings = new RadiusClientSettings(Local_AAA, "secret"); clientSettings.RealmFormat = RealmFormat.Email; clientSettings.PortCount = 1; 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"); try { server.Start(users, devices); client.Open(clientSettings); Assert.IsTrue(client.Authenticate("", "jeff", "password1")); Assert.IsTrue(client.Authenticate("", "joe", "password2")); Assert.IsFalse(client.Authenticate("", "jeff", "passwordX")); Assert.IsFalse(client.Authenticate("", "billy", "x")); } finally { client.Close(); server.Stop(); } }
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(); } }