Example #1
0
        /// <summary>
        /// Authenticate now (instead of waiting for a request to fail)
        /// </summary>
        public async Task Authenticate()
        {
            if (EnableLogging)
            {
                m_Logger.Write(LogMessageSeverity.Verbose, LogCategory, "Attempting to authenticate communication channel", null);
            }
            IWebAuthenticationProvider authenticationProvider;

            lock (m_Lock)
            {
                authenticationProvider = m_AuthenticationProvider;
                System.Threading.Monitor.PulseAll(m_Lock);
            }

            if (authenticationProvider == null)
            {
                if (EnableLogging)
                {
                    m_Logger.Write(LogMessageSeverity.Verbose, LogCategory, "Unable to authenticate communication channel", "There is no authentication provider available to process the current authentication request.");
                }
                return; //nothing to do.
            }

            EnsureConnectionInitialized();

            await m_AuthenticationProvider.Login(this, m_Connection).ConfigureAwait(false);
        }