Example #1
0
 /// <summary>
 /// Constructs factory that will be used only by a service.
 /// </summary>
 /// <remarks>
 /// The constructor takes only callbacks which are used by the service. Therefore if you use this constructor
 /// you can create only duplex input channels.
 /// </remarks>
 /// <param name="underlyingMessagingSystem">underlying messaging upon which the authentication will work.</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.
 /// </param>
 public AuthenticatedMessagingFactory(IMessagingSystemFactory underlyingMessagingSystem,
                                      GetHanshakeMessage getHandshakeMessageCallback,
                                      Authenticate authenticateCallback,
                                      HandleAuthenticationCancelled handleAuthenticationCancelledCallback)
     : this(underlyingMessagingSystem, null, null, getHandshakeMessageCallback, authenticateCallback, handleAuthenticationCancelledCallback)
 {
 }
Example #2
0
        public AuthenticatedDuplexInputChannel(IDuplexInputChannel underlyingInputChannel,
                                               GetHanshakeMessage getHandshakeMessageCallback,
                                               Authenticate verifyHandshakeResponseMessageCallback,
                                               HandleAuthenticationCancelled authenticationCancelledCallback)
        {
            using (EneterTrace.Entering())
            {
                myUnderlayingInputChannel         = underlyingInputChannel;
                myGetHandshakeMessageCallback     = getHandshakeMessageCallback;
                myAuthenticateCallback            = verifyHandshakeResponseMessageCallback;
                myAuthenticationCancelledCallback = authenticationCancelledCallback;

                myUnderlayingInputChannel.ResponseReceiverDisconnected += OnResponseReceiverDisconnected;
                myUnderlayingInputChannel.MessageReceived += OnMessageReceived;
            }
        }
Example #3
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();
            }
        }
Example #4
0
 /// <summary>
 /// Constructs factory that will be used only by a service.
 /// </summary>
 /// <remarks>
 /// The constructor takes only callbacks which are used by the service. Therefore if you use this constructor
 /// you can create only duplex input channels.
 /// </remarks>
 /// <param name="underlyingMessagingSystem">underlying messaging upon which the authentication will work.</param>
 /// <param name="getHandshakeMessageCallback">callback returning the handshake message.</param>
 /// <param name="authenticateCallback">callback performing the authentication.</param>
 public AuthenticatedMessagingFactory(IMessagingSystemFactory underlyingMessagingSystem,
                                      GetHanshakeMessage getHandshakeMessageCallback,
                                      Authenticate authenticateCallback)
     : this(underlyingMessagingSystem, null, null, getHandshakeMessageCallback, authenticateCallback, null)
 {
 }