LocalServiceSecuritySettingsElement.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. //
  2. // LocalServiceSecuritySettingsElement.cs
  3. //
  4. // Author:
  5. // Atsushi Enomoto <[email protected]>
  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.
  27. //
  28. using System;
  29. using System.Collections;
  30. using System.Collections.Generic;
  31. using System.Collections.ObjectModel;
  32. using System.ComponentModel;
  33. using System.Configuration;
  34. using System.Net;
  35. using System.Net.Security;
  36. using System.Reflection;
  37. using System.Security.Cryptography.X509Certificates;
  38. using System.Security.Principal;
  39. using System.IdentityModel.Claims;
  40. using System.IdentityModel.Policy;
  41. using System.IdentityModel.Tokens;
  42. using System.ServiceModel;
  43. using System.ServiceModel.Channels;
  44. using System.ServiceModel.Description;
  45. using System.ServiceModel.Diagnostics;
  46. using System.ServiceModel.Dispatcher;
  47. using System.ServiceModel.MsmqIntegration;
  48. using System.ServiceModel.PeerResolvers;
  49. using System.ServiceModel.Security;
  50. using System.Runtime.Serialization;
  51. using System.Text;
  52. using System.Xml;
  53. namespace System.ServiceModel.Configuration
  54. {
  55. [MonoTODO]
  56. public sealed partial class LocalServiceSecuritySettingsElement
  57. : ConfigurationElement
  58. {
  59. // Static Fields
  60. static ConfigurationPropertyCollection properties;
  61. static ConfigurationProperty detect_replays;
  62. static ConfigurationProperty inactivity_timeout;
  63. static ConfigurationProperty issued_cookie_lifetime;
  64. static ConfigurationProperty max_cached_cookies;
  65. static ConfigurationProperty max_clock_skew;
  66. static ConfigurationProperty max_pending_sessions;
  67. static ConfigurationProperty max_stateful_negotiations;
  68. static ConfigurationProperty negotiation_timeout;
  69. static ConfigurationProperty reconnect_transport_on_failure;
  70. static ConfigurationProperty replay_cache_size;
  71. static ConfigurationProperty replay_window;
  72. static ConfigurationProperty session_key_renewal_interval;
  73. static ConfigurationProperty session_key_rollover_interval;
  74. static ConfigurationProperty timestamp_validity_duration;
  75. static LocalServiceSecuritySettingsElement ()
  76. {
  77. properties = new ConfigurationPropertyCollection ();
  78. detect_replays = new ConfigurationProperty ("detectReplays",
  79. typeof (bool), "true", new BooleanConverter (), null,
  80. ConfigurationPropertyOptions.None);
  81. inactivity_timeout = new ConfigurationProperty ("inactivityTimeout",
  82. typeof (TimeSpan), "00:02:00", null/* FIXME: get converter for TimeSpan*/, null,
  83. ConfigurationPropertyOptions.None);
  84. issued_cookie_lifetime = new ConfigurationProperty ("issuedCookieLifetime",
  85. typeof (TimeSpan), "10:00:00", null/* FIXME: get converter for TimeSpan*/, null,
  86. ConfigurationPropertyOptions.None);
  87. max_cached_cookies = new ConfigurationProperty ("maxCachedCookies",
  88. typeof (int), "1000", null/* FIXME: get converter for int*/, null,
  89. ConfigurationPropertyOptions.None);
  90. max_clock_skew = new ConfigurationProperty ("maxClockSkew",
  91. typeof (TimeSpan), "00:05:00", null/* FIXME: get converter for TimeSpan*/, null,
  92. ConfigurationPropertyOptions.None);
  93. max_pending_sessions = new ConfigurationProperty ("maxPendingSessions",
  94. typeof (int), "128", null/* FIXME: get converter for int*/, null,
  95. ConfigurationPropertyOptions.None);
  96. max_stateful_negotiations = new ConfigurationProperty ("maxStatefulNegotiations",
  97. typeof (int), "128", null/* FIXME: get converter for int*/, null,
  98. ConfigurationPropertyOptions.None);
  99. negotiation_timeout = new ConfigurationProperty ("negotiationTimeout",
  100. typeof (TimeSpan), "00:01:00", null/* FIXME: get converter for TimeSpan*/, null,
  101. ConfigurationPropertyOptions.None);
  102. reconnect_transport_on_failure = new ConfigurationProperty ("reconnectTransportOnFailure",
  103. typeof (bool), "true", new BooleanConverter (), null,
  104. ConfigurationPropertyOptions.None);
  105. replay_cache_size = new ConfigurationProperty ("replayCacheSize",
  106. typeof (int), "900000", null/* FIXME: get converter for int*/, null,
  107. ConfigurationPropertyOptions.None);
  108. replay_window = new ConfigurationProperty ("replayWindow",
  109. typeof (TimeSpan), "00:05:00", null/* FIXME: get converter for TimeSpan*/, null,
  110. ConfigurationPropertyOptions.None);
  111. session_key_renewal_interval = new ConfigurationProperty ("sessionKeyRenewalInterval",
  112. typeof (TimeSpan), "15:00:00", null/* FIXME: get converter for TimeSpan*/, null,
  113. ConfigurationPropertyOptions.None);
  114. session_key_rollover_interval = new ConfigurationProperty ("sessionKeyRolloverInterval",
  115. typeof (TimeSpan), "00:05:00", null/* FIXME: get converter for TimeSpan*/, null,
  116. ConfigurationPropertyOptions.None);
  117. timestamp_validity_duration = new ConfigurationProperty ("timestampValidityDuration",
  118. typeof (TimeSpan), "00:05:00", null/* FIXME: get converter for TimeSpan*/, null,
  119. ConfigurationPropertyOptions.None);
  120. properties.Add (detect_replays);
  121. properties.Add (inactivity_timeout);
  122. properties.Add (issued_cookie_lifetime);
  123. properties.Add (max_cached_cookies);
  124. properties.Add (max_clock_skew);
  125. properties.Add (max_pending_sessions);
  126. properties.Add (max_stateful_negotiations);
  127. properties.Add (negotiation_timeout);
  128. properties.Add (reconnect_transport_on_failure);
  129. properties.Add (replay_cache_size);
  130. properties.Add (replay_window);
  131. properties.Add (session_key_renewal_interval);
  132. properties.Add (session_key_rollover_interval);
  133. properties.Add (timestamp_validity_duration);
  134. }
  135. public LocalServiceSecuritySettingsElement ()
  136. {
  137. }
  138. // Properties
  139. [ConfigurationProperty ("detectReplays",
  140. Options = ConfigurationPropertyOptions.None,
  141. DefaultValue = true)]
  142. public bool DetectReplays {
  143. get { return (bool) base [detect_replays]; }
  144. set { base [detect_replays] = value; }
  145. }
  146. [ConfigurationProperty ("inactivityTimeout",
  147. Options = ConfigurationPropertyOptions.None,
  148. DefaultValue = "00:02:00")]
  149. public TimeSpan InactivityTimeout {
  150. get { return (TimeSpan) base [inactivity_timeout]; }
  151. set { base [inactivity_timeout] = value; }
  152. }
  153. [ConfigurationProperty ("issuedCookieLifetime",
  154. Options = ConfigurationPropertyOptions.None,
  155. DefaultValue = "10:00:00")]
  156. public TimeSpan IssuedCookieLifetime {
  157. get { return (TimeSpan) base [issued_cookie_lifetime]; }
  158. set { base [issued_cookie_lifetime] = value; }
  159. }
  160. [IntegerValidator ( MinValue = 0,
  161. MaxValue = int.MaxValue,
  162. ExcludeRange = false)]
  163. [ConfigurationProperty ("maxCachedCookies",
  164. Options = ConfigurationPropertyOptions.None,
  165. DefaultValue = "1000")]
  166. public int MaxCachedCookies {
  167. get { return (int) base [max_cached_cookies]; }
  168. set { base [max_cached_cookies] = value; }
  169. }
  170. [ConfigurationProperty ("maxClockSkew",
  171. Options = ConfigurationPropertyOptions.None,
  172. DefaultValue = "00:05:00")]
  173. public TimeSpan MaxClockSkew {
  174. get { return (TimeSpan) base [max_clock_skew]; }
  175. set { base [max_clock_skew] = value; }
  176. }
  177. [IntegerValidator ( MinValue = 1,
  178. MaxValue = int.MaxValue,
  179. ExcludeRange = false)]
  180. [ConfigurationProperty ("maxPendingSessions",
  181. Options = ConfigurationPropertyOptions.None,
  182. DefaultValue = "128")]
  183. public int MaxPendingSessions {
  184. get { return (int) base [max_pending_sessions]; }
  185. set { base [max_pending_sessions] = value; }
  186. }
  187. [IntegerValidator ( MinValue = 0,
  188. MaxValue = int.MaxValue,
  189. ExcludeRange = false)]
  190. [ConfigurationProperty ("maxStatefulNegotiations",
  191. Options = ConfigurationPropertyOptions.None,
  192. DefaultValue = "128")]
  193. public int MaxStatefulNegotiations {
  194. get { return (int) base [max_stateful_negotiations]; }
  195. set { base [max_stateful_negotiations] = value; }
  196. }
  197. [ConfigurationProperty ("negotiationTimeout",
  198. Options = ConfigurationPropertyOptions.None,
  199. DefaultValue = "00:01:00")]
  200. public TimeSpan NegotiationTimeout {
  201. get { return (TimeSpan) base [negotiation_timeout]; }
  202. set { base [negotiation_timeout] = value; }
  203. }
  204. protected override ConfigurationPropertyCollection Properties {
  205. get { return properties; }
  206. }
  207. [ConfigurationProperty ("reconnectTransportOnFailure",
  208. Options = ConfigurationPropertyOptions.None,
  209. DefaultValue = true)]
  210. public bool ReconnectTransportOnFailure {
  211. get { return (bool) base [reconnect_transport_on_failure]; }
  212. set { base [reconnect_transport_on_failure] = value; }
  213. }
  214. [IntegerValidator ( MinValue = 1,
  215. MaxValue = int.MaxValue,
  216. ExcludeRange = false)]
  217. [ConfigurationProperty ("replayCacheSize",
  218. Options = ConfigurationPropertyOptions.None,
  219. DefaultValue = "900000")]
  220. public int ReplayCacheSize {
  221. get { return (int) base [replay_cache_size]; }
  222. set { base [replay_cache_size] = value; }
  223. }
  224. [ConfigurationProperty ("replayWindow",
  225. Options = ConfigurationPropertyOptions.None,
  226. DefaultValue = "00:05:00")]
  227. public TimeSpan ReplayWindow {
  228. get { return (TimeSpan) base [replay_window]; }
  229. set { base [replay_window] = value; }
  230. }
  231. [ConfigurationProperty ("sessionKeyRenewalInterval",
  232. Options = ConfigurationPropertyOptions.None,
  233. DefaultValue = "15:00:00")]
  234. public TimeSpan SessionKeyRenewalInterval {
  235. get { return (TimeSpan) base [session_key_renewal_interval]; }
  236. set { base [session_key_renewal_interval] = value; }
  237. }
  238. [ConfigurationProperty ("sessionKeyRolloverInterval",
  239. Options = ConfigurationPropertyOptions.None,
  240. DefaultValue = "00:05:00")]
  241. public TimeSpan SessionKeyRolloverInterval {
  242. get { return (TimeSpan) base [session_key_rollover_interval]; }
  243. set { base [session_key_rollover_interval] = value; }
  244. }
  245. [ConfigurationProperty ("timestampValidityDuration",
  246. Options = ConfigurationPropertyOptions.None,
  247. DefaultValue = "00:05:00")]
  248. public TimeSpan TimestampValidityDuration {
  249. get { return (TimeSpan) base [timestamp_validity_duration]; }
  250. set { base [timestamp_validity_duration] = value; }
  251. }
  252. }
  253. }