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


C# Authenticator.Authenticate方法代码示例

本文整理汇总了C#中Authenticator.Authenticate方法的典型用法代码示例。如果您正苦于以下问题:C# Authenticator.Authenticate方法的具体用法?C# Authenticator.Authenticate怎么用?C# Authenticator.Authenticate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Authenticator的用法示例。


在下文中一共展示了Authenticator.Authenticate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Setup

 public void Setup()
 {
     var driveAuthenticator = new Authenticator();
     driveAuthenticator.Authenticate("test");
     this.googleDriveServiceProvider = new GoogleDriveServiceProvider(driveAuthenticator);
     this.testee = new FileDownloader(this.googleDriveServiceProvider);
 }
开发者ID:andrinbuerli,项目名称:webdrivemanager,代码行数:7,代码来源:DriveFileDownloaderTest.cs

示例2: Setup

 public void Setup()
 {
     var authenticator = new Authenticator();
     authenticator.Authenticate("test");
     var serviceProvider = new GoogleDriveServiceProvider(authenticator);
     this.testee = new FolderSynchronizer(new FilesGetter(serviceProvider), new FileDownloader(serviceProvider));
 }
开发者ID:andrinbuerli,项目名称:webdrivemanager,代码行数:7,代码来源:FolderSynchronizerTest.cs

示例3: Authenticate_WhereDownstreamResultEmpty_ReturnsFalse

        public async Task Authenticate_WhereDownstreamResultEmpty_ReturnsFalse()
        {
            // arrange
            var proxy = new AuthenticatorProxyWithResult("");
            authenticator = new Authenticator(proxy);

            // act
            var result = await authenticator.Authenticate("url");

            Assert.IsFalse(result.IsSuccess);
        }
开发者ID:shiftkey,项目名称:AppDotNet-Win8,代码行数:11,代码来源:AuthenticatorTests.cs

示例4: Authenticate_WhereDownstreamResultOccurs_ReturnsSuccess

        public async Task Authenticate_WhereDownstreamResultOccurs_ReturnsSuccess()
        {
            // arrange
            var proxy = new AuthenticatorProxyWithResult("foo");
            authenticator = new Authenticator(proxy);

            // act
            var result = await authenticator.Authenticate("url");

            Assert.IsTrue(result.IsSuccess);
        }
开发者ID:shiftkey,项目名称:AppDotNet-Win8,代码行数:11,代码来源:AuthenticatorTests.cs

示例5: Synchronize_WhenFolderIsSynchronize_ThenStructureIsCorrect

        public void Synchronize_WhenFolderIsSynchronize_ThenStructureIsCorrect()
        {
            // Arrange
            var authenticator = new Authenticator();
            authenticator.Authenticate("test");
            var filesGetter = new FilesGetter(new GoogleDriveServiceProvider(authenticator));
            var files = filesGetter.GetDriveFiles(GoogleDriveConstants.FolderMimeType).ToList();

            // Act
            string rootFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\TestGoogle";
            this.testee.SynchronizeFolder(
                files[1],
                rootFolder);

            // Assert
            Directory.Exists(rootFolder).Should().BeTrue();
            Directory.GetDirectories(rootFolder).Length.Should().Be(1);
        }
开发者ID:andrinbuerli,项目名称:webdrivemanager,代码行数:18,代码来源:FolderSynchronizerTest.cs

示例6: Setup

 public void Setup()
 {
     Authenticator driveAuthenticator = new Authenticator();
     driveAuthenticator.Authenticate("test");
     this.testee = new FilesGetter(new GoogleDriveServiceProvider(driveAuthenticator));
 }
开发者ID:andrinbuerli,项目名称:webdrivemanager,代码行数:6,代码来源:DriveFileGetterTest.cs

示例7: InnerRun

		protected override void InnerRun()
		{
            Succeeded = false;
            PendingUserActivation = true;
		    ShouldRetry = true;

            DoxApi api = new DoxApi(_serviceUrl);
		    IDoxSession session = null;

		    if (!string.IsNullOrEmpty(DeviceToken))
		    {
		        session = api.CreateSessionFromDeviceToken(_loginName, DeviceToken, ApiHelper);
                if (session == null && api.Error.IsConnectionError())
                {
                    PendingUserActivation = false;
                    ErrorMessage = Properties.Resources.ConnectionErrorDuringUpload;
                    return;
                }
		    }

		    if (session == null)
		    {
                // show login dialog
                var nativeWindow = new NativeWindow();
                nativeWindow.AssignHandle(IntPtr.Zero);
                _loginUi.NativeWindow = nativeWindow;
                _loginUi.RegisterTabVisible = false;
                _loginUi.LoginFieldEnabled = false;

		        var authenticator = new Authenticator(_loginUi);
                authenticator.Api = api;
		        authenticator.ApiHelper = ApiHelper;
		        bool cancelSend;
                session = authenticator.Authenticate(_loginName, null, out cancelSend);
                if (cancelSend)
                {
                    ShouldRetry = false;
                    PendingUserActivation = false;
                    Logger.LogInfo("User cancelled send");
                    ErrorMessage = "Unable to log in.";
                    return;
                }
		    }

		    if (session == null)
		    {
		        return; // something weird is happening, try again later
		    }

		    DeviceToken = session.Credentials.DeviceToken;
            OptionApi.SetEncrypted("SendLinkDeviceToken", DeviceToken, _entropy);
            OptionApi.SetEncrypted("SendLinkAccountId", session.CurrentUser.AccountId, _entropy);
            OptionApi.SetEncrypted("SendLinkUserId", session.CurrentUser.Id, _entropy);

		    if (session.CurrentUser.IsValidated)
		    {
		        PendingUserActivation = false;
                Succeeded = true;
                ErrorMessage = string.Empty;
		    }
		}
开发者ID:killbug2004,项目名称:WSProf,代码行数:61,代码来源:AuthenticateTask.cs

示例8: Authenticate_WhereDownstreamResultOccurs_ReturnsToken

        public async Task Authenticate_WhereDownstreamResultOccurs_ReturnsToken()
        {
            // arrange
            var proxy = new AuthenticatorProxyWithResult("foo");
            authenticator = new Authenticator(proxy);

            // act
            var result = await authenticator.Authenticate("url");

            Assert.AreEqual("foo", result.AccessToken);
        }
开发者ID:shiftkey,项目名称:AppDotNet-Win8,代码行数:11,代码来源:AuthenticatorTests.cs


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