2 // LocalServiceSecuritySettingsElement.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.
30 using System.Collections;
31 using System.Collections.Generic;
32 using System.Collections.ObjectModel;
33 using System.ComponentModel;
34 using System.Configuration;
36 using System.Net.Security;
37 using System.Reflection;
38 using System.Security.Cryptography.X509Certificates;
39 using System.Security.Principal;
40 using System.IdentityModel.Claims;
41 using System.IdentityModel.Policy;
42 using System.IdentityModel.Tokens;
43 using System.ServiceModel;
44 using System.ServiceModel.Channels;
45 using System.ServiceModel.Description;
46 using System.ServiceModel.Diagnostics;
47 using System.ServiceModel.Dispatcher;
48 using System.ServiceModel.MsmqIntegration;
49 using System.ServiceModel.PeerResolvers;
50 using System.ServiceModel.Security;
51 using System.Runtime.Serialization;
55 namespace System.ServiceModel.Configuration
58 public sealed partial class LocalServiceSecuritySettingsElement
59 : ConfigurationElement
62 static ConfigurationPropertyCollection properties;
63 static ConfigurationProperty detect_replays;
64 static ConfigurationProperty inactivity_timeout;
65 static ConfigurationProperty issued_cookie_lifetime;
66 static ConfigurationProperty max_cached_cookies;
67 static ConfigurationProperty max_clock_skew;
68 static ConfigurationProperty max_pending_sessions;
69 static ConfigurationProperty max_stateful_negotiations;
70 static ConfigurationProperty negotiation_timeout;
71 static ConfigurationProperty reconnect_transport_on_failure;
72 static ConfigurationProperty replay_cache_size;
73 static ConfigurationProperty replay_window;
74 static ConfigurationProperty session_key_renewal_interval;
75 static ConfigurationProperty session_key_rollover_interval;
76 static ConfigurationProperty timestamp_validity_duration;
78 static LocalServiceSecuritySettingsElement ()
80 properties = new ConfigurationPropertyCollection ();
81 detect_replays = new ConfigurationProperty ("detectReplays",
82 typeof (bool), "true", new BooleanConverter (), null,
83 ConfigurationPropertyOptions.None);
85 inactivity_timeout = new ConfigurationProperty ("inactivityTimeout",
86 typeof (TimeSpan), "00:02:00", new TimeSpanConverter (), null,
87 ConfigurationPropertyOptions.None);
89 issued_cookie_lifetime = new ConfigurationProperty ("issuedCookieLifetime",
90 typeof (TimeSpan), "10:00:00", new TimeSpanConverter (), null,
91 ConfigurationPropertyOptions.None);
93 max_cached_cookies = new ConfigurationProperty ("maxCachedCookies",
94 typeof (int), "1000", null/* FIXME: get converter for int*/, null,
95 ConfigurationPropertyOptions.None);
97 max_clock_skew = new ConfigurationProperty ("maxClockSkew",
98 typeof (TimeSpan), "00:05:00", new TimeSpanConverter (), null,
99 ConfigurationPropertyOptions.None);
101 max_pending_sessions = new ConfigurationProperty ("maxPendingSessions",
102 typeof (int), "128", null/* FIXME: get converter for int*/, null,
103 ConfigurationPropertyOptions.None);
105 max_stateful_negotiations = new ConfigurationProperty ("maxStatefulNegotiations",
106 typeof (int), "128", null/* FIXME: get converter for int*/, null,
107 ConfigurationPropertyOptions.None);
109 negotiation_timeout = new ConfigurationProperty ("negotiationTimeout",
110 typeof (TimeSpan), "00:01:00", new TimeSpanConverter (), null,
111 ConfigurationPropertyOptions.None);
113 reconnect_transport_on_failure = new ConfigurationProperty ("reconnectTransportOnFailure",
114 typeof (bool), "true", new BooleanConverter (), null,
115 ConfigurationPropertyOptions.None);
117 replay_cache_size = new ConfigurationProperty ("replayCacheSize",
118 typeof (int), "900000", null/* FIXME: get converter for int*/, null,
119 ConfigurationPropertyOptions.None);
121 replay_window = new ConfigurationProperty ("replayWindow",
122 typeof (TimeSpan), "00:05:00", new TimeSpanConverter (), null,
123 ConfigurationPropertyOptions.None);
125 session_key_renewal_interval = new ConfigurationProperty ("sessionKeyRenewalInterval",
126 typeof (TimeSpan), "15:00:00", new TimeSpanConverter (), null,
127 ConfigurationPropertyOptions.None);
129 session_key_rollover_interval = new ConfigurationProperty ("sessionKeyRolloverInterval",
130 typeof (TimeSpan), "00:05:00", new TimeSpanConverter (), null,
131 ConfigurationPropertyOptions.None);
133 timestamp_validity_duration = new ConfigurationProperty ("timestampValidityDuration",
134 typeof (TimeSpan), "00:05:00", new TimeSpanConverter (), null,
135 ConfigurationPropertyOptions.None);
137 properties.Add (detect_replays);
138 properties.Add (inactivity_timeout);
139 properties.Add (issued_cookie_lifetime);
140 properties.Add (max_cached_cookies);
141 properties.Add (max_clock_skew);
142 properties.Add (max_pending_sessions);
143 properties.Add (max_stateful_negotiations);
144 properties.Add (negotiation_timeout);
145 properties.Add (reconnect_transport_on_failure);
146 properties.Add (replay_cache_size);
147 properties.Add (replay_window);
148 properties.Add (session_key_renewal_interval);
149 properties.Add (session_key_rollover_interval);
150 properties.Add (timestamp_validity_duration);
153 public LocalServiceSecuritySettingsElement ()
160 [ConfigurationProperty ("detectReplays",
161 Options = ConfigurationPropertyOptions.None,
162 DefaultValue = true)]
163 public bool DetectReplays {
164 get { return (bool) base [detect_replays]; }
165 set { base [detect_replays] = value; }
168 [ConfigurationProperty ("inactivityTimeout",
169 Options = ConfigurationPropertyOptions.None,
170 DefaultValue = "00:02:00")]
171 [TypeConverter (typeof (TimeSpanConverter))]
172 public TimeSpan InactivityTimeout {
173 get { return (TimeSpan) base [inactivity_timeout]; }
174 set { base [inactivity_timeout] = value; }
177 [ConfigurationProperty ("issuedCookieLifetime",
178 Options = ConfigurationPropertyOptions.None,
179 DefaultValue = "10:00:00")]
180 [TypeConverter (typeof (TimeSpanConverter))]
181 public TimeSpan IssuedCookieLifetime {
182 get { return (TimeSpan) base [issued_cookie_lifetime]; }
183 set { base [issued_cookie_lifetime] = value; }
186 [IntegerValidator ( MinValue = 0,
187 MaxValue = int.MaxValue,
188 ExcludeRange = false)]
189 [ConfigurationProperty ("maxCachedCookies",
190 Options = ConfigurationPropertyOptions.None,
191 DefaultValue = "1000")]
192 public int MaxCachedCookies {
193 get { return (int) base [max_cached_cookies]; }
194 set { base [max_cached_cookies] = value; }
197 [ConfigurationProperty ("maxClockSkew",
198 Options = ConfigurationPropertyOptions.None,
199 DefaultValue = "00:05:00")]
200 [TypeConverter (typeof (TimeSpanConverter))]
201 public TimeSpan MaxClockSkew {
202 get { return (TimeSpan) base [max_clock_skew]; }
203 set { base [max_clock_skew] = value; }
206 [IntegerValidator ( MinValue = 1,
207 MaxValue = int.MaxValue,
208 ExcludeRange = false)]
209 [ConfigurationProperty ("maxPendingSessions",
210 Options = ConfigurationPropertyOptions.None,
211 DefaultValue = "128")]
212 public int MaxPendingSessions {
213 get { return (int) base [max_pending_sessions]; }
214 set { base [max_pending_sessions] = value; }
217 [IntegerValidator ( MinValue = 0,
218 MaxValue = int.MaxValue,
219 ExcludeRange = false)]
220 [ConfigurationProperty ("maxStatefulNegotiations",
221 Options = ConfigurationPropertyOptions.None,
222 DefaultValue = "128")]
223 public int MaxStatefulNegotiations {
224 get { return (int) base [max_stateful_negotiations]; }
225 set { base [max_stateful_negotiations] = value; }
228 [ConfigurationProperty ("negotiationTimeout",
229 Options = ConfigurationPropertyOptions.None,
230 DefaultValue = "00:01:00")]
231 [TypeConverter (typeof (TimeSpanConverter))]
232 public TimeSpan NegotiationTimeout {
233 get { return (TimeSpan) base [negotiation_timeout]; }
234 set { base [negotiation_timeout] = value; }
237 protected override ConfigurationPropertyCollection Properties {
238 get { return properties; }
241 [ConfigurationProperty ("reconnectTransportOnFailure",
242 Options = ConfigurationPropertyOptions.None,
243 DefaultValue = true)]
244 public bool ReconnectTransportOnFailure {
245 get { return (bool) base [reconnect_transport_on_failure]; }
246 set { base [reconnect_transport_on_failure] = value; }
249 [IntegerValidator ( MinValue = 1,
250 MaxValue = int.MaxValue,
251 ExcludeRange = false)]
252 [ConfigurationProperty ("replayCacheSize",
253 Options = ConfigurationPropertyOptions.None,
254 DefaultValue = "900000")]
255 public int ReplayCacheSize {
256 get { return (int) base [replay_cache_size]; }
257 set { base [replay_cache_size] = value; }
260 [ConfigurationProperty ("replayWindow",
261 Options = ConfigurationPropertyOptions.None,
262 DefaultValue = "00:05:00")]
263 [TypeConverter (typeof (TimeSpanConverter))]
264 public TimeSpan ReplayWindow {
265 get { return (TimeSpan) base [replay_window]; }
266 set { base [replay_window] = value; }
269 [ConfigurationProperty ("sessionKeyRenewalInterval",
270 Options = ConfigurationPropertyOptions.None,
271 DefaultValue = "15:00:00")]
272 [TypeConverter (typeof (TimeSpanConverter))]
273 public TimeSpan SessionKeyRenewalInterval {
274 get { return (TimeSpan) base [session_key_renewal_interval]; }
275 set { base [session_key_renewal_interval] = value; }
278 [ConfigurationProperty ("sessionKeyRolloverInterval",
279 Options = ConfigurationPropertyOptions.None,
280 DefaultValue = "00:05:00")]
281 [TypeConverter (typeof (TimeSpanConverter))]
282 public TimeSpan SessionKeyRolloverInterval {
283 get { return (TimeSpan) base [session_key_rollover_interval]; }
284 set { base [session_key_rollover_interval] = value; }
287 [ConfigurationProperty ("timestampValidityDuration",
288 Options = ConfigurationPropertyOptions.None,
289 DefaultValue = "00:05:00")]
290 [TypeConverter (typeof (TimeSpanConverter))]
291 public TimeSpan TimestampValidityDuration {
292 get { return (TimeSpan) base [timestamp_validity_duration]; }
293 set { base [timestamp_validity_duration] = value; }