System.Net.Security.NegotiateStream.BeginAuthenticateAsClient C# (CSharp) Метод

BeginAuthenticateAsClient() публичный Метод

public BeginAuthenticateAsClient ( NetworkCredential credential, ChannelBinding binding, string targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel, AsyncCallback asyncCallback, object asyncState ) : IAsyncResult
credential NetworkCredential
binding System.Security.Authentication.ExtendedProtection.ChannelBinding
targetName string
requiredProtectionLevel ProtectionLevel
allowedImpersonationLevel TokenImpersonationLevel
asyncCallback AsyncCallback
asyncState object
Результат IAsyncResult
        public virtual IAsyncResult BeginAuthenticateAsClient(
            NetworkCredential credential,
            ChannelBinding binding,
            string targetName,
            ProtectionLevel requiredProtectionLevel,
            TokenImpersonationLevel allowedImpersonationLevel,
            AsyncCallback asyncCallback,
            object asyncState)
        {
#if DEBUG
            using (DebugThreadTracking.SetThreadKind(ThreadKinds.User | ThreadKinds.Async))
            {
#endif
                _negoState.ValidateCreateContext(_package, false, credential, targetName, binding, requiredProtectionLevel, allowedImpersonationLevel);

                LazyAsyncResult result = new LazyAsyncResult(_negoState, asyncState, asyncCallback);
                _negoState.ProcessAuthentication(result);

                return result;
#if DEBUG
            }
#endif
        }

Same methods

NegotiateStream::BeginAuthenticateAsClient ( AsyncCallback asyncCallback, object asyncState ) : IAsyncResult
NegotiateStream::BeginAuthenticateAsClient ( NetworkCredential credential, ChannelBinding binding, string targetName, AsyncCallback asyncCallback, object asyncState ) : IAsyncResult
NegotiateStream::BeginAuthenticateAsClient ( NetworkCredential credential, string targetName, AsyncCallback asyncCallback, object asyncState ) : IAsyncResult
NegotiateStream::BeginAuthenticateAsClient ( NetworkCredential credential, string targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel, AsyncCallback asyncCallback, object asyncState ) : IAsyncResult
NegotiateStream::BeginAuthenticateAsClient ( System credential, System binding, string targetName, System requiredProtectionLevel, System allowedImpersonationLevel, System asyncCallback, object asyncState ) : System.IAsyncResult
NegotiateStream::BeginAuthenticateAsClient ( System credential, System binding, string targetName, System asyncCallback, object asyncState ) : System.IAsyncResult
NegotiateStream::BeginAuthenticateAsClient ( System asyncCallback, object asyncState ) : System.IAsyncResult
NegotiateStream::BeginAuthenticateAsClient ( System credential, string targetName, System requiredProtectionLevel, System allowedImpersonationLevel, System asyncCallback, object asyncState ) : System.IAsyncResult
NegotiateStream::BeginAuthenticateAsClient ( System credential, string targetName, System asyncCallback, object asyncState ) : System.IAsyncResult

Usage Example

Пример #1
0
        private void AuthCallback(IAsyncResult ar)
        {
            try
            {
                NegotiateStream nsCb = (NegotiateStream)ar.AsyncState;
                nsCb.EndAuthenticateAsClient(ar);
                nsCb.BeginRead(buffer, 0, buffer.Length, ReceiveCallback, nsCb);
                authenticated = true;
            }
            catch (Exception e)
            {
                authenticated = false;
                Console.WriteLine(e.Message);

                Console.WriteLine("Введите логин:");
                login = Console.ReadLine();
                while (login.Length == 0)
                {
                    Console.WriteLine("Введите логин:");
                    login = Console.ReadLine();
                }
                Console.WriteLine("Введите пароль:");
                password = Console.ReadLine();
                nws = new NetworkStream(socket);
                ns = new NegotiateStream(nws, true);
                netCred = new NetworkCredential(login, password);
                ns.BeginAuthenticateAsClient(netCred, String.Empty, ProtectionLevel.EncryptAndSign, TokenImpersonationLevel.Delegation, AuthCallback, ns);
            }
        }
All Usage Examples Of System.Net.Security.NegotiateStream::BeginAuthenticateAsClient