2 // ServiceModelSecurityTokenRequirement.cs
5 // Atsushi Enomoto <atsushi@ximian.com>
7 // Copyright (C) 2006 Novell, Inc. http://www.novell.com
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:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
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;
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 ExtendedProtectionPolicy {
63 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/ExtendedProtectionPolicy"; }
66 public static string HttpAuthenticationSchemeProperty {
67 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/HttpAuthenticationScheme"; }
70 public static string IsInitiatorProperty {
71 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/IsInitiator"; }
74 public static string IsOutOfBandTokenProperty {
75 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/IsOutOfBandToken"; }
78 public static string IssuedSecurityTokenParametersProperty {
79 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/IssuedSecurityTokenParameters"; }
82 public static string IssuerAddressProperty {
83 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/IssuerAddress"; }
86 public static string IssuerBindingContextProperty {
87 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/IssuerBindingContext"; }
90 public static string IssuerBindingProperty {
91 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/IssuerBinding"; }
94 public static string ListenUriProperty {
95 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/ListenUri"; }
98 public static string MessageAuthenticationAuditLevelProperty {
99 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/MessageAuthenticationAuditLevel"; }
102 public static string MessageDirectionProperty {
103 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/MessageDirection"; }
106 public static string MessageSecurityVersionProperty {
107 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/MessageSecurityVersion"; }
110 public static string PrivacyNoticeUriProperty {
111 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/PrivacyNoticeUri"; }
114 public static string PrivacyNoticeVersionProperty {
115 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/PrivacyNoticeVersion"; }
118 public static string SecureConversationSecurityBindingElementProperty {
119 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/SecureConversationSecurityBindingElement"; }
122 public static string SecurityAlgorithmSuiteProperty {
123 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/SecurityAlgorithmSuite"; }
126 public static string SecurityBindingElementProperty {
127 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/SecurityBindingElement"; }
130 public static string SupportingTokenAttachmentModeProperty {
131 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/SupportingTokenAttachmentMode"; }
134 public static string SupportSecurityContextCancellationProperty {
135 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/SupportSecurityContextCancellation"; }
138 public static string SuppressAuditFailureProperty {
139 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/SuppressAuditFailure"; }
142 public static string TargetAddressProperty {
143 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/TargetAddress"; }
146 public static string TransportSchemeProperty {
147 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/TransportScheme"; }
150 public static string ViaProperty {
151 get { return "http://schemas.microsoft.com/ws/2006/05/servicemodel/securitytokenrequirement/Via"; }
154 public bool IsInitiator {
157 if (TryGetProperty<bool> (IsInitiatorProperty, out ret))
163 public EndpointAddress IssuerAddress {
166 TryGetProperty<EndpointAddress> (IssuerAddressProperty, out ret);
169 set { Properties [IssuerAddressProperty] = value; }
172 public Binding IssuerBinding {
175 TryGetProperty<Binding> (IssuerBindingProperty, out ret);
178 set { Properties [IssuerBindingProperty] = value; }
181 public SecurityTokenVersion MessageSecurityVersion {
183 SecurityTokenVersion ret;
184 TryGetProperty<SecurityTokenVersion> (MessageSecurityVersionProperty, out ret);
187 set { Properties [MessageSecurityVersionProperty] = value; }
190 public SecurityBindingElement SecureConversationSecurityBindingElement {
192 SecurityBindingElement ret;
193 TryGetProperty<SecurityBindingElement> (SecureConversationSecurityBindingElementProperty, out ret);
196 set { Properties [SecureConversationSecurityBindingElementProperty] = value; }
199 public SecurityAlgorithmSuite SecurityAlgorithmSuite {
201 SecurityAlgorithmSuite ret;
202 TryGetProperty<SecurityAlgorithmSuite> (SecurityAlgorithmSuiteProperty, out ret);
205 set { Properties [SecurityAlgorithmSuiteProperty] = value; }
208 public SecurityBindingElement SecurityBindingElement {
210 SecurityBindingElement ret;
211 TryGetProperty<SecurityBindingElement> (SecurityBindingElementProperty, out ret);
214 set { Properties [SecurityBindingElementProperty] = value; }
217 public string TransportScheme {
220 TryGetProperty<string> (TransportSchemeProperty, out ret);
223 set { Properties [TransportSchemeProperty] = value; }
226 internal string Dump ()
228 StringBuilder sb = new StringBuilder ();
229 sb.Append (GetType ()).Append (":");
230 foreach (KeyValuePair<string, object> p in Properties)
231 sb.Append ("\n------------\n")
234 .Append ("\nValue: ")
236 return sb.ToString ();