Files
mono/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/SecurityHandler.cs
T
Atsushi Eno 7bcaf9bbbc 2009-05-13 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs, SecurityHandler.cs,
	  InputOrReplyRequestProcessor.cs, MessageProcessingContext.cs :
	  remove default communication timeouts from several types. They
	  bring bogus NRE. Instead, fill timeouts in ChannelDispatcher and
	  use it when required (it was actually *only* request processor).

	* ChannelDispatcherTest.cs : make sure ctor args are nullable.


svn path=/trunk/mcs/; revision=134044
2009-05-13 10:08:46 +00:00

43 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel.Channels;
using System.ServiceModel;
using System.ServiceModel.Security.Tokens;
namespace System.ServiceModel.Dispatcher
{
internal class SecurityHandler : BaseRequestProcessorHandler
{
protected override bool ProcessRequest (MessageProcessingContext mrc)
{
DispatchRuntime dispatch_runtime = mrc.OperationContext.EndpointDispatcher.DispatchRuntime;
Message negoResponce = null;
// process WS-Trust based negotiation
MessageSecurityBindingSupport support =
dispatch_runtime.ChannelDispatcher.Listener.GetProperty<MessageSecurityBindingSupport> ();
if (support != null && mrc.IncomingMessage.Headers.FindHeader ("Security", Constants.WssNamespace) < 0) {
CommunicationSecurityTokenAuthenticator nego =
support.TokenAuthenticator as CommunicationSecurityTokenAuthenticator;
if (nego != null)
negoResponce = nego.Communication.ProcessNegotiation (mrc.IncomingMessage);
}
if (negoResponce == null)
return false;
ReplyNegoResponse (mrc, negoResponce);
return true;
}
void ReplyNegoResponse (MessageProcessingContext mrc, Message negoResponse)
{
negoResponse.Headers.CopyHeadersFrom (mrc.OperationContext.OutgoingMessageHeaders);
negoResponse.Properties.CopyProperties (mrc.OperationContext.OutgoingMessageProperties);
mrc.RequestContext.Reply (negoResponse, mrc.Operation.Parent.ChannelDispatcher.timeouts.SendTimeout);
return;
}
}
}