[sgen] Make sure we don't sweep a block if we're not supposed to
[mono.git] / mcs / class / System.ServiceModel / System.ServiceModel.Description / ClientCredentials.cs
index 04db9f0240ac0325c0d2f44f53a8a7c9f9ec9849..4314c221857dbd41ee6dbd70cbdd1e00b6d785ee 100644 (file)
 //
 using System;
 using System.Collections.Generic;
-using System.IdentityModel.Selectors;
-using System.IdentityModel.Tokens;
 using System.ServiceModel.Channels;
 using System.ServiceModel.Description;
 using System.ServiceModel.Dispatcher;
 using System.ServiceModel.Security;
+#if !MOBILE
+using System.IdentityModel.Selectors;
+using System.IdentityModel.Tokens;
 using System.ServiceModel.Security.Tokens;
+#endif
 
 namespace System.ServiceModel.Description
 {
        public class ClientCredentials
+#if MOBILE || XAMMAC_4_5
+               : IEndpointBehavior
+#else
                : SecurityCredentialsManager, IEndpointBehavior
+#endif
        {
                public ClientCredentials ()
                {
@@ -47,23 +53,29 @@ namespace System.ServiceModel.Description
                [MonoTODO]
                protected ClientCredentials (ClientCredentials source)
                {
-                       throw new NotImplementedException ();
+                       userpass = source.userpass.Clone ();
+                       digest = source.digest.Clone ();
+                       initiator = source.initiator.Clone ();
+                       recipient = source.recipient.Clone ();
+                       windows = source.windows.Clone ();
+#if !MOBILE
+                       issued_token = source.issued_token.Clone ();
+                       peer = source.peer.Clone ();
+                       support_interactive = source.support_interactive;
+#endif
                }
 
-               IssuedTokenClientCredential issued_token =
-                       new IssuedTokenClientCredential ();
+               UserNamePasswordClientCredential userpass =
+                       new UserNamePasswordClientCredential ();
+
                HttpDigestClientCredential digest =
                        new HttpDigestClientCredential ();
                X509CertificateInitiatorClientCredential initiator =
                        new X509CertificateInitiatorClientCredential ();
                X509CertificateRecipientClientCredential recipient =
                        new X509CertificateRecipientClientCredential ();
-               UserNamePasswordClientCredential userpass =
-                       new UserNamePasswordClientCredential ();
                WindowsClientCredential windows =
                        new WindowsClientCredential ();
-               PeerCredential peer = new PeerCredential ();
-               bool support_interactive = true;
 
                public X509CertificateInitiatorClientCredential ClientCertificate {
                        get { return initiator; }
@@ -73,6 +85,20 @@ namespace System.ServiceModel.Description
                        get { return digest; }
                }
 
+               public X509CertificateRecipientClientCredential ServiceCertificate {
+                       get { return recipient; }
+               }
+
+               public WindowsClientCredential Windows {
+                       get { return windows; }
+               }
+
+#if !MOBILE
+               IssuedTokenClientCredential issued_token =
+                       new IssuedTokenClientCredential ();
+               PeerCredential peer = new PeerCredential ();
+               bool support_interactive = true;
+
                public IssuedTokenClientCredential IssuedToken {
                        get { return issued_token; }
                }
@@ -81,23 +107,16 @@ namespace System.ServiceModel.Description
                        get { return peer; }
                }
 
-               public X509CertificateRecipientClientCredential ServiceCertificate {
-                       get { return recipient; }
-               }
-
                public bool SupportInteractive {
                        get { return support_interactive; }
                        set { support_interactive = value; }
                }
+#endif
 
                public UserNamePasswordClientCredential UserName {
                        get { return userpass; }
                }
 
-               public WindowsClientCredential Windows {
-                       get { return windows; }
-               }
-
                public ClientCredentials Clone ()
                {
                        ClientCredentials ret = CloneCore ();
@@ -111,6 +130,7 @@ namespace System.ServiceModel.Description
                        return new ClientCredentials (this);
                }
 
+#if !MOBILE && !XAMMAC_4_5
                public override SecurityTokenManager CreateSecurityTokenManager ()
                {
                        return new ClientCredentialsSecurityTokenManager (this);
@@ -123,32 +143,35 @@ namespace System.ServiceModel.Description
                {
                        throw new NotImplementedException ();
                }
+#endif
 
-               [MonoTODO]
-               void IEndpointBehavior.AddBindingParameters (ServiceEndpoint endpoint,
-                       BindingParameterCollection parameters)
+               void IEndpointBehavior.ApplyDispatchBehavior (ServiceEndpoint endpoint,
+                       EndpointDispatcher dispatcher)
                {
-                       parameters.Add (this);
+                       // documented as to have no effect.
                }
 
-               [MonoTODO]
-               void IEndpointBehavior.ApplyDispatchBehavior (ServiceEndpoint endpoint,
-                       EndpointDispatcher dispatcher)
+               void IEndpointBehavior.AddBindingParameters (ServiceEndpoint endpoint,
+                       BindingParameterCollection parameters)
                {
-                       throw new NotImplementedException ();
+                       parameters.Add (this);
                }
 
                [MonoTODO]
-               void IEndpointBehavior.ApplyClientBehavior (
+               public virtual void ApplyClientBehavior (
                        ServiceEndpoint endpoint, ClientRuntime behavior)
                {
-                       //throw new NotImplementedException ();
+                       if (endpoint == null)
+                               throw new ArgumentNullException ("endpoint");
+                       if (behavior == null)
+                               throw new ArgumentNullException ("behavior");
+
+                       // FIXME: apply to endpoint when there is not security binding element.
                }
 
-               [MonoTODO]
                void IEndpointBehavior.Validate (ServiceEndpoint endpoint)
                {
-                       throw new NotImplementedException ();
+                       // documented as reserved for future use.
                }
        }
 }