New tests.
[mono.git] / mcs / class / System.ServiceModel / System.ServiceModel.Configuration / FederatedMessageSecurityOverHttpElement.cs
1 //
2 // FederatedMessageSecurityOverHttpElement.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         [MonoTODO]
58         public sealed partial class FederatedMessageSecurityOverHttpElement
59                  : ConfigurationElement
60         {
61                 // Static Fields
62                 static ConfigurationPropertyCollection properties;
63                 static ConfigurationProperty algorithm_suite;
64                 static ConfigurationProperty claim_type_requirements;
65                 static ConfigurationProperty issued_key_type;
66                 static ConfigurationProperty issued_token_type;
67                 static ConfigurationProperty issuer;
68                 static ConfigurationProperty issuer_metadata;
69                 static ConfigurationProperty negotiate_service_credential;
70                 static ConfigurationProperty token_request_parameters;
71
72                 static FederatedMessageSecurityOverHttpElement ()
73                 {
74                         properties = new ConfigurationPropertyCollection ();
75                         algorithm_suite = new ConfigurationProperty ("algorithmSuite",
76                                 typeof (SecurityAlgorithmSuite), "Default", null/* FIXME: get converter for SecurityAlgorithmSuite*/, null,
77                                 ConfigurationPropertyOptions.None);
78
79                         claim_type_requirements = new ConfigurationProperty ("claimTypeRequirements",
80                                 typeof (ClaimTypeElementCollection), null, null/* FIXME: get converter for ClaimTypeElementCollection*/, null,
81                                 ConfigurationPropertyOptions.None);
82
83                         issued_key_type = new ConfigurationProperty ("issuedKeyType",
84                                 typeof (SecurityKeyType), "SymmetricKey", null/* FIXME: get converter for SecurityKeyType*/, null,
85                                 ConfigurationPropertyOptions.None);
86
87                         issued_token_type = new ConfigurationProperty ("issuedTokenType",
88                                 typeof (string), "", new StringConverter (), null,
89                                 ConfigurationPropertyOptions.None);
90
91                         issuer = new ConfigurationProperty ("issuer",
92                                 typeof (IssuedTokenParametersEndpointAddressElement), null, null/* FIXME: get converter for IssuedTokenParametersEndpointAddressElement*/, null,
93                                 ConfigurationPropertyOptions.None);
94
95                         issuer_metadata = new ConfigurationProperty ("issuerMetadata",
96                                 typeof (EndpointAddressElementBase), null, null/* FIXME: get converter for EndpointAddressElementBase*/, null,
97                                 ConfigurationPropertyOptions.None);
98
99                         negotiate_service_credential = new ConfigurationProperty ("negotiateServiceCredential",
100                                 typeof (bool), "true", new BooleanConverter (), null,
101                                 ConfigurationPropertyOptions.None);
102
103                         token_request_parameters = new ConfigurationProperty ("tokenRequestParameters",
104                                 typeof (XmlElementElementCollection), null, null/* FIXME: get converter for XmlElementElementCollection*/, null,
105                                 ConfigurationPropertyOptions.None);
106
107                         properties.Add (algorithm_suite);
108                         properties.Add (claim_type_requirements);
109                         properties.Add (issued_key_type);
110                         properties.Add (issued_token_type);
111                         properties.Add (issuer);
112                         properties.Add (issuer_metadata);
113                         properties.Add (negotiate_service_credential);
114                         properties.Add (token_request_parameters);
115                 }
116
117                 public FederatedMessageSecurityOverHttpElement ()
118                 {
119                 }
120
121
122                 // Properties
123
124                 [TypeConverter (typeof (SecurityAlgorithmSuiteConverter))]
125                 [ConfigurationProperty ("algorithmSuite",
126                          Options = ConfigurationPropertyOptions.None,
127                          DefaultValue = "Default")]
128                 public SecurityAlgorithmSuite AlgorithmSuite {
129                         get { return (SecurityAlgorithmSuite) base [algorithm_suite]; }
130                         set { base [algorithm_suite] = value; }
131                 }
132
133                 [ConfigurationProperty ("claimTypeRequirements",
134                          Options = ConfigurationPropertyOptions.None)]
135                 public ClaimTypeElementCollection ClaimTypeRequirements {
136                         get { return (ClaimTypeElementCollection) base [claim_type_requirements]; }
137                 }
138
139                 [ConfigurationProperty ("issuedKeyType",
140                          Options = ConfigurationPropertyOptions.None,
141                          DefaultValue = "SymmetricKey")]
142                 public SecurityKeyType IssuedKeyType {
143                         get { return (SecurityKeyType) base [issued_key_type]; }
144                         set { base [issued_key_type] = value; }
145                 }
146
147                 [StringValidator ( MinLength = 0,
148                         MaxLength = int.MaxValue,
149                          InvalidCharacters = null)]
150                 [ConfigurationProperty ("issuedTokenType",
151                          Options = ConfigurationPropertyOptions.None,
152                          DefaultValue = "")]
153                 public string IssuedTokenType {
154                         get { return (string) base [issued_token_type]; }
155                         set { base [issued_token_type] = value; }
156                 }
157
158                 [ConfigurationProperty ("issuer",
159                          Options = ConfigurationPropertyOptions.None)]
160                 public IssuedTokenParametersEndpointAddressElement Issuer {
161                         get { return (IssuedTokenParametersEndpointAddressElement) base [issuer]; }
162                 }
163
164                 [ConfigurationProperty ("issuerMetadata",
165                          Options = ConfigurationPropertyOptions.None)]
166                 public EndpointAddressElementBase IssuerMetadata {
167                         get { return (EndpointAddressElementBase) base [issuer_metadata]; }
168                 }
169
170                 [ConfigurationProperty ("negotiateServiceCredential",
171                          Options = ConfigurationPropertyOptions.None,
172                         DefaultValue = true)]
173                 public bool NegotiateServiceCredential {
174                         get { return (bool) base [negotiate_service_credential]; }
175                         set { base [negotiate_service_credential] = value; }
176                 }
177
178                 protected override ConfigurationPropertyCollection Properties {
179                         get { return properties; }
180                 }
181
182                 [ConfigurationProperty ("tokenRequestParameters",
183                          Options = ConfigurationPropertyOptions.None)]
184                 public XmlElementElementCollection TokenRequestParameters {
185                         get { return (XmlElementElementCollection) base [token_request_parameters]; }
186                 }
187
188
189         }
190
191 }