[mini]Add test for PtrToStruct<T>
[mono.git] / mcs / class / corlib / System.Security.Principal / WindowsIdentity.cs
index 7f2eef3e1e4eb098e1f5fb239ec01cc833d4bdf7..a36af1be59ec9ee899b61c8e938998a63906a2c8 100644 (file)
@@ -33,6 +33,8 @@ using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using System.Runtime.Serialization;
 using System.Security.Permissions;
+using System.Security.Claims;
+using Microsoft.Win32.SafeHandles;
 
 namespace System.Security.Principal {
 
@@ -113,6 +115,15 @@ namespace System.Security.Principal {
                        _info = info;
                }
 
+               internal WindowsIdentity (ClaimsIdentity claimsIdentity, IntPtr userToken)
+                       : base (claimsIdentity)
+               {
+                       if (userToken != IntPtr.Zero && userToken.ToInt64() > 0)
+                       {
+                               SetToken (userToken);
+                       }
+               }
+
                [ComVisible (false)]
                public void Dispose ()
                {
@@ -172,6 +183,18 @@ namespace System.Security.Principal {
                        return new WindowsImpersonationContext (userToken);
                }
 
+               [SecuritySafeCritical]
+               public static void RunImpersonated (SafeAccessTokenHandle safeAccessTokenHandle, Action action)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [SecuritySafeCritical]
+               public static T RunImpersonated<T> (SafeAccessTokenHandle safeAccessTokenHandle, Func<T> func)
+               {
+                       throw new NotImplementedException ();
+               }
+
                // properties
                sealed override
                public string AuthenticationType {
@@ -269,6 +292,16 @@ namespace System.Security.Principal {
                        info.AddValue ("m_isAuthenticated", _authenticated);
                }
 
+               internal ClaimsIdentity CloneAsBase ()
+               {
+                       return base.Clone();
+               }
+
+               internal IntPtr GetTokenInternal ()
+               {
+                       return _token;
+               }
+
                private void SetToken (IntPtr token) 
                {
                        if (Environment.IsUnix) {
@@ -292,6 +325,10 @@ namespace System.Security.Principal {
                        }
                }
 
+               public SafeAccessTokenHandle AccessToken {
+                       get { throw new NotImplementedException (); }
+               }
+
                // see mono/mono/metadata/security.c for implementation
 
                // Many people use reflection to get a user's roles - so many