**** Merged from MCS ****
[mono-project.git] / mcs / class / Microsoft.Web.Services / Microsoft.Web.Services.Security / SecurityOutputFilter.cs
blob99b6aeeaaeb7912893497214a59a74792a3b9358
1 //
2 // SecurityOutputFilter.cs: Security SOAP Output Filter
3 //
4 // Author:
5 // Sebastien Pouliot (spouliot@motus.com)
6 //
7 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
8 //
10 using System;
11 using System.Xml;
12 #if WSE2
13 using Microsoft.Web.Services.Xml;
14 #endif
16 namespace Microsoft.Web.Services.Security {
18 public class SecurityOutputFilter : SoapOutputFilter {
20 public SecurityOutputFilter () {}
22 public override void ProcessMessage (SoapEnvelope envelope)
24 if (envelope == null)
25 throw new ArgumentNullException ("envelope");
27 if ((envelope.Context.Security.Tokens.Count > 0) || (envelope.Context.Security.Elements.Count > 0)) {
28 XmlElement security = envelope.Context.Security.GetXml (envelope);
29 envelope.Header.AppendChild (security);
32 if (envelope.Context.ExtendedSecurity.Count > 0) {
33 foreach (Security s in envelope.Context.ExtendedSecurity) {
34 envelope.Header.AppendChild (s.GetXml (envelope));