コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Message"></param>
        protected void HandleGetLoginMessage(GetLoginMessage Message)
        {
            // set connection state
            connectionState = ConnectionState.Connected;

            // log
            Logger.Log(MODULENAME, LogType.Info, "ConnectionState: Connected");
        }
コード例 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Message"></param>
 protected override void HandleGetLoginMessage(GetLoginMessage Message)
 {
     // answer with our account credentials
     if (Config.SelectedConnectionInfo != null)
     {
         SendLoginMessage(Config.SelectedConnectionInfo.Username, Config.SelectedConnectionInfo.Password);
     }
 }
コード例 #3
0
        public AuthenticatedDuplexOutputChannel(IDuplexOutputChannel underlyingOutputChannel,
                                                GetLoginMessage getLoginMessageCallback,
                                                GetHandshakeResponseMessage getHandshakeResponseMessageCallback,
                                                TimeSpan authenticationTimeout,
                                                IThreadDispatcher threadDispatcher)
        {
            using (EneterTrace.Entering())
            {
                myUnderlyingOutputChannel             = underlyingOutputChannel;
                myGetLoginMessageCallback             = getLoginMessageCallback;
                myGetHandshakeResponseMessageCallback = getHandshakeResponseMessageCallback;
                myAuthenticationTimeout = authenticationTimeout;

                myUnderlyingOutputChannel.ConnectionClosed        += OnConnectionClosed;
                myUnderlyingOutputChannel.ResponseMessageReceived += OnResponseMessageReceived;

                myThreadDispatcher = threadDispatcher;
            }
        }
コード例 #4
0
        /// <summary>
        /// Constructs factory that can be used by client and service simultaneously.
        /// </summary>
        /// <remarks>
        /// If you construct the factory with this constructor you can create both duplex output channels and
        /// duplex input channels.
        /// </remarks>
        /// <param name="underlyingMessagingSystem">underlying messaging upon which the authentication will work.</param>
        /// <param name="getLoginMessageCallback">callback called by the output channel to get the login message which shall be used to open the connection</param>
        /// <param name="getHandshakeResponseMessageCallback">callback called by the output channel to get the response for the handshake message which was received from the input channel.</param>
        /// <param name="getHandshakeMessageCallback">callback called by the input chanel to get the handshake message for the login message which was received from the output channel.</param>
        /// <param name="authenticateCallback">callback called by the input channe to perform the authentication.</param>
        /// <param name="handleAuthenticationCancelledCallback">callback called by the input channel to indicate the output channel closed the connection during the authentication procedure.
        /// Can be null if your authentication code does not need to handle it.
        /// (E.g. if the authentication logic needs to clean if the authentication fails.)</param>
        public AuthenticatedMessagingFactory(IMessagingSystemFactory underlyingMessagingSystem,
                                             GetLoginMessage getLoginMessageCallback,
                                             GetHandshakeResponseMessage getHandshakeResponseMessageCallback,
                                             GetHanshakeMessage getHandshakeMessageCallback,
                                             Authenticate authenticateCallback,
                                             HandleAuthenticationCancelled handleAuthenticationCancelledCallback)
        {
            using (EneterTrace.Entering())
            {
                myUnderlyingMessaging = underlyingMessagingSystem;
                AuthenticationTimeout = TimeSpan.FromMilliseconds(30000);

                myGetLoginMessageCallback             = getLoginMessageCallback;
                myGetHandShakeMessageCallback         = getHandshakeMessageCallback;
                myGetHandshakeResponseMessageCallback = getHandshakeResponseMessageCallback;
                myAuthenticateCallback          = authenticateCallback;
                myHandleAuthenticationCancelled = handleAuthenticationCancelledCallback;

                OutputChannelThreading = new SyncDispatching();
            }
        }
コード例 #5
0
 /// <summary>
 /// Constructs factory that will be used only by a client.
 /// </summary>
 /// <remarks>
 /// The constructor takes only callbacks which are used by the client. Therefore if you use this constructor
 /// you can create only duplex output channels.
 /// </remarks>
 /// <param name="underlyingMessagingSystem">underlying messaging upon which the authentication will work.</param>
 /// <param name="getLoginMessageCallback">callback called by the output channel to get the login message which shall be used to open the connection</param>
 /// <param name="getHandshakeResponseMessageCallback">callback called by the output channel to get the response for the handshake message which was received from the input channel.</param>
 public AuthenticatedMessagingFactory(IMessagingSystemFactory underlyingMessagingSystem,
                                      GetLoginMessage getLoginMessageCallback,
                                      GetHandshakeResponseMessage getHandshakeResponseMessageCallback)
     : this(underlyingMessagingSystem, getLoginMessageCallback, getHandshakeResponseMessageCallback, null, null, null)
 {
 }
コード例 #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Message"></param>
 protected override void HandleGetLoginMessage(GetLoginMessage Message)
 {
     // answer with our account credentials
     SendLoginMessage(Config.Username, Config.Password);
 }
コード例 #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Message"></param>
 protected override void HandleGetLoginMessage(GetLoginMessage Message)
 {
     SendLoginMessage(ui.txtUsername.Text, ui.txtPassword.Text);
 }
コード例 #8
0
 /// <summary>
 /// Handler for "GetLogin" message, returns account credentials
 /// </summary>
 /// <param name="Message"></param>
 protected override void HandleGetLoginMessage(GetLoginMessage Message)
 {
     SendLoginMessage(MainForm.LoginControl.Username, MainForm.LoginControl.Password);
 }