Пример #1
0
 public async Task EndSession()
 {
     if (authenticator == null)
     {
         InitAuthenticator();
     }
     await authenticator.SignOutAsync();
 }
Пример #2
0
        /// <summary>
        /// Disconnects from the OneNote API, and deletes all cached keys from the credential vault.
        /// </summary>
        /// <returns></returns>
        public async Task Logout()
        {
            _settingsService.OneNotePageId = null;
            await _msaAuthProvider.SignOutAsync();

            ConnectedStatus = false;
            _initialized    = false;
        }
Пример #3
0
        private async void ConnectOneDriveServer()
        {
            //이미 연결중이면 수행하지 않음.
            if (IsConnecting)
            {
                return;
            }

            //현재 연결이 되어 있다면 연결 해제
            await DisconnectOneDriveServer(false);

            //연결중...
            IsConnecting     = true;
            ShowErrorMessage = false;

            var    resource      = ResourceLoader.GetForCurrentView();
            string errMsg        = resource.GetString("Message/Error/FailServerAuthentication"); //"인증에 실패하였습니다. 아이디/패스워드를 확인하세요. ";
            var    isOrderByName = _Sort == SortType.Name || _Sort == SortType.NameDescending;

            Task authTask = null;

            var msaAuthProvider = new MsaAuthenticationProvider(
                this.oneDriveConsumerClientId,
                this.oneDriveConsumerReturnUrl,
                this.scopes,
                new CredentialVault(this.oneDriveConsumerClientId));

            await msaAuthProvider.SignOutAsync();

            authTask = msaAuthProvider.RestoreMostRecentFromCacheOrAuthenticateUserAsync();

            OneDriveClient = new OneDriveClient(this.oneDriveConsumerBaseUrl, msaAuthProvider);
            AuthProvider   = msaAuthProvider;

            try
            {
                await authTask;

                //서버타입 설정
                ConnectedServerType = ServerTypes.OneDrive;

                await LoadOneDriveFoldersAsync();

                //인증 성공
                IsConnecting   = false;
                IsDisconnected = false;
            }
            catch (ServiceException exception)
            {
                // Swallow the auth exception but write message for debugging.
                Debug.WriteLine(exception.Error.Message);

                pathStack.Clear();
                IsConnecting   = false;
                IsDisconnected = true;
                ShowOrderBy    = false;
            }
        }
        /// <summary>
        /// Signs user out of OneDrive.
        /// </summary>
        public async Task SignOutAsync()
        {
            try
            {
                await authProvider.SignOutAsync();

                drive = null;
            }
            finally
            {
                oneDriveClient = null;
            }
        }
Пример #5
0
        public async Task Logout()
        {
            try
            {
                if (_msaAuthenticationProvider.IsAuthenticated)
                {
                    await _msaAuthenticationProvider.SignOutAsync();

                    IsAuthenticated = false;
                }
            }
            catch { }
        }