Ejemplo n.º 1
0
 public static extern bool AuthzInitializeResourceManager(
     AuthzResourceManagerFlags flags,
     PFN_AUTHZ_DYNAMIC_ACCESS_CHECK pfnAccessCheck,
     PFN_AUTHZ_COMPUTE_DYNAMIC_GROUPS pfnComputeDynamicGroups,
     PFN_AUTHZ_FREE_DYNAMIC_GROUPS pfnFreeDynamicGroups,
     string szResourceManagerName,
     out SafeAuthzRMHandle phAuthzResourceManager);
Ejemplo n.º 2
0
 public static extern bool AuthzInitializeContextFromSid(
     AuthzInitFlags flags,
     byte[] rawUserSid,
     SafeAuthzRMHandle authzRM,
     PLARGE_INTEGER expirationTime,
     LUID Identifier,
     LPVOID DynamicGroupArgs,
     out SafeAuthzContextHandle authzClientContext);
Ejemplo n.º 3
0
 public static extern bool AuthzInitializeContextFromSid(
     AuthzInitFlags flags,
     byte[] rawUserSid,
     SafeAuthzRMHandle authzRM,
     PLARGE_INTEGER expirationTime,
     LUID Identifier,
     LPVOID DynamicGroupArgs,
     out SafeAuthzContextHandle authzClientContext);
        private SafeAuthzContextHandle InitializeContextFromSid(SafeAuthzRMHandle authzRM, IdentityReference identity)
        {
            // Create the context for the user
            var securityIdentifier = (SecurityIdentifier) identity.Translate(typeof (SecurityIdentifier));
            var rawSid = new byte[securityIdentifier.BinaryLength];
            securityIdentifier.GetBinaryForm(rawSid, 0);

            SafeAuthzContextHandle userClientCtxt;
            if (!NativeMethods.AuthzInitializeContextFromSid(
                NativeMethods.AuthzInitFlags.Default,
                rawSid,
                authzRM,
                IntPtr.Zero,
                NativeMethods.LUID.NullLuid,
                IntPtr.Zero,
                out userClientCtxt))
            {
                throw new Win32Exception(Marshal.GetLastWin32Error());
            }

            return userClientCtxt;
        }
Ejemplo n.º 5
0
 public static extern bool AuthzInitializeResourceManager(
     AuthzResourceManagerFlags flags,
     PFN_AUTHZ_DYNAMIC_ACCESS_CHECK pfnAccessCheck,
     PFN_AUTHZ_COMPUTE_DYNAMIC_GROUPS pfnComputeDynamicGroups,
     PFN_AUTHZ_FREE_DYNAMIC_GROUPS pfnFreeDynamicGroups,
     string szResourceManagerName,
     out SafeAuthzRMHandle phAuthzResourceManager);