예제 #1
0
        private static ObjectSecurity GetPipeSecurity(PipeStream pipeStream)
        {
#if NETSTANDARD1_3
            return((ObjectSecurity)typeof(PipeStream)
                   .GetTypeInfo()
                   .GetDeclaredMethod("GetAccessControl")
                   ?.Invoke(pipeStream, parameters: null));
#else
            return(pipeStream.GetAccessControl());
#endif
        }
예제 #2
0
        static void AddDenyEveryone(PipeStream stream)
        {
            PipeAccessRule rule; PipeSecurity security;
            AuthorizationRuleCollection inRules, outRules;

            // Let's add a Deny for Everyone.
            security = stream.GetAccessControl();

            inRules = security.GetAccessRules(true, false, typeof(SecurityIdentifier));
            Assert.AreNotEqual(0, inRules.Count);

            rule = new PipeAccessRule(new SecurityIdentifier("WD"),
                                      PipeAccessRights.FullControl,
                                      AccessControlType.Deny);
            security.AddAccessRule(rule);
            stream.SetAccessControl(security);

            security = stream.GetAccessControl();
            outRules = security.GetAccessRules(true, false, typeof(SecurityIdentifier));
            Assert.AreEqual(inRules.Count + 1, outRules.Count);
        }
예제 #3
0
파일: Client.cs 프로젝트: tahajahangir/sdk
 private static ObjectSecurity GetPipeSecurity(PipeStream pipeStream)
 {
     return(pipeStream.GetAccessControl());
 }