public override ReadOnlyCollection <IAuthorizationPolicy> Authenticate(ReadOnlyCollection <IAuthorizationPolicy> authPolicy, Uri listenUri, ref Message message)
        {
            var session = CredentialHelper.GetSessionData(message);

            CheckCredentials(session);
            var        identity = new CentralUserIdentity(session);
            IPrincipal user     = new CentralPrincipal(identity);

            message.Properties["Principal"] = user;
            return(authPolicy);
        }
 /// <summary>
 /// Called after an inbound message has been received but before the message is dispatched to the intended operation.
 /// </summary>
 /// <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>
 /// <param name="request">The request message.</param><param name="channel">The incoming channel.</param><param name="instanceContext">The current service instance.</param>
 public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
 {
     CentralSessionDataContext.Current.RequestSession = CredentialHelper.GetSessionData(request);
     return(true);
 }