2010-06-03 Jb Evain <jbevain@novell.com>
[mcs.git] / class / System.ServiceModel / System.ServiceModel.Security.Tokens / ServiceModelSecurityTokenRequirement.cs
blobf02fbee41c171e797cf6c840e995ff0f86374c0d
1 //
2 // ServiceModelSecurityTokenRequirement.cs
3 //
4 // Author:
5 // Atsushi Enomoto <atsushi@ximian.com>
6 //
7 // Copyright (C) 2006 Novell, Inc. http://www.novell.com
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 using System.Collections.Generic;
29 using System.IdentityModel.Selectors;
30 using System.IdentityModel.Tokens;
31 using System.ServiceModel.Channels;
32 using System.ServiceModel.Security;
33 using System.Text;
35 namespace System.ServiceModel.Security.Tokens
37 public abstract class ServiceModelSecurityTokenRequirement :
38 SecurityTokenRequirement
40 protected ServiceModelSecurityTokenRequirement ()
44 protected const string Namespace = "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement";
46 public static string AuditLogLocationProperty {
47 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/AuditLogLocation"; }
50 public static string ChannelParametersCollectionProperty {
51 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/ChannelParametersCollection"; }
54 public static string DuplexClientLocalAddressProperty {
55 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/DuplexClientLocalAddress"; }
58 public static string EndpointFilterTableProperty {
59 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/EndpointFilterTable"; }
62 public static string HttpAuthenticationSchemeProperty {
63 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/HttpAuthenticationScheme"; }
66 public static string IsInitiatorProperty {
67 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/IsInitiator"; }
70 public static string IsOutOfBandTokenProperty {
71 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/IsOutOfBandToken"; }
74 public static string IssuedSecurityTokenParametersProperty {
75 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/IssuedSecurityTokenParameters"; }
78 public static string IssuerAddressProperty {
79 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/IssuerAddress"; }
82 public static string IssuerBindingContextProperty {
83 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/IssuerBindingContext"; }
86 public static string IssuerBindingProperty {
87 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/IssuerBinding"; }
90 public static string ListenUriProperty {
91 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/ListenUri"; }
94 public static string MessageAuthenticationAuditLevelProperty {
95 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/MessageAuthenticationAuditLevel"; }
98 public static string MessageDirectionProperty {
99 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/MessageDirection"; }
102 public static string MessageSecurityVersionProperty {
103 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/MessageSecurityVersion"; }
106 public static string PrivacyNoticeUriProperty {
107 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/PrivacyNoticeUri"; }
110 public static string PrivacyNoticeVersionProperty {
111 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/PrivacyNoticeVersion"; }
114 public static string SecureConversationSecurityBindingElementProperty {
115 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/SecureConversationSecurityBindingElement"; }
118 public static string SecurityAlgorithmSuiteProperty {
119 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/SecurityAlgorithmSuite"; }
122 public static string SecurityBindingElementProperty {
123 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/SecurityBindingElement"; }
126 public static string SupportingTokenAttachmentModeProperty {
127 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/SupportingTokenAttachmentMode"; }
130 public static string SupportSecurityContextCancellationProperty {
131 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/SupportSecurityContextCancellation"; }
134 public static string SuppressAuditFailureProperty {
135 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/SuppressAuditFailure"; }
138 public static string TargetAddressProperty {
139 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/TargetAddress"; }
142 public static string TransportSchemeProperty {
143 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/TransportScheme"; }
146 public static string ViaProperty {
147 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/Via"; }
150 public bool IsInitiator {
151 get {
152 bool ret;
153 if (TryGetProperty<bool> (IsInitiatorProperty, out ret))
154 return ret;
155 return false;
159 public EndpointAddress IssuerAddress {
160 get {
161 EndpointAddress ret;
162 TryGetProperty<EndpointAddress> (IssuerAddressProperty, out ret);
163 return ret;
165 set { Properties [IssuerAddressProperty] = value; }
168 public Binding IssuerBinding {
169 get {
170 Binding ret;
171 TryGetProperty<Binding> (IssuerBindingProperty, out ret);
172 return ret;
174 set { Properties [IssuerBindingProperty] = value; }
177 public SecurityTokenVersion MessageSecurityVersion {
178 get {
179 SecurityTokenVersion ret;
180 TryGetProperty<SecurityTokenVersion> (MessageSecurityVersionProperty, out ret);
181 return ret;
183 set { Properties [MessageSecurityVersionProperty] = value; }
186 public SecurityBindingElement SecureConversationSecurityBindingElement {
187 get {
188 SecurityBindingElement ret;
189 TryGetProperty<SecurityBindingElement> (SecureConversationSecurityBindingElementProperty, out ret);
190 return ret;
192 set { Properties [SecureConversationSecurityBindingElementProperty] = value; }
195 public SecurityAlgorithmSuite SecurityAlgorithmSuite {
196 get {
197 SecurityAlgorithmSuite ret;
198 TryGetProperty<SecurityAlgorithmSuite> (SecurityAlgorithmSuiteProperty, out ret);
199 return ret;
201 set { Properties [SecurityAlgorithmSuiteProperty] = value; }
204 public SecurityBindingElement SecurityBindingElement {
205 get {
206 SecurityBindingElement ret;
207 TryGetProperty<SecurityBindingElement> (SecurityBindingElementProperty, out ret);
208 return ret;
210 set { Properties [SecurityBindingElementProperty] = value; }
213 public string TransportScheme {
214 get {
215 string ret;
216 TryGetProperty<string> (TransportSchemeProperty, out ret);
217 return ret;
219 set { Properties [TransportSchemeProperty] = value; }
222 internal string Dump ()
224 StringBuilder sb = new StringBuilder ();
225 sb.Append (GetType ()).Append (":");
226 foreach (KeyValuePair<string, object> p in Properties)
227 sb.Append ("\n------------\n")
228 .Append ("URI: ")
229 .Append (p.Key)
230 .Append ("\nValue: ")
231 .Append (p.Value);
232 return sb.ToString ();