/// <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"); }
/// <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); } }
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; } }
/// <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(); } }
/// <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) { }
/// <summary> /// /// </summary> /// <param name="Message"></param> protected override void HandleGetLoginMessage(GetLoginMessage Message) { // answer with our account credentials SendLoginMessage(Config.Username, Config.Password); }
/// <summary> /// /// </summary> /// <param name="Message"></param> protected override void HandleGetLoginMessage(GetLoginMessage Message) { SendLoginMessage(ui.txtUsername.Text, ui.txtPassword.Text); }
/// <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); }