本文整理汇总了C#中Application.Authenticate方法的典型用法代码示例。如果您正苦于以下问题:C# Application.Authenticate方法的具体用法?C# Application.Authenticate怎么用?C# Application.Authenticate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application.Authenticate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestDomainAdminAccessOtherDomain
public void TestDomainAdminAccessOtherDomain()
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
account.AdminLevel = eAdminLevel.hAdminLevelDomainAdmin;
account.Save();
SingletonProvider<TestSetup>.Instance.AddDomain("example.com");
var newApplication = new Application();
newApplication.Authenticate("[email protected]", "test");
Assert.AreEqual(1, newApplication.Domains.Count);
Domains domains = SingletonProvider<TestSetup>.Instance.GetApp().Domains;
Assert.AreEqual(2, domains.Count);
try
{
Domain secondDomain = newApplication.Domains.get_ItemByName("example.com");
Assert.Fail("Was able to access other domain.");
}
catch (COMException ex)
{
Assert.IsTrue(ex.Message.Contains("Invalid index."));
}
}
示例2: TestDomainAdminAccessBackupManager
public void TestDomainAdminAccessBackupManager()
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
account.AdminLevel = eAdminLevel.hAdminLevelDomainAdmin;
account.Save();
var newApplication = new Application();
newApplication.Authenticate("[email protected]", "test");
BackupManager backupManager = newApplication.BackupManager;
}
示例3: TestDomainAdminAccessDatabase
public void TestDomainAdminAccessDatabase()
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
account.AdminLevel = eAdminLevel.hAdminLevelDomainAdmin;
account.Save();
var newApplication = new Application();
newApplication.Authenticate("[email protected]", "test");
Database database = newApplication.Database;
database.ExecuteSQL("select");
}
示例4: NormalUserShouldNotBeAbleToAddDomain
public void NormalUserShouldNotBeAbleToAddDomain()
{
Domain domain = SingletonProvider<TestSetup>.Instance.AddTestDomain();
// Create an account with normal privileges.
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(domain, "[email protected]", "test");
var newApp = new Application();
Account authenticated = newApp.Authenticate(account.Address, "test");
Assert.IsNotNull(authenticated);
// This should throw an exception.
Domain newDomain = newApp.Domains.Add();
}
示例5: BlowfishEncryptShouldNotRequireAdminPrivileges
public void BlowfishEncryptShouldNotRequireAdminPrivileges()
{
Application app = SingletonProvider<TestSetup>.Instance.GetApp();
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
var newApp = new Application();
CustomAssert.IsNotNull(newApp.Authenticate(account.Address, "test"));
Utilities utilities = newApp.Utilities;
string encryptedResult = utilities.BlowfishEncrypt("Test");
CustomAssert.AreNotEqual("Test", encryptedResult, encryptedResult);
string decrypted = utilities.BlowfishDecrypt(encryptedResult);
CustomAssert.AreEqual("Test", decrypted, decrypted);
}
示例6: DomainAdminShouldBeAbleToSaveDomain
public void DomainAdminShouldBeAbleToSaveDomain()
{
Domain domain = SingletonProvider<TestSetup>.Instance.AddTestDomain();
// Create an account with normal privileges.
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(domain, "[email protected]", "test");
account.AdminLevel = eAdminLevel.hAdminLevelDomainAdmin;
account.Save();
var newApp = new Application();
Account authenticated = newApp.Authenticate(account.Address, "test");
Assert.IsNotNull(authenticated);
Assert.AreEqual(1, newApp.Domains.Count);
// Retrieve our domain.
Domain newDomain = newApp.Domains[0];
newDomain.Save();
}
示例7: Authenticate
public void Authenticate()
{
application = new Application();
Account account = application.Authenticate("Administrator", "testar");
if (account == null)
account = application.Authenticate("Administrator", "");
if (account == null)
Assert.Fail("hMailServer API authentication failed");
_settings = application.Settings;
}
示例8: TestDomainAdminAccessSettings
public void TestDomainAdminAccessSettings()
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
account.AdminLevel = eAdminLevel.hAdminLevelDomainAdmin;
account.Save();
var newApplication = new Application();
newApplication.Authenticate("[email protected]", "test");
Settings settings = newApplication.Settings;
}
示例9: TestNormalUserAccessOtherAccount
public void TestNormalUserAccessOtherAccount()
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
account.AdminLevel = eAdminLevel.hAdminLevelNormal;
account.Save();
Account secondAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
secondAccount.AdminLevel = eAdminLevel.hAdminLevelNormal;
secondAccount.Save();
var newApplication = new Application();
newApplication.Authenticate("[email protected]", "test");
Assert.AreEqual(1, newApplication.Domains.Count);
Assert.AreEqual(1, newApplication.Domains[0].Accounts.Count);
Account myAccount = newApplication.Domains[0].Accounts.get_ItemByAddress("[email protected]");
try
{
Account otherAccount = newApplication.Domains[0].Accounts.get_ItemByAddress("[email protected]");
Assert.Fail();
}
catch (COMException ex)
{
Assert.IsTrue(ex.Message.Contains("Invalid index."));
}
Domains domains = SingletonProvider<TestSetup>.Instance.GetApp().Domains;
Assert.AreEqual(2, domains[0].Accounts.Count);
}