2005-11-13 Chris Toshok <toshok@ximian.com>
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / MachineKeySection.cs
1 //
2 // System.Web.Configuration.MachineKeySection
3 //
4 // Authors:
5 //      Chris Toshok (toshok@ximian.com)
6 //
7 // (c) Copyright 2005 Novell, Inc (http://www.novell.com)
8 //
9
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 using System;
32 using System.ComponentModel;
33 using System.Configuration;
34
35 #if NET_2_0
36
37 namespace System.Web.Configuration {
38
39         public sealed class MachineKeySection : ConfigurationSection
40         {
41                 static ConfigurationProperty decryptionProp;
42                 static ConfigurationProperty decryptionKeyProp;
43                 static ConfigurationProperty validationProp;
44                 static ConfigurationProperty validationKeyProp;
45                 static ConfigurationPropertyCollection properties;
46
47                 static MachineKeySection ()
48                 {
49                         decryptionProp = new ConfigurationProperty ("decryption", typeof (string), "Auto");
50                         decryptionKeyProp = new ConfigurationProperty ("decryptionKey", typeof (string), "AutoGenerate,IsolateApps");
51                         validationProp = new ConfigurationProperty ("validation", typeof (MachineKeyValidation), MachineKeyValidation.SHA1);
52                         validationKeyProp = new ConfigurationProperty ("validationKey", typeof (string), "AutoGenerate,IsolateApps");
53                         properties = new ConfigurationPropertyCollection ();
54
55                         properties.Add (decryptionProp);
56                         properties.Add (decryptionKeyProp);
57                         properties.Add (validationProp);
58                         properties.Add (validationKeyProp);
59
60                 }
61
62                 [MonoTODO]
63                 protected override void Reset (ConfigurationElement parentElement)
64                 {
65                         base.Reset (parentElement);
66                 }
67
68                 [TypeConverter (typeof (WhiteSpaceTrimStringConverter))]
69                 [StringValidator (MinLength = 1)]
70                 [ConfigurationProperty ("decryption", DefaultValue = "Auto")]
71                 public string Decryption {
72                         get { return (string) base [decryptionProp];}
73                         set { base[decryptionProp] = value; }
74                 }
75
76                 [TypeConverter (typeof (WhiteSpaceTrimStringConverter))]
77                 [StringValidator (MinLength = 1)]
78                 [ConfigurationProperty ("decryptionKey", DefaultValue = "AutoGenerate,IsolateApps")]
79                 public string DecryptionKey {
80                         get { return (string) base [decryptionKeyProp];}
81                         set { base[decryptionKeyProp] = value; }
82                 }
83
84 #if notyet
85                 [TypeConverter (typeof (MachineKeyValidationConverter))]
86 #endif
87                 [ConfigurationProperty ("validation", DefaultValue = "SHA1")]
88                 public MachineKeyValidation Validation {
89                         get { return (MachineKeyValidation) base [validationProp];}
90                         set { base[validationProp] = value; }
91                 }
92
93                 [TypeConverter (typeof (WhiteSpaceTrimStringConverter))]
94                 [StringValidator (MinLength = 1)]
95                 [ConfigurationProperty ("validationKey", DefaultValue = "AutoGenerate,IsolateApps")]
96                 public string ValidationKey {
97                         get { return (string) base [validationKeyProp];}
98                         set { base[validationKeyProp] = value; }
99                 }
100
101                 protected override ConfigurationPropertyCollection Properties {
102                         get { return properties; }
103                 }
104         }
105 }
106
107 #endif