當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。