1 //-----------------------------------------------------------------------
2 // <copyright file="WSTrustConstantsAdapter.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //-----------------------------------------------------------------------
6 
7 namespace System.IdentityModel.Protocols.WSTrust
8 {
9     internal abstract class WSTrustConstantsAdapter
10     {
11         private static WSTrustAttributeNames attributeNames;
12         private static WSTrustElementNames elementNames;
13         private static FaultCodeValues faultCodes;
14 
15         private string namespaceURI;
16         private string prefix;
17 
18         internal static WSTrustFeb2005ConstantsAdapter TrustFeb2005
19         {
20             get
21             {
22                 return WSTrustFeb2005ConstantsAdapter.Instance;
23             }
24         }
25 
26         internal static WSTrust13ConstantsAdapter Trust13
27         {
28             get
29             {
30                 return WSTrust13ConstantsAdapter.Instance;
31             }
32         }
33 
34         internal string NamespaceURI
35         {
36             get { return this.namespaceURI; }
37             set { this.namespaceURI = value; }
38         }
39 
40         internal string Prefix
41         {
42             get { return this.prefix; }
43             set { this.prefix = value; }
44         }
45 
46         internal abstract WSTrustActions Actions
47         {
48             get;
49         }
50 
51         internal virtual WSTrustAttributeNames Attributes
52         {
53             get
54             {
55                 if (attributeNames == null)
56                 {
57                     attributeNames = new WSTrustAttributeNames();
58                 }
59 
60                 return attributeNames;
61             }
62         }
63 
64         internal abstract WSTrustComputedKeyAlgorithm ComputedKeyAlgorithm
65         {
66             get;
67         }
68 
69         internal virtual WSTrustElementNames Elements
70         {
71             get
72             {
73                 if (elementNames == null)
74                 {
75                     elementNames = new WSTrustElementNames();
76                 }
77 
78                 return elementNames;
79             }
80         }
81 
82         internal virtual FaultCodeValues FaultCodes
83         {
84             get
85             {
86                 if (faultCodes == null)
87                 {
88                     faultCodes = new FaultCodeValues();
89                 }
90 
91                 return faultCodes;
92             }
93         }
94 
95         internal abstract WSTrustRequestTypes RequestTypes
96         {
97             get;
98         }
99 
100         internal abstract WSTrustKeyTypes KeyTypes
101         {
102             get;
103         }
104 
GetConstantsAdapter(string ns)105         internal static WSTrustConstantsAdapter GetConstantsAdapter(string ns)
106         {
107             if (StringComparer.Ordinal.Equals(ns, WSTrustFeb2005Constants.NamespaceURI))
108             {
109                 return WSTrustConstantsAdapter.TrustFeb2005;
110             }
111             else if (StringComparer.Ordinal.Equals(ns, WSTrust13Constants.NamespaceURI))
112             {
113                 return WSTrustConstantsAdapter.Trust13;
114             }
115 
116             return null;
117         }
118 
119         internal abstract class WSTrustActions
120         {
121             internal string Cancel
122             {
123                 get;
124 
125                 set;
126             }
127 
128             internal string CancelResponse
129             {
130                 get;
131 
132                 set;
133             }
134 
135             internal string Issue
136             {
137                 get;
138 
139                 set;
140             }
141 
142             internal string IssueResponse
143             {
144                 get;
145 
146                 set;
147             }
148 
149             internal string Renew
150             {
151                 get;
152 
153                 set;
154             }
155 
156             internal string RenewResponse
157             {
158                 get;
159 
160                 set;
161             }
162 
163             internal string RequestSecurityContextToken
164             {
165                 get;
166 
167                 set;
168             }
169 
170             internal string RequestSecurityContextTokenCancel
171             {
172                 get;
173 
174                 set;
175             }
176 
177             internal string RequestSecurityContextTokenResponse
178             {
179                 get;
180 
181                 set;
182             }
183 
184             internal string RequestSecurityContextTokenResponseCancel
185             {
186                 get;
187 
188                 set;
189             }
190 
191             internal string Validate
192             {
193                 get;
194 
195                 set;
196             }
197 
198             internal string ValidateResponse
199             {
200                 get;
201 
202                 set;
203             }
204         }
205 
206         internal class WSTrustAttributeNames
207         {
208             private string allow = WSTrustFeb2005Constants.AttributeNames.Allow;
209             private string context = WSTrustFeb2005Constants.AttributeNames.Context;
210             private string dialect = WSTrustFeb2005Constants.AttributeNames.Dialect;
211             private string encodingType = WSTrustFeb2005Constants.AttributeNames.EncodingType;
212             private string oK = WSTrustFeb2005Constants.AttributeNames.OK;
213             private string type = WSTrustFeb2005Constants.AttributeNames.Type;
214             private string valueType = WSTrustFeb2005Constants.AttributeNames.ValueType;
215 
216             internal string Allow
217             {
218                 get { return this.allow; }
219             }
220 
221             internal string Context
222             {
223                 get { return this.context; }
224             }
225 
226             internal string Dialect
227             {
228                 get { return this.dialect; }
229             }
230 
231             internal string EncodingType
232             {
233                 get { return this.encodingType; }
234             }
235 
236             internal string OK
237             {
238                 get { return this.oK; }
239             }
240 
241             internal string Type
242             {
243                 get { return this.type; }
244             }
245 
246             internal string ValueType
247             {
248                 get { return this.valueType; }
249             }
250         }
251 
252         internal abstract class WSTrustComputedKeyAlgorithm
253         {
254             internal string Psha1
255             {
256                 get;
257 
258                 set;
259             }
260         }
261 
262         internal class WSTrustElementNames
263         {
264             private string allowPostdating = WSTrustFeb2005Constants.ElementNames.AllowPostdating;
265             private string authenticationType = WSTrustFeb2005Constants.ElementNames.AuthenticationType;
266             private string binarySecret = WSTrustFeb2005Constants.ElementNames.BinarySecret;
267             private string binaryExchange = WSTrustFeb2005Constants.ElementNames.BinaryExchange;
268             private string cancelTarget = WSTrustFeb2005Constants.ElementNames.CancelTarget;
269             private string claims = WSTrustFeb2005Constants.ElementNames.Claims;
270             private string computedKey = WSTrustFeb2005Constants.ElementNames.ComputedKey;
271             private string computedKeyAlgorithm = WSTrustFeb2005Constants.ElementNames.ComputedKeyAlgorithm;
272             private string canonicalizationAlgorithm = WSTrustFeb2005Constants.ElementNames.CanonicalizationAlgorithm;
273             private string code = WSTrustFeb2005Constants.ElementNames.Code;
274             private string delegatable = WSTrustFeb2005Constants.ElementNames.Delegatable;
275             private string delegateTo = WSTrustFeb2005Constants.ElementNames.DelegateTo;
276             private string encryption = WSTrustFeb2005Constants.ElementNames.Encryption;
277             private string encryptionAlgorithm = WSTrustFeb2005Constants.ElementNames.EncryptionAlgorithm;
278             private string encryptWith = WSTrustFeb2005Constants.ElementNames.EncryptWith;
279             private string entropy = WSTrustFeb2005Constants.ElementNames.Entropy;
280             private string forwardable = WSTrustFeb2005Constants.ElementNames.Forwardable;
281             private string issuer = WSTrustFeb2005Constants.ElementNames.Issuer;
282             private string keySize = WSTrustFeb2005Constants.ElementNames.KeySize;
283             private string keyType = WSTrustFeb2005Constants.ElementNames.KeyType;
284             private string lifetime = WSTrustFeb2005Constants.ElementNames.Lifetime;
285             private string onBehalfOf = WSTrustFeb2005Constants.ElementNames.OnBehalfOf;
286             private string participant = WSTrustFeb2005Constants.ElementNames.Participant;
287             private string participants = WSTrustFeb2005Constants.ElementNames.Participants;
288             private string primary = WSTrustFeb2005Constants.ElementNames.Primary;
289             private string proofEncryption = WSTrustFeb2005Constants.ElementNames.ProofEncryption;
290             private string reason = WSTrustFeb2005Constants.ElementNames.Reason;
291             private string renewing = WSTrustFeb2005Constants.ElementNames.Renewing;
292             private string renewTarget = WSTrustFeb2005Constants.ElementNames.RenewTarget;
293             private string requestedAttachedReference = WSTrustFeb2005Constants.ElementNames.RequestedAttachedReference;
294             private string requestedProofToken = WSTrustFeb2005Constants.ElementNames.RequestedProofToken;
295             private string requestedSecurityToken = WSTrustFeb2005Constants.ElementNames.RequestedSecurityToken;
296             private string requestedTokenCancelled = WSTrustFeb2005Constants.ElementNames.RequestedTokenCancelled;
297             private string requestedUnattachedReference = WSTrustFeb2005Constants.ElementNames.RequestedUnattachedReference;
298             private string requestKeySize = WSTrustFeb2005Constants.ElementNames.RequestKeySize;
299             private string requestSecurityToken = WSTrustFeb2005Constants.ElementNames.RequestSecurityToken;
300             private string requestSecurityTokenResponse = WSTrustFeb2005Constants.ElementNames.RequestSecurityTokenResponse;
301             private string requestType = WSTrustFeb2005Constants.ElementNames.RequestType;
302             private string securityContextToken = WSTrustFeb2005Constants.ElementNames.SecurityContextToken;
303             private string signWith = WSTrustFeb2005Constants.ElementNames.SignWith;
304             private string signatureAlgorithm = WSTrustFeb2005Constants.ElementNames.SignatureAlgorithm;
305             private string status = WSTrustFeb2005Constants.ElementNames.Status;
306             private string tokenType = WSTrustFeb2005Constants.ElementNames.TokenType;
307             private string useKey = WSTrustFeb2005Constants.ElementNames.UseKey;
308 
309             internal string AllowPostdating
310             {
311                 get { return this.allowPostdating; }
312             }
313 
314             internal string AuthenticationType
315             {
316                 get { return this.authenticationType; }
317             }
318 
319             internal string BinarySecret
320             {
321                 get { return this.binarySecret; }
322             }
323 
324             internal string BinaryExchange
325             {
326                 get { return this.binaryExchange; }
327             }
328 
329             internal string CancelTarget
330             {
331                 get { return this.cancelTarget; }
332             }
333 
334             internal string Claims
335             {
336                 get { return this.claims; }
337             }
338 
339             internal string ComputedKey
340             {
341                 get { return this.computedKey; }
342             }
343 
344             internal string ComputedKeyAlgorithm
345             {
346                 get { return this.computedKeyAlgorithm; }
347             }
348 
349             internal string CanonicalizationAlgorithm
350             {
351                 get { return this.canonicalizationAlgorithm; }
352             }
353 
354             internal string Code
355             {
356                 get { return this.code; }
357             }
358 
359             internal string Delegatable
360             {
361                 get { return this.delegatable; }
362             }
363 
364             internal string DelegateTo
365             {
366                 get { return this.delegateTo; }
367             }
368 
369             internal string Encryption
370             {
371                 get { return this.encryption; }
372             }
373 
374             internal string EncryptionAlgorithm
375             {
376                 get { return this.encryptionAlgorithm; }
377             }
378 
379             internal string EncryptWith
380             {
381                 get { return this.encryptWith; }
382             }
383 
384             internal string Entropy
385             {
386                 get { return this.entropy; }
387             }
388 
389             internal string Forwardable
390             {
391                 get { return this.forwardable; }
392             }
393 
394             internal string Issuer
395             {
396                 get { return this.issuer; }
397             }
398 
399             internal string KeySize
400             {
401                 get { return this.keySize; }
402             }
403 
404             internal string KeyType
405             {
406                 get { return this.keyType; }
407             }
408 
409             internal string Lifetime
410             {
411                 get { return this.lifetime; }
412             }
413 
414             internal string OnBehalfOf
415             {
416                 get { return this.onBehalfOf; }
417             }
418 
419             internal string Participant
420             {
421                 get { return this.participant; }
422             }
423 
424             internal string Participants
425             {
426                 get { return this.participants; }
427             }
428 
429             internal string Primary
430             {
431                 get { return this.primary; }
432             }
433 
434             internal string ProofEncryption
435             {
436                 get { return this.proofEncryption; }
437             }
438 
439             internal string Reason
440             {
441                 get { return this.reason; }
442             }
443 
444             internal string Renewing
445             {
446                 get { return this.renewing; }
447             }
448 
449             internal string RenewTarget
450             {
451                 get { return this.renewTarget; }
452             }
453 
454             internal string RequestedAttachedReference
455             {
456                 get { return this.requestedAttachedReference; }
457             }
458 
459             internal string RequestedProofToken
460             {
461                 get { return this.requestedProofToken; }
462             }
463 
464             internal string RequestedSecurityToken
465             {
466                 get { return this.requestedSecurityToken; }
467             }
468 
469             internal string RequestedTokenCancelled
470             {
471                 get { return this.requestedTokenCancelled; }
472             }
473 
474             internal string RequestedUnattachedReference
475             {
476                 get { return this.requestedUnattachedReference; }
477             }
478 
479             internal string RequestKeySize
480             {
481                 get { return this.requestKeySize; }
482             }
483 
484             internal string RequestSecurityToken
485             {
486                 get { return this.requestSecurityToken; }
487             }
488 
489             internal string RequestSecurityTokenResponse
490             {
491                 get { return this.requestSecurityTokenResponse; }
492             }
493 
494             internal string RequestType
495             {
496                 get { return this.requestType; }
497             }
498 
499             internal string SecurityContextToken
500             {
501                 get { return this.securityContextToken; }
502             }
503 
504             internal string SignWith
505             {
506                 get { return this.signWith; }
507             }
508 
509             internal string SignatureAlgorithm
510             {
511                 get { return this.signatureAlgorithm; }
512             }
513 
514             internal string Status
515             {
516                 get { return this.status; }
517             }
518 
519             internal string TokenType
520             {
521                 get { return this.tokenType; }
522             }
523 
524             internal string UseKey
525             {
526                 get { return this.useKey; }
527             }
528         }
529 
530         internal abstract class WSTrustRequestTypes
531         {
532             internal string Cancel
533             {
534                 get;
535 
536                 set;
537             }
538 
539             internal string Issue
540             {
541                 get;
542 
543                 set;
544             }
545 
546             internal string Renew
547             {
548                 get;
549 
550                 set;
551             }
552 
553             internal string Validate
554             {
555                 get;
556 
557                 set;
558             }
559         }
560 
561         internal abstract class WSTrustKeyTypes
562         {
563             internal string Asymmetric
564             {
565                 get;
566 
567                 set;
568             }
569 
570             internal string Bearer
571             {
572                 get;
573 
574                 set;
575             }
576 
577             internal string Symmetric
578             {
579                 get;
580 
581                 set;
582             }
583         }
584 
585         internal class FaultCodeValues
586         {
587             internal string AuthenticationBadElements
588             {
589                 get { return WSTrustFeb2005Constants.FaultCodeValues.AuthenticationBadElements; }
590             }
591 
592             internal string BadRequest
593             {
594                 get { return WSTrustFeb2005Constants.FaultCodeValues.BadRequest; }
595             }
596 
597             internal string ExpiredData
598             {
599                 get { return WSTrustFeb2005Constants.FaultCodeValues.ExpiredData; }
600             }
601 
602             internal string FailedAuthentication
603             {
604                 get { return WSTrustFeb2005Constants.FaultCodeValues.FailedAuthentication; }
605             }
606 
607             internal string InvalidRequest
608             {
609                 get { return WSTrustFeb2005Constants.FaultCodeValues.InvalidRequest; }
610             }
611 
612             internal string InvalidScope
613             {
614                 get { return WSTrustFeb2005Constants.FaultCodeValues.InvalidScope; }
615             }
616 
617             internal string InvalidSecurityToken
618             {
619                 get { return WSTrustFeb2005Constants.FaultCodeValues.InvalidSecurityToken; }
620             }
621 
622             internal string InvalidTimeRange
623             {
624                 get { return WSTrustFeb2005Constants.FaultCodeValues.InvalidTimeRange; }
625             }
626 
627             internal string RenewNeeded
628             {
629                 get { return WSTrustFeb2005Constants.FaultCodeValues.RenewNeeded; }
630             }
631 
632             internal string RequestFailed
633             {
634                 get { return WSTrustFeb2005Constants.FaultCodeValues.RequestFailed; }
635             }
636 
637             internal string UnableToRenew
638             {
639                 get { return WSTrustFeb2005Constants.FaultCodeValues.UnableToRenew; }
640             }
641         }
642     }
643 }
644