ClientCredentials.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. //
  2. // ClientCredentials.cs
  3. //
  4. // Author:
  5. // Atsushi Enomoto <[email protected]>
  6. //
  7. // Copyright (C) 2005-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. using System;
  29. using System.Collections.Generic;
  30. using System.IdentityModel.Selectors;
  31. using System.IdentityModel.Tokens;
  32. using System.ServiceModel.Channels;
  33. using System.ServiceModel.Description;
  34. using System.ServiceModel.Dispatcher;
  35. using System.ServiceModel.Security;
  36. using System.ServiceModel.Security.Tokens;
  37. namespace System.ServiceModel.Description
  38. {
  39. public class ClientCredentials
  40. : SecurityCredentialsManager, IEndpointBehavior
  41. {
  42. public ClientCredentials ()
  43. {
  44. }
  45. [MonoTODO]
  46. protected ClientCredentials (ClientCredentials source)
  47. {
  48. throw new NotImplementedException ();
  49. }
  50. IssuedTokenClientCredential issued_token =
  51. new IssuedTokenClientCredential ();
  52. HttpDigestClientCredential digest =
  53. new HttpDigestClientCredential ();
  54. X509CertificateInitiatorClientCredential initiator =
  55. new X509CertificateInitiatorClientCredential ();
  56. X509CertificateRecipientClientCredential recipient =
  57. new X509CertificateRecipientClientCredential ();
  58. UserNamePasswordClientCredential userpass =
  59. new UserNamePasswordClientCredential ();
  60. WindowsClientCredential windows =
  61. new WindowsClientCredential ();
  62. PeerCredential peer = new PeerCredential ();
  63. bool support_interactive = true;
  64. public X509CertificateInitiatorClientCredential ClientCertificate {
  65. get { return initiator; }
  66. }
  67. public HttpDigestClientCredential HttpDigest {
  68. get { return digest; }
  69. }
  70. public IssuedTokenClientCredential IssuedToken {
  71. get { return issued_token; }
  72. }
  73. public PeerCredential Peer {
  74. get { return peer; }
  75. }
  76. public X509CertificateRecipientClientCredential ServiceCertificate {
  77. get { return recipient; }
  78. }
  79. public bool SupportInteractive {
  80. get { return support_interactive; }
  81. set { support_interactive = value; }
  82. }
  83. public UserNamePasswordClientCredential UserName {
  84. get { return userpass; }
  85. }
  86. public WindowsClientCredential Windows {
  87. get { return windows; }
  88. }
  89. public ClientCredentials Clone ()
  90. {
  91. ClientCredentials ret = CloneCore ();
  92. if (ret.GetType () != GetType ())
  93. throw new NotImplementedException ("CloneCore() must be implemented to return an instance of the same type in this custom ClientCredentials type.");
  94. return ret;
  95. }
  96. protected virtual ClientCredentials CloneCore ()
  97. {
  98. return new ClientCredentials (this);
  99. }
  100. public override SecurityTokenManager CreateSecurityTokenManager ()
  101. {
  102. return new ClientCredentialsSecurityTokenManager (this);
  103. }
  104. [MonoTODO]
  105. protected virtual SecurityToken GetInfoCardSecurityToken (
  106. bool requiresInfoCard, CardSpacePolicyElement [] chain,
  107. SecurityTokenSerializer tokenSerializer)
  108. {
  109. throw new NotImplementedException ();
  110. }
  111. [MonoTODO]
  112. void IEndpointBehavior.AddBindingParameters (ServiceEndpoint endpoint,
  113. BindingParameterCollection parameters)
  114. {
  115. parameters.Add (this);
  116. }
  117. [MonoTODO]
  118. void IEndpointBehavior.ApplyDispatchBehavior (ServiceEndpoint endpoint,
  119. EndpointDispatcher dispatcher)
  120. {
  121. throw new NotImplementedException ();
  122. }
  123. [MonoTODO]
  124. void IEndpointBehavior.ApplyClientBehavior (
  125. ServiceEndpoint endpoint, ClientRuntime behavior)
  126. {
  127. //throw new NotImplementedException ();
  128. }
  129. [MonoTODO]
  130. void IEndpointBehavior.Validate (ServiceEndpoint endpoint)
  131. {
  132. throw new NotImplementedException ();
  133. }
  134. }
  135. }