SecurityTokenHandlerCollection.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. //
  2. // SecurityTokenHandlerCollection.cs
  3. //
  4. // Author:
  5. // Noesis Labs ([email protected])
  6. //
  7. // Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.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. #if NET_4_5
  29. using System;
  30. using System.Collections.Generic;
  31. using System.Collections.ObjectModel;
  32. using System.IdentityModel.Selectors;
  33. using System.Security.Claims;
  34. using System.Xml;
  35. namespace System.IdentityModel.Tokens
  36. {
  37. public class SecurityTokenHandlerCollection : Collection<SecurityTokenHandler>
  38. {
  39. private SecurityTokenHandlerConfiguration config;
  40. private IEnumerable<string> tokenTypeIdentifiers = new List<string> ();
  41. private IEnumerable<Type> tokenTypes = new List<Type> ();
  42. public SecurityTokenHandlerConfiguration Configuration { get { return this.config; } }
  43. public IEnumerable<string> TokenTypeIdentifiers { get { return tokenTypeIdentifiers; } }
  44. public IEnumerable<Type> TokenTypes { get { return tokenTypes; } }
  45. public SecurityTokenHandler this[SecurityToken token] {
  46. get {
  47. if (token == null) { return null; }
  48. return this[token.GetType ()];
  49. }
  50. }
  51. [MonoTODO]
  52. public SecurityTokenHandler this[string tokenTypeIdentifier] {
  53. get {
  54. throw new NotImplementedException ();
  55. }
  56. }
  57. [MonoTODO]
  58. public SecurityTokenHandler this[Type tokenType] {
  59. get {
  60. throw new NotImplementedException ();
  61. }
  62. }
  63. public SecurityTokenHandlerCollection ()
  64. : this(new SecurityTokenHandlerConfiguration ())
  65. { }
  66. public SecurityTokenHandlerCollection (SecurityTokenHandlerConfiguration configuration) {
  67. config = configuration;
  68. }
  69. public SecurityTokenHandlerCollection (IEnumerable<SecurityTokenHandler> handlers)
  70. : this (handlers, new SecurityTokenHandlerConfiguration ())
  71. { }
  72. public SecurityTokenHandlerCollection (IEnumerable<SecurityTokenHandler> handlers, SecurityTokenHandlerConfiguration configuration) : this (configuration) {
  73. foreach (var handler in handlers) {
  74. Add (handler);
  75. }
  76. }
  77. [MonoTODO]
  78. public void AddOrReplace(SecurityTokenHandler handler) {
  79. throw new NotImplementedException ();
  80. }
  81. [MonoTODO]
  82. public bool CanReadKeyIdentifierClause(XmlReader reader) {
  83. throw new NotImplementedException ();
  84. }
  85. [MonoTODO]
  86. protected virtual bool CanReadKeyIdentifierClauseCore(XmlReader reader) {
  87. throw new NotImplementedException ();
  88. }
  89. [MonoTODO]
  90. public bool CanReadToken(string tokenString) {
  91. throw new NotImplementedException ();
  92. }
  93. [MonoTODO]
  94. public bool CanReadToken(XmlReader reader) {
  95. throw new NotImplementedException ();
  96. }
  97. [MonoTODO]
  98. public bool CanWriteToken(SecurityToken token) {
  99. throw new NotImplementedException ();
  100. }
  101. [MonoTODO]
  102. protected override void ClearItems() {
  103. throw new NotImplementedException ();
  104. }
  105. [MonoTODO]
  106. public static SecurityTokenHandlerCollection CreateDefaultSecurityTokenHandlerCollection() {
  107. throw new NotImplementedException ();
  108. }
  109. [MonoTODO]
  110. public static SecurityTokenHandlerCollection CreateDefaultSecurityTokenHandlerCollection(SecurityTokenHandlerConfiguration configuration) {
  111. throw new NotImplementedException ();
  112. }
  113. [MonoTODO]
  114. public SecurityToken CreateToken(SecurityTokenDescriptor tokenDescriptor) {
  115. throw new NotImplementedException ();
  116. }
  117. [MonoTODO]
  118. protected override void InsertItem(int index, SecurityTokenHandler item) {
  119. throw new NotImplementedException ();
  120. }
  121. [MonoTODO]
  122. public SecurityKeyIdentifierClause ReadKeyIdentifierClause(XmlReader reader) {
  123. throw new NotImplementedException ();
  124. }
  125. [MonoTODO]
  126. protected virtual SecurityKeyIdentifierClause ReadKeyIdentifierClauseCore(XmlReader reader) {
  127. throw new NotImplementedException ();
  128. }
  129. [MonoTODO]
  130. public SecurityToken ReadToken(string tokenString) {
  131. throw new NotImplementedException ();
  132. }
  133. [MonoTODO]
  134. public SecurityToken ReadToken(XmlReader reader) {
  135. throw new NotImplementedException ();
  136. }
  137. [MonoTODO]
  138. protected override void RemoveItem(int index) {
  139. throw new NotImplementedException ();
  140. }
  141. [MonoTODO]
  142. protected override void SetItem(int index, SecurityTokenHandler item) {
  143. throw new NotImplementedException ();
  144. }
  145. [MonoTODO]
  146. public ReadOnlyCollection<ClaimsIdentity> ValidateToken(SecurityToken token) {
  147. throw new NotImplementedException ();
  148. }
  149. [MonoTODO]
  150. public void WriteKeyIdentifierClause(XmlWriter writer, SecurityKeyIdentifierClause keyIdentifierClause) {
  151. throw new NotImplementedException ();
  152. }
  153. [MonoTODO]
  154. protected virtual void WriteKeyIdentifierClauseCore(XmlWriter writer, SecurityKeyIdentifierClause keyIdentifierClause) {
  155. throw new NotImplementedException ();
  156. }
  157. [MonoTODO]
  158. public string WriteToken(SecurityToken token) {
  159. throw new NotImplementedException ();
  160. }
  161. [MonoTODO]
  162. public void WriteToken(XmlWriter writer, SecurityToken token) {
  163. throw new NotImplementedException ();
  164. }
  165. }
  166. }
  167. #endif