Fill a couple of missing ServiceAuthorizationElement implementation.
authorAtsushi Eno <atsushi@ximian.com>
Thu, 17 Feb 2011 12:05:32 +0000 (21:05 +0900)
committerAtsushi Eno <atsushi@ximian.com>
Thu, 17 Feb 2011 12:05:32 +0000 (21:05 +0900)
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ServiceAuthorizationElement.cs

index 8564cebff2e10b6155237384a772fb5b2935b3cb..b140c784de2e9ac1bc99e1f76a3d42d5e11d1967 100644 (file)
@@ -117,10 +117,34 @@ namespace System.ServiceModel.Configuration
                }
 
                [MonoTODO]
-               protected internal override object CreateBehavior () {
-                       throw new NotImplementedException ();
-               }
+               protected internal override object CreateBehavior ()
+               {
+                       var b = new ServiceAuthorizationBehavior ();
+                       if (!String.IsNullOrEmpty (ServiceAuthorizationManagerType))
+                               b.ServiceAuthorizationManager = (ServiceAuthorizationManager) Activator.CreateInstance (ConfigUtil.GetTypeFromConfigString (ServiceAuthorizationManagerType));
+
+                       foreach (var apte in AuthorizationPolicies)
+                               throw new NotImplementedException ();
+
+                       if (!String.IsNullOrEmpty (RoleProviderName))
+                               throw new NotImplementedException ();
 
+                       b.ImpersonateCallerForAllOperations = ImpersonateCallerForAllOperations;
+                       b.PrincipalPermissionMode = PrincipalPermissionMode;
+
+                       return b;
+               }
+               
+               public override void CopyFrom (ServiceModelExtensionElement from)
+               {
+                       var e = (ServiceAuthorizationElement) from;
+                       foreach (AuthorizationPolicyTypeElement ae in e.AuthorizationPolicies)
+                               AuthorizationPolicies.Add (new AuthorizationPolicyTypeElement (ae.PolicyType));
+                       ImpersonateCallerForAllOperations = e.ImpersonateCallerForAllOperations;
+                       PrincipalPermissionMode = e.PrincipalPermissionMode;
+                       RoleProviderName = e.RoleProviderName;
+                       ServiceAuthorizationManagerType = e.ServiceAuthorizationManagerType;
+               }
        }
 
 }