[asp.net] Implemented CustomErrorsRedirectMode
[mono.git] / mcs / class / System.ServiceModel / System.ServiceModel.Configuration / LocalClientSecuritySettingsElement.cs
1 //
2 // LocalClientSecuritySettingsElement.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.
27 //
28
29 using System;
30 using System.Collections;
31 using System.Collections.Generic;
32 using System.Collections.ObjectModel;
33 using System.ComponentModel;
34 using System.Configuration;
35 using System.Net;
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;
52 using System.Text;
53 using System.Xml;
54
55 namespace System.ServiceModel.Configuration
56 {
57         public sealed class LocalClientSecuritySettingsElement
58                  : ConfigurationElement
59         {
60                 static ConfigurationPropertyCollection properties;
61                 static ConfigurationProperty cache_cookies;
62                 static ConfigurationProperty cookie_renewal_threshold_percentage;
63                 static ConfigurationProperty detect_replays;
64                 static ConfigurationProperty max_clock_skew;
65                 static ConfigurationProperty max_cookie_caching_time;
66                 static ConfigurationProperty reconnect_transport_on_failure;
67                 static ConfigurationProperty replay_cache_size;
68                 static ConfigurationProperty replay_window;
69                 static ConfigurationProperty session_key_renewal_interval;
70                 static ConfigurationProperty session_key_rollover_interval;
71                 static ConfigurationProperty timestamp_validity_duration;
72
73                 static LocalClientSecuritySettingsElement ()
74                 {
75                         cache_cookies = new ConfigurationProperty ("cacheCookies", typeof (bool), true, null, null, ConfigurationPropertyOptions.None);
76
77                         cookie_renewal_threshold_percentage = new ConfigurationProperty ("cookieRenewalThresholdPercentage", typeof (int), 60, null, new IntegerValidator (0, 100, false), ConfigurationPropertyOptions.None);
78
79                         detect_replays = new ConfigurationProperty ("detectReplays", typeof (bool), true, null, null, ConfigurationPropertyOptions.None);
80
81                         max_clock_skew = new ConfigurationProperty ("maxClockSkew", typeof (TimeSpan), "00:05:00", new TimeSpanConverter (), null, ConfigurationPropertyOptions.None);
82
83                         max_cookie_caching_time = new ConfigurationProperty ("maxCookieCachingTime", typeof (TimeSpan), "10675199.02:48:05.4775807", new TimeSpanConverter (), null, ConfigurationPropertyOptions.None);
84
85                         reconnect_transport_on_failure = new ConfigurationProperty ("reconnectTransportOnFailure", typeof (bool), true, null, null, ConfigurationPropertyOptions.None);
86
87                         replay_cache_size = new ConfigurationProperty ("replayCacheSize", typeof (int), 900000, null, new IntegerValidator (1, int.MaxValue, false), ConfigurationPropertyOptions.None);
88
89                         replay_window = new ConfigurationProperty ("replayWindow", typeof (TimeSpan), "00:05:00", new TimeSpanConverter (), null, ConfigurationPropertyOptions.None);
90
91                         session_key_renewal_interval = new ConfigurationProperty ("sessionKeyRenewalInterval", typeof (TimeSpan), "10:00:00", new TimeSpanConverter (), null, ConfigurationPropertyOptions.None);
92
93                         session_key_rollover_interval = new ConfigurationProperty ("sessionKeyRolloverInterval", typeof (TimeSpan), "00:05:00", new TimeSpanConverter (), null, ConfigurationPropertyOptions.None);
94
95                         timestamp_validity_duration = new ConfigurationProperty ("timestampValidityDuration", typeof (TimeSpan), "00:05:00", new TimeSpanConverter (), null, ConfigurationPropertyOptions.None);
96
97                         properties = new ConfigurationPropertyCollection ();
98
99                         properties.Add (cache_cookies);
100                         properties.Add (cookie_renewal_threshold_percentage);
101                         properties.Add (detect_replays);
102                         properties.Add (max_clock_skew);
103                         properties.Add (max_cookie_caching_time);
104                         properties.Add (reconnect_transport_on_failure);
105                         properties.Add (replay_cache_size);
106                         properties.Add (replay_window);
107                         properties.Add (session_key_renewal_interval);
108                         properties.Add (session_key_rollover_interval);
109                         properties.Add (timestamp_validity_duration);
110                 }
111
112                 public LocalClientSecuritySettingsElement ()
113                 {
114                 }
115
116
117                 // Properties
118
119                 [ConfigurationProperty ("cacheCookies",
120                          Options = ConfigurationPropertyOptions.None,
121                         DefaultValue = true)]
122                 public bool CacheCookies {
123                         get { return (bool) base ["cacheCookies"]; }
124                         set { base ["cacheCookies"] = value; }
125                 }
126
127                 [IntegerValidator ( MinValue = 0,
128                          MaxValue = 100,
129                         ExcludeRange = false)]
130                 [ConfigurationProperty ("cookieRenewalThresholdPercentage",
131                          Options = ConfigurationPropertyOptions.None,
132                          DefaultValue = "60")]
133                 public int CookieRenewalThresholdPercentage {
134                         get { return (int) base ["cookieRenewalThresholdPercentage"]; }
135                         set { base ["cookieRenewalThresholdPercentage"] = value; }
136                 }
137
138                 [ConfigurationProperty ("detectReplays",
139                          Options = ConfigurationPropertyOptions.None,
140                         DefaultValue = true)]
141                 public bool DetectReplays {
142                         get { return (bool) base ["detectReplays"]; }
143                         set { base ["detectReplays"] = value; }
144                 }
145
146                 [ConfigurationProperty ("maxClockSkew",
147                          Options = ConfigurationPropertyOptions.None,
148                          DefaultValue = "00:05:00")]
149                 [TypeConverter (typeof (TimeSpanConverter))]
150                 public TimeSpan MaxClockSkew {
151                         get { return (TimeSpan) base ["maxClockSkew"]; }
152                         set { base ["maxClockSkew"] = value; }
153                 }
154
155                 [ConfigurationProperty ("maxCookieCachingTime",
156                          Options = ConfigurationPropertyOptions.None,
157                          DefaultValue = "10675199.02:48:05.4775807")]
158                 [TypeConverter (typeof (TimeSpanConverter))]
159                 public TimeSpan MaxCookieCachingTime {
160                         get { return (TimeSpan) base ["maxCookieCachingTime"]; }
161                         set { base ["maxCookieCachingTime"] = value; }
162                 }
163
164                 protected override ConfigurationPropertyCollection Properties {
165                         get { return properties; }
166                 }
167
168                 [ConfigurationProperty ("reconnectTransportOnFailure",
169                          Options = ConfigurationPropertyOptions.None,
170                         DefaultValue = true)]
171                 public bool ReconnectTransportOnFailure {
172                         get { return (bool) base ["reconnectTransportOnFailure"]; }
173                         set { base ["reconnectTransportOnFailure"] = value; }
174                 }
175
176                 [ConfigurationProperty ("replayCacheSize",
177                          Options = ConfigurationPropertyOptions.None,
178                          DefaultValue = "900000")]
179                 [IntegerValidator ( MinValue = 1,
180                         MaxValue = int.MaxValue,
181                         ExcludeRange = false)]
182                 public int ReplayCacheSize {
183                         get { return (int) base ["replayCacheSize"]; }
184                         set { base ["replayCacheSize"] = value; }
185                 }
186
187                 [ConfigurationProperty ("replayWindow",
188                          Options = ConfigurationPropertyOptions.None,
189                          DefaultValue = "00:05:00")]
190                 [TypeConverter (typeof (TimeSpanConverter))]
191                 public TimeSpan ReplayWindow {
192                         get { return (TimeSpan) base ["replayWindow"]; }
193                         set { base ["replayWindow"] = value; }
194                 }
195
196                 [ConfigurationProperty ("sessionKeyRenewalInterval",
197                          Options = ConfigurationPropertyOptions.None,
198                          DefaultValue = "10:00:00")]
199                 [TypeConverter (typeof (TimeSpanConverter))]
200                 public TimeSpan SessionKeyRenewalInterval {
201                         get { return (TimeSpan) base ["sessionKeyRenewalInterval"]; }
202                         set { base ["sessionKeyRenewalInterval"] = value; }
203                 }
204
205                 [ConfigurationProperty ("sessionKeyRolloverInterval",
206                          Options = ConfigurationPropertyOptions.None,
207                          DefaultValue = "00:05:00")]
208                 [TypeConverter (typeof (TimeSpanConverter))]
209                 public TimeSpan SessionKeyRolloverInterval {
210                         get { return (TimeSpan) base ["sessionKeyRolloverInterval"]; }
211                         set { base ["sessionKeyRolloverInterval"] = value; }
212                 }
213
214                 [ConfigurationProperty ("timestampValidityDuration",
215                          Options = ConfigurationPropertyOptions.None,
216                          DefaultValue = "00:05:00")]
217                 [TypeConverter (typeof (TimeSpanConverter))]
218                 public TimeSpan TimestampValidityDuration {
219                         get { return (TimeSpan) base ["timestampValidityDuration"]; }
220                         set { base ["timestampValidityDuration"] = value; }
221                 }
222
223
224         }
225
226 }