当前位置: 首页>>代码示例>>C#>>正文


C# AccessControl.CommonSecurityDescriptor类代码示例

本文整理汇总了C#中System.Security.AccessControl.CommonSecurityDescriptor的典型用法代码示例。如果您正苦于以下问题:C# CommonSecurityDescriptor类的具体用法?C# CommonSecurityDescriptor怎么用?C# CommonSecurityDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CommonSecurityDescriptor类属于System.Security.AccessControl命名空间,在下文中一共展示了CommonSecurityDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ObjectSecurity

 protected ObjectSecurity( bool isContainer, bool isDS )
     : this()
 {
     // we will create an empty DACL, denying anyone any access as the default. 5 is the capacity.
     DiscretionaryAcl dacl = new DiscretionaryAcl(isContainer, isDS, 5);
      _securityDescriptor = new CommonSecurityDescriptor( isContainer, isDS, ControlFlags.None, null, null, null, dacl );
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:7,代码来源:ObjectSecurity.cs

示例2: GetBinaryForm

		public void GetBinaryForm ()
		{
			CommonSecurityDescriptor csd = new CommonSecurityDescriptor
				(false, false, ControlFlags.None, null, null, null, null);

			Assert.AreEqual (20, csd.BinaryLength);
			byte[] binaryForm = new byte[csd.BinaryLength];
			csd.GetBinaryForm (binaryForm, 0);

			Assert.AreEqual (ControlFlags.DiscretionaryAclPresent | ControlFlags.SelfRelative,
			                 csd.ControlFlags);

			// The default 'Allow Everyone Full Access' serializes as NOT having a
			// DiscretionaryAcl, as the above demonstrates (byte 3 is 0 not 4).
			Assert.AreEqual (new byte[20] {
				1, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
			}, binaryForm);

			// Changing SystemAcl protection does nothing special.
			csd.SetSystemAclProtection (true, true);
			Assert.AreEqual (20, csd.BinaryLength);

			// Modifying the DiscretionaryAcl (even effective no-ops like this) causes serialization.
			csd.SetDiscretionaryAclProtection (false, true);
			Assert.AreEqual (48, csd.BinaryLength);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:26,代码来源:CommonSecurityDescriptorTest.cs

示例3: NativeObjectSecurity

		internal NativeObjectSecurity (CommonSecurityDescriptor securityDescriptor, ResourceType resourceType)
			: base (securityDescriptor)
		{
#if !MOBILE			
			resource_type = resourceType;
#endif
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:7,代码来源:NativeObjectSecurity.cs

示例4: ObjectSecurity

		internal ObjectSecurity (CommonSecurityDescriptor securityDescriptor)
		{
			if (securityDescriptor == null)
				throw new ArgumentNullException ("securityDescriptor");
				
			descriptor = securityDescriptor;
			rw_lock = new ReaderWriterLock ();
		}
开发者ID:nicolas-raoul,项目名称:mono,代码行数:8,代码来源:ObjectSecurity.cs

示例5: IpcStore

 static IpcStore()
 {
     var dacl = new DiscretionaryAcl(false, false, 1);
     dacl.AddAccess(AccessControlType.Allow, new SecurityIdentifier(WellKnownSidType.CreatorOwnerSid, null), -1, InheritanceFlags.None, PropagationFlags.None);
     dacl.AddAccess(AccessControlType.Allow, new SecurityIdentifier(WellKnownSidType.BuiltinUsersSid, null), -1, InheritanceFlags.None, PropagationFlags.None);
     dacl.AddAccess(AccessControlType.Allow, new SecurityIdentifier(WellKnownSidType.LocalSystemSid, null), -1, InheritanceFlags.None, PropagationFlags.None);
     IpcAcl = new CommonSecurityDescriptor(false, false, ControlFlags.GroupDefaulted | ControlFlags.OwnerDefaulted | ControlFlags.DiscretionaryAclPresent, null, null, null, dacl);
 }
开发者ID:0install,项目名称:0install-win,代码行数:8,代码来源:IpcStore.Connection.cs

示例6: ObjectSecurity

 internal ObjectSecurity(CommonSecurityDescriptor securityDescriptor) : this()
 {
     if (securityDescriptor == null)
     {
         throw new ArgumentNullException("securityDescriptor");
     }
     this._securityDescriptor = securityDescriptor;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:ObjectSecurity.cs

示例7: SecurityDescriptorResolver_ComputeHash_W2016_Vector2

        public void SecurityDescriptorResolver_ComputeHash_W2016_Vector2()
        {
            byte[] binarySecurityDescriptor = "0f00000001000480300000003c000000000000001400000002001c000100000000031400ffffffff010100000000000100000000010100000000000100000000010100000000000100000000".HexToBinary();
            byte[] expectedHash = "5763e6665429964b143bb464463bf068".HexToBinary();

            var securityDescriptor = new CommonSecurityDescriptor(true, true, binarySecurityDescriptor, 0);
            byte[] hash = SecurityDescriptorRersolver.ComputeHash(securityDescriptor);
            Assert.AreEqual(true, expectedHash.SequenceEqual(hash));
        }
开发者ID:deimx42,项目名称:DSInternals,代码行数:9,代码来源:SecurityDescriptorResolverTester.cs

示例8: SecurityDescriptorResolver_ComputeHash_W2016_Vector1

        public void SecurityDescriptorResolver_ComputeHash_W2016_Vector1()
        {
            byte[] binarySecurityDescriptor = "01001480e802000004030000140000009400000004008000040000000240140020000c0001010000000000010000000002401800000100000102000000000005200000002002000002402400000100000105000000000005150000004dfc5019daac02ace33e5bc6010200000740280000010000010000005651ec457edbbb47b53fdbeb2d03c40f010100000000000100000000040054020f000000050028000001000001000000aaf63111079cd111f79f00c04fc2dcd2010100000000000509000000050028000001000001000000abf63111079cd111f79f00c04fc2dcd2010100000000000509000000050028000001000001000000acf63111079cd111f79f00c04fc2dcd201010000000000050900000005002c000001000001000000aaf63111079cd111f79f00c04fc2dcd20102000000000005200000002002000005002c000001000001000000abf63111079cd111f79f00c04fc2dcd20102000000000005200000002002000005002c000001000001000000acf63111079cd111f79f00c04fc2dcd201020000000000052000000020020000000014009400020001010000000000050b00000000022400ff010f000105000000000005150000004dfc5019daac02ace33e5bc60702000000001400ff010f00010100000000000512000000000a2400bd010f000105000000000005150000004dfc5019daac02ae33e5bc600020000050028000001000001000000adf63111079cd111f79f00c04fc2dcd2010100000000000509000000050028000001000001000000765be9894d44624c991a0facbeda640c01010000000000050900000005002c000001000001000000adf63111079cd111f79f00c04fc2dcd20102000000000005200000002002000005002c000001000001000000765be9894d44624c991a0facbeda640c01020000000000052000000020020000050038000001000001000000aaf63111079cd111f79f00c04fc2dcd20105000000000005150000004dfc5019daac02ace33e5bc6f20100000105000000000005150000004dfc5019daac02ace33e5bc6070200000105000000000005150000004dfc5019daac02ace33e5bc607020000".HexToBinary();
            byte[] expectedHash = "1d5459903a7daca3926c0c4e09b26fe8".HexToBinary();

            var securityDescriptor = new CommonSecurityDescriptor(true, false, binarySecurityDescriptor, 0);
            byte[] hash = SecurityDescriptorRersolver.ComputeHash(securityDescriptor);
            Assert.AreEqual(true, expectedHash.SequenceEqual(hash));
        }
开发者ID:deimx42,项目名称:DSInternals,代码行数:9,代码来源:SecurityDescriptorResolverTester.cs

示例9: NativeObjectSecurity

 internal NativeObjectSecurity(ResourceType resourceType, CommonSecurityDescriptor securityDescriptor, ExceptionFromErrorCode exceptionFromErrorCode) : base(securityDescriptor)
 {
     this.ProtectedDiscretionaryAcl = 0x80000000;
     this.ProtectedSystemAcl = 0x40000000;
     this.UnprotectedDiscretionaryAcl = 0x20000000;
     this.UnprotectedSystemAcl = 0x10000000;
     this._resourceType = resourceType;
     this._exceptionFromErrorCode = exceptionFromErrorCode;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:NativeObjectSecurity.cs

示例10: ConstructorLetsFalseDSThrough

		public void ConstructorLetsFalseDSThrough ()
		{
			CommonSecurityDescriptor descriptor = new CommonSecurityDescriptor
				(false, false, ControlFlags.None, null, null, null, null);

			TestSecurity security = new TestSecurity (descriptor);
			Assert.IsFalse (security.IsContainerTest);
			Assert.IsFalse (security.IsDSTest);
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:9,代码来源:DirectoryObjectSecurityTest.cs

示例11: DefaultOwnerAndGroup

		public void DefaultOwnerAndGroup ()
		{
			CommonSecurityDescriptor csd = new CommonSecurityDescriptor
				(false, false, ControlFlags.None, null, null, null, null);
			Assert.IsNull (csd.Owner);
			Assert.IsNull (csd.Group);
			Assert.AreEqual (ControlFlags.DiscretionaryAclPresent
			                 | ControlFlags.SelfRelative, csd.ControlFlags);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:9,代码来源:CommonSecurityDescriptorTest.cs

示例12: IpcServerChannel

        public IpcServerChannel(IDictionary properties, IServerChannelSinkProvider sinkProvider, CommonSecurityDescriptor securityDescriptor)
        {
            this._channelPriority = 20;
            this._channelName = "ipc server";
            this._bExclusiveAddressUse = true;
            this._waitForStartListening = new AutoResetEvent(false);
            if (properties != null)
            {
                foreach (DictionaryEntry entry in properties)
                {
                    switch (((string) entry.Key))
                    {
                        case "name":
                            this._channelName = (string) entry.Value;
                            break;

                        case "portName":
                            this._portName = (string) entry.Value;
                            break;

                        case "priority":
                            this._channelPriority = Convert.ToInt32(entry.Value, CultureInfo.InvariantCulture);
                            break;

                        case "secure":
                            this._secure = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture);
                            break;

                        case "impersonate":
                            this._impersonate = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture);
                            this.authSet = true;
                            break;

                        case "suppressChannelData":
                            this._bSuppressChannelData = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture);
                            break;

                        case "authorizedGroup":
                            this._authorizedGroup = (string) entry.Value;
                            break;

                        case "exclusiveAddressUse":
                            this._bExclusiveAddressUse = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture);
                            break;
                    }
                }
            }
            if (this._portName == null)
            {
                throw new RemotingException(CoreChannel.GetResourceString("Remoting_Ipc_NoPortNameSpecified"));
            }
            this._sinkProvider = sinkProvider;
            this._securityDescriptor = securityDescriptor;
            this.SetupChannel();
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:55,代码来源:IpcServerChannel.cs

示例13: DirectoryObjectSecurity

        protected DirectoryObjectSecurity(CommonSecurityDescriptor securityDescriptor)
            : base(securityDescriptor)
        {
            if (securityDescriptor == null)
            {
                throw new ArgumentNullException("securityDescriptor");
            }
            Contract.EndContractBlock();

            _securityDescriptor = securityDescriptor;
        }
开发者ID:schaabs,项目名称:corefx,代码行数:11,代码来源:DirectoryObjectSecurity.cs

示例14: ObjectSecurity

        internal ObjectSecurity( CommonSecurityDescriptor securityDescriptor )
            : this()
        {
            if ( securityDescriptor == null )
            {
                throw new ArgumentNullException( "securityDescriptor" );
            }
            Contract.EndContractBlock();

             _securityDescriptor = securityDescriptor;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:11,代码来源:ObjectSecurity.cs

示例15: GetAllowAllNodeAcl

      public override byte[] GetAllowAllNodeAcl(string repositoryName, Guid domainId, Guid rootMapId)
      {
         // Return an empty Windows node ACL.
         SecurityIdentifier farmAccountSid = SPFarm.Local.DefaultServiceAccount.SecurityIdentifier;
         CommonSecurityDescriptor securityDescriptor = new CommonSecurityDescriptor(false, false, ControlFlags.None, farmAccountSid, null, null, null);
         securityDescriptor.SetDiscretionaryAclProtection(true, false);

         byte[] itemAcl = new byte[securityDescriptor.BinaryLength];
         securityDescriptor.GetBinaryForm(itemAcl, 0);

         return itemAcl;
      }
开发者ID:chris-tomich,项目名称:Glyma,代码行数:12,代码来源:WindowsGlymaSecurityManager.cs


注:本文中的System.Security.AccessControl.CommonSecurityDescriptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。