private void SubNegotiation_UsernamePassword_End(IAsyncResult ar)
        {
            DoAuthentication_SO asyncState = (DoAuthentication_SO)ar.AsyncState;

            try
            {
                asyncState.UpdateContext();
                this.EndSubNegotiation_UsernamePassword(ar);
            }
            catch (Exception exception)
            {
                asyncState.Exception = exception;
            }
            asyncState.SetCompleted();
        }
        private IAsyncResult BeginDoAuthentication(AuthMethod method, AsyncCallback cb, object state)
        {
            DoAuthentication_SO n_so = new DoAuthentication_SO(cb, state);

            if (AuthMethod.UsernamePassword == method)
            {
                this.BeginSubNegotiation_UsernamePassword(new AsyncCallback(this.SubNegotiation_UsernamePassword_End), n_so);
                return(n_so);
            }
            if (AuthMethod.NoAcceptable == method)
            {
                throw new SocketException(0x274d);
            }
            if (method != AuthMethod.None)
            {
                throw new InvalidOperationException("Unknown authentication requested.");
            }
            n_so.SetCompleted();
            return(n_so);
        }
Exemplo n.º 3
0
 IAsyncResult BeginDoAuthentication(AuthMethod method,
     AsyncCallback cb, 
     object state)
 {
     DoAuthentication_SO stateObj = new DoAuthentication_SO(cb, state);
     if(AuthMethod.UsernamePassword == method)
     {
         BeginSubNegotiation_UsernamePassword(
             new AsyncCallback(SubNegotiation_UsernamePassword_End),
             stateObj);
     }
     else if(AuthMethod.NoAcceptable == method)
     {
         //throw new AuthFailedException("No acceptable methods.");
         throw new SocketException(SockErrors.WSAECONNREFUSED);
     }
     else if(AuthMethod.None != method)
     {
         throw new InvalidOperationException("Unknown authentication requested.");
     }
     else
     {
         stateObj.SetCompleted();
     }
     return stateObj;
 }