Line data Source code
1 : #region Copyright
2 : // // -----------------------------------------------------------------------
3 : // // <copyright company="cdmdotnet Limited">
4 : // // Copyright cdmdotnet Limited. All rights reserved.
5 : // // </copyright>
6 : // // -----------------------------------------------------------------------
7 : #endregion
8 :
9 : using System;
10 : using System.Runtime.Serialization;
11 : using System.Xml;
12 : using Cqrs.Services;
13 :
14 : namespace Cqrs.Authentication
15 : {
16 : public class SingleSignOnTokenResolver : ISingleSignOnTokenResolver
17 0 : {
18 : #region Implementation of IServiceParameterResolver
19 :
20 0 : public virtual bool TryResolveType(Type dataContractType, Type declaredType, DataContractResolver knownTypeResolver, out XmlDictionaryString typeName, out XmlDictionaryString typeNamespace)
21 : {
22 : if (dataContractType == typeof(SingleSignOnTokenWithUserRsnAndCompanyRsn))
23 : {
24 : XmlDictionary dictionary = new XmlDictionary();
25 : typeName = dictionary.Add("SingleSignOnTokenWithUserAndCompanyRsn");
26 : typeNamespace = dictionary.Add("https://getcqrs.net");
27 : return true;
28 : }
29 :
30 : if (dataContractType == typeof(SingleSignOnTokenWithUserRsn))
31 : {
32 : XmlDictionary dictionary = new XmlDictionary();
33 : typeName = dictionary.Add("SingleSignOnTokenWithUserRsn");
34 : typeNamespace = dictionary.Add("https://getcqrs.net");
35 : return true;
36 : }
37 :
38 : if (dataContractType == typeof(SingleSignOnTokenWithCompanyRsn))
39 : {
40 : XmlDictionary dictionary = new XmlDictionary();
41 : typeName = dictionary.Add("SingleSignOnTokenWithCompanyRsn");
42 : typeNamespace = dictionary.Add("https://getcqrs.net");
43 : return true;
44 : }
45 :
46 : if (dataContractType == typeof(SingleSignOnToken))
47 : {
48 : XmlDictionary dictionary = new XmlDictionary();
49 : typeName = dictionary.Add("SingleSignOnToken");
50 : typeNamespace = dictionary.Add("https://getcqrs.net");
51 : return true;
52 : }
53 :
54 : typeName = null;
55 : typeNamespace = null;
56 : return false;
57 : }
58 :
59 0 : public virtual Type ResolveName(string typeName, string typeNamespace, Type declaredType, DataContractResolver knownTypeResolver)
60 : {
61 : switch (typeNamespace)
62 : {
63 : case "https://getcqrs.net":
64 : switch (typeName)
65 : {
66 : case "SingleSignOnToken":
67 : return typeof(SingleSignOnToken);
68 : case "SingleSignOnTokenWithCompanyRsn":
69 : return typeof(SingleSignOnTokenWithCompanyRsn);
70 : case "SingleSignOnTokenWithUserRsn":
71 : return typeof(SingleSignOnTokenWithUserRsn);
72 : case "SingleSignOnTokenWithUserAndCompanyRsn":
73 : return typeof(SingleSignOnTokenWithUserRsnAndCompanyRsn);
74 : }
75 : break;
76 : }
77 :
78 : return null;
79 : }
80 :
81 : #endregion
82 : }
83 : }
|