/// <summary>
        /// Called after an inbound message has been received but before the message is dispatched to the intended operation.
        /// </summary>
        /// <param name="request">The request message.</param>
        /// <param name="channel">The incoming channel.</param>
        /// <param name="instanceContext">The current service instance.</param>
        /// <returns>
        /// The object used to correlate state. This object is passed back in the <see cref="M:System.ServiceModel.Dispatcher.IDispatchMessageInspector.BeforeSendReply(System.ServiceModel.Channels.Message@,System.Object)"/> method.
        /// </returns>
        public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
        {
            var ctxt = MessageInspectorHelper.DecodeWulkaContext(ref request);

            if (channel != null)
            {
                var listenUri = channel.LocalAddress.ToString().ToLower();
                if (listenUri.Contains("/mex"))
                {
                    return(null);
                }
                //_logger.Debug("Received message on {0}", listenUri);
            }
            if (IsValidatedSession(ctxt))
            {
                var usr  = ctxt[WulkaContextKey.UserName];
                var sess = ctxt[WulkaContextKey.SessionId];
                var app  = ctxt[WulkaContextKey.ServiceCode];
                if (!CheckSession(usr, sess))
                {
                    _logger.Info("User {0} could not be validated against session {1}", usr, sess);
                }
            }
            WulkaContext.Current = ctxt;
            return(null);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Enables inspection or modification of a message after a reply message is received but prior to passing it back to the client application.
 /// </summary>
 /// <param name="reply">The message to be transformed into types and handed back to the client application.</param>
 /// <param name="correlationState">Correlation state data.</param>
 public void AfterReceiveReply(ref Message reply, object correlationState)
 {
     WulkaContext.Current = MessageInspectorHelper.DecodeWulkaContext(ref reply);
 }