2008-11-18 Marek Habersack <mhabersack@novell.com>
[mono.git] / mcs / class / System.Web / System.Web.Security / WindowsAuthenticationEventArgs.cs
index c7c62f6e1f58244cac4a3408903f31c78ed7375a..519ab293bf652ded838d5b134ac7d4ab3cd0c81f 100644 (file)
@@ -1,60 +1,76 @@
-/**\r
- * Namespace: System.Web.Security\r
- * Class:     WindowsAuthenticationEventArgs\r
- *\r
- * Author:  Gaurav Vaish\r
- * Maintainer: gvaish@iitk.ac.in\r
- * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>\r
- * Implementation: yes\r
- * Status:  90%\r
- *\r
- * (C) Gaurav Vaish (2002)\r
- */\r
-\r
-using System;\r
-using System.Web;\r
-using System.Security.Principal;\r
-\r
-namespace System.Web.Security\r
-{\r
-       public sealed class WindowsAuthenticationEventArgs : EventArgs\r
-       {\r
-               HttpContext      context;\r
-               WindowsIdentity identity;\r
-               IPrincipal       user;\r
-\r
-               public WindowsAuthenticationEventArgs(WindowsIdentity identity, HttpContext context)\r
-               {\r
-                       this.context = context;\r
-               }\r
-\r
-               public HttpContext Context\r
-               {\r
-                       get\r
-                       {\r
-                               return context;\r
-                       }\r
-               }\r
-\r
-               public WindowsIdentity Identity\r
-               {\r
-                       get\r
-                       {\r
-                               return identity;\r
-                       }\r
-               }\r
-\r
-               [MonoTODO]\r
-               public IPrincipal User\r
-               {\r
-                       get\r
-                       {\r
-                               return user;\r
-                       }\r
-                       set\r
-                       {\r
-                               throw new NotImplementedException();\r
-                       }\r
-               }\r
-       }\r
-}\r
+//
+// System.Web.Security.WindowsAuthenticationEventArgs
+//
+// Authors:
+//     Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Security.Permissions;
+using System.Security.Principal;
+
+namespace System.Web.Security
+{
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       public sealed class WindowsAuthenticationEventArgs : EventArgs
+       {
+               WindowsIdentity identity;
+               HttpContext context;
+               IPrincipal user;
+
+               public WindowsAuthenticationEventArgs (WindowsIdentity identity, HttpContext context)
+               {
+                       this.identity = identity;
+                       this.context = context;
+               }
+
+               public System.Web.HttpContext Context
+               {
+                       get {
+                               return context;
+                       }
+               }
+
+               public WindowsIdentity Identity
+               {
+                       get {
+                               return identity;
+                       }
+               }
+
+               public IPrincipal User
+               {
+                       get {
+                               return user;
+                       }
+
+                       [SecurityPermission (SecurityAction.Demand, ControlPrincipal = true)]
+                       set {
+                               user = value;
+                       }
+               }
+       }
+}
+