* ToolTask.cs (ProcessOuputTool): Move logging of tool
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / AuthorizationSection.cs
index c20b8d319404d6f3b4db18cdae8757bf6a8ae6bb..521620a3994def766f087a08d1f9fe19e0e3d073 100644 (file)
@@ -43,7 +43,7 @@ namespace System.Web.Configuration {
 
                static AuthorizationSection ()
                {
-                       rulesProp = new ConfigurationProperty ("", typeof (AuthorizationRuleCollection), null,
+                       rulesProp = new ConfigurationProperty (String.Empty, typeof (AuthorizationRuleCollection), null,
                                                               null, PropertyHelper.DefaultValidator,
                                                               ConfigurationPropertyOptions.IsDefaultCollection);
                        properties = new ConfigurationPropertyCollection ();
@@ -51,7 +51,6 @@ namespace System.Web.Configuration {
                        properties.Add (rulesProp);
                }
 
-               [MonoTODO]
                protected override void PostDeserialize()
                {
                        base.PostDeserialize ();
@@ -69,11 +68,12 @@ namespace System.Web.Configuration {
 
                internal bool IsValidUser (IPrincipal user, string verb)
                {
+                       string username = (user == null) ? String.Empty : user.Identity.Name;
                        foreach (AuthorizationRule rule in Rules) {
-                               if (!rule.CheckVerb (verb))
+                               if (rule.Verbs.Count != 0 && !rule.CheckVerb (verb))
                                        continue;
 
-                               if (rule.CheckUser (user.Identity.Name) || rule.CheckRole(user))
+                               if (rule.CheckUser (username) || (user != null && rule.CheckRole(user)))
                                        return (rule.Action == AuthorizationRuleAction.Allow);
                        }