当前位置: 首页>>代码示例>>C#>>正文


C# Application.Authenticate方法代码示例

本文整理汇总了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."));
             }
        }
开发者ID:SpivEgin,项目名称:hmailserver,代码行数:25,代码来源:Security.cs

示例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;
        }
开发者ID:SpivEgin,项目名称:hmailserver,代码行数:10,代码来源:Security.cs

示例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");
        }
开发者ID:SpivEgin,项目名称:hmailserver,代码行数:11,代码来源:Security.cs

示例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();
        }
开发者ID:SpivEgin,项目名称:hmailserver,代码行数:14,代码来源:Permissions.cs

示例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);
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:17,代码来源:Basics.cs

示例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();
        }
开发者ID:SpivEgin,项目名称:hmailserver,代码行数:19,代码来源:Permissions.cs

示例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;
        }
开发者ID:hmailserver,项目名称:hmailserver,代码行数:14,代码来源:TestSetup.cs

示例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;
        }
开发者ID:SpivEgin,项目名称:hmailserver,代码行数:10,代码来源:Security.cs

示例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);
        }
开发者ID:SpivEgin,项目名称:hmailserver,代码行数:31,代码来源:Security.cs


注:本文中的Application.Authenticate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。