public void TestBasicAuthenticator() { var username = "******"; var password = "******"; var basicAuth = new BasicAuthenticator(username, password); Assert.IsNull(basicAuth.LoginParametersForSite(null)); Assert.IsFalse(basicAuth.UsesCookieBasedLogin); Assert.AreEqual("dXNlcm5hbWU6cGFzc3dvcmQ=", basicAuth.UserInfo); }
public static IAuthenticator CreateFromUri(Uri uri) { return((IAuthenticator)FacebookAuthorizer.FromUri(uri) ?? (IAuthenticator)PersonaAuthorizer.FromUri(uri) ?? BasicAuthenticator.FromUri(uri)); }
public void TestSecureLogging() { var auth = new BasicAuthenticator("jim", "borden"); var rev = new RevisionInternal("sensitive", "1-abcdef".AsRevID(), false); var lastMessage = default(string); _logCallback = (level, tag, msg) => { lastMessage = msg; }; Log.ScrubSensitivity = LogScrubSensitivity.NoInsecure; Log.To.NoDomain.I(TAG, "{0}", auth); Assert.AreEqual("[BasicAuthenticator (<redacted>:<redacted>)]", lastMessage); Log.To.NoDomain.I(TAG, "{0}", rev); Assert.AreEqual("{<redacted> #1-abcdef}", lastMessage); Log.ScrubSensitivity = LogScrubSensitivity.PotentiallyInsecureOK; Log.To.NoDomain.I(TAG, "{0}", auth); Assert.AreEqual("[BasicAuthenticator (jim:<redacted>)]", lastMessage); Log.To.NoDomain.I(TAG, "{0}", rev); Assert.AreEqual("{sensitive #1-abcdef}", lastMessage); Log.ScrubSensitivity = LogScrubSensitivity.AllOK; Log.To.NoDomain.I(TAG, "{0}", auth); Assert.AreEqual("[BasicAuthenticator (jim:borden)]", lastMessage); }
public void TestBasicAuthenticator() { var username = "******"; var password = "******"; var basicAuth = new BasicAuthenticator(username, password); Assert.IsNull(basicAuth.LoginParametersForSite(null)); Assert.IsTrue(basicAuth.UsesCookieBasedLogin); Assert.AreEqual(basicAuth.UserInfo, username + ":" + password); }
public virtual void TestBasicAuthenticator() { string username = "******"; string password = "******"; BasicAuthenticator basicAuth = new BasicAuthenticator(username, password); NUnit.Framework.Assert.IsNull(basicAuth.LoginParametersForSite(null)); NUnit.Framework.Assert.IsTrue(basicAuth.UsesCookieBasedLogin()); NUnit.Framework.Assert.AreEqual(basicAuth.AuthUserInfo(), username + ":" + password ); }