• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Policy.ApplicationTrust类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ApplicationTrustCallMethods

 public static void ApplicationTrustCallMethods()
 {
     ApplicationTrust at = new ApplicationTrust();
     SecurityElement se = new SecurityElement("");
     at.FromXml(se);
     se = at.ToXml();
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:EvidenceBaseTests.cs


示例2: ApplicationIdentity_Null

		public void ApplicationIdentity_Null ()
		{
			ApplicationTrust at = new ApplicationTrust ();
			at.ApplicationIdentity = new ApplicationIdentity ("Mono Unit Test");
			// once set it cannot be "unset" ...
			at.ApplicationIdentity = null;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:ApplicationTrustTest.cs


示例3: ApplicationIdentity

		public void ApplicationIdentity ()
		{
			ApplicationTrust at = new ApplicationTrust ();
			at.ApplicationIdentity = new ApplicationIdentity ("Mono Unit Test");
			Assert.IsNotNull (at.ApplicationIdentity, "not null");
			string expected = AdjustLineEnds ("<ApplicationTrust version=\"1\"\r\nFullName=\"Mono Unit Test, Culture=neutral\">\r\n<DefaultGrant>\r\n<PolicyStatement version=\"1\">\r\n<PermissionSet class=\"System.Security.PermissionSet\"\r\nversion=\"1\"/>\r\n</PolicyStatement>\r\n</DefaultGrant>\r\n</ApplicationTrust>\r\n");
			Assert.AreEqual (expected, AdjustLineEnds (at.ToXml ().ToString ()), "XML");
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:8,代码来源:ApplicationTrustTest.cs


示例4: Add

		// methods

		public int Add (ApplicationTrust trust)
		{
			if (trust == null)
				throw new ArgumentNullException ("trust");
			if (trust.ApplicationIdentity == null) {
				throw new ArgumentException (Locale.GetText (
					"ApplicationTrust.ApplicationIdentity can't be null."), "trust");
			}

			return _list.Add (trust);
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:13,代码来源:ApplicationTrustCollection.cs


示例5: PersistTrustWithoutEvaluation

 public static System.Security.Policy.ApplicationTrust PersistTrustWithoutEvaluation(ActivationContext actCtx)
 {
     ApplicationSecurityInfo info = new ApplicationSecurityInfo(actCtx);
     System.Security.Policy.ApplicationTrust trust = new System.Security.Policy.ApplicationTrust(actCtx.Identity) {
         IsApplicationTrustedToRun = true,
         DefaultGrantSet = new PolicyStatement(info.DefaultRequestSet, PolicyStatementAttribute.Nothing),
         Persist = true,
         ApplicationIdentity = actCtx.Identity
     };
     ApplicationSecurityManager.UserApplicationTrusts.Add(trust);
     return trust;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:ApplicationTrust.cs


示例6: Constructor_Empty

		public void Constructor_Empty ()
		{
			ApplicationTrust at = new ApplicationTrust ();
			Assert.IsNull (at.ApplicationIdentity, "ApplicationIdentity");
			Assert.AreEqual (PolicyStatementAttribute.Nothing, at.DefaultGrantSet.Attributes, "DefaultGrantSet.Attributes");
			Assert.AreEqual (String.Empty, at.DefaultGrantSet.AttributeString, "DefaultGrantSet.AttributeString");
			Assert.IsTrue (at.DefaultGrantSet.PermissionSet.IsEmpty (), "DefaultGrantSet.PermissionSet.IsEmpty");
			Assert.IsFalse (at.DefaultGrantSet.PermissionSet.IsUnrestricted (), "DefaultGrantSet.PermissionSet.IsUnrestricted");
			Assert.IsNull (at.ExtraInfo, "ExtraInfo");
			Assert.IsFalse (at.IsApplicationTrustedToRun, "IsApplicationTrustedToRun");
			Assert.IsFalse (at.Persist, "Persist");
			string expected = AdjustLineEnds ("<ApplicationTrust version=\"1\">\r\n<DefaultGrant>\r\n<PolicyStatement version=\"1\">\r\n<PermissionSet class=\"System.Security.PermissionSet\"\r\nversion=\"1\"/>\r\n</PolicyStatement>\r\n</DefaultGrant>\r\n</ApplicationTrust>\r\n");
			Assert.AreEqual (expected, AdjustLineEnds (at.ToXml ().ToString ()), "XML");
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:14,代码来源:ApplicationTrustTest.cs


示例7: ApplicationTrustCollectionCallMethods

 public static void ApplicationTrustCollectionCallMethods()
 {
     ApplicationTrustCollection atc = (ApplicationTrustCollection)Activator.CreateInstance(typeof(ApplicationTrustCollection), true);
     ApplicationTrust at = new ApplicationTrust();
     int testint = atc.Add(at);
     ApplicationTrust[] atarray = new ApplicationTrust[1];
     atc.AddRange(atarray);
     atc.AddRange(atc);
     atc.Clear();
     atc.CopyTo(atarray, 0);
     ApplicationTrustEnumerator ate = atc.GetEnumerator();
     atc.Remove(at);
     atc.RemoveRange(atarray);
     atc.RemoveRange(atc);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:15,代码来源:ApplicationTrustTests.cs


示例8: Add

 public int Add(ApplicationTrust trust)
 {
     if (trust == null)
     {
         throw new ArgumentNullException("trust");
     }
     if (trust.ApplicationIdentity == null)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_ApplicationTrustShouldHaveIdentity"));
     }
     if (this.m_storeBounded)
     {
         this.CommitApplicationTrust(trust.ApplicationIdentity, trust.ToXml().ToString());
         return -1;
     }
     return this.AppTrusts.Add(trust);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:ApplicationTrustCollection.cs


示例9: AddRange

 public void AddRange(ApplicationTrust[] trusts)
 {
     if (trusts == null)
     {
         throw new ArgumentNullException("trusts");
     }
     int index = 0;
     try
     {
         while (index < trusts.Length)
         {
             this.Add(trusts[index]);
             index++;
         }
     }
     catch
     {
         for (int i = 0; i < index; i++)
         {
             this.Remove(trusts[i]);
         }
         throw;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:24,代码来源:ApplicationTrustCollection.cs


示例10: FromXml_InvalidVersion

		public void FromXml_InvalidVersion ()
		{
			ApplicationTrust at = new ApplicationTrust ();
			SecurityElement se = at.ToXml ();

			SecurityElement w = new SecurityElement (se.Tag);
			w.AddAttribute ("version", "2");
			foreach (SecurityElement child in se.Children)
				w.AddChild (child);

			at.FromXml (w);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:12,代码来源:ApplicationTrustTest.cs


示例11: FromXml_InvalidTag

		public void FromXml_InvalidTag ()
		{
			ApplicationTrust at = new ApplicationTrust ();
			SecurityElement se = at.ToXml ();
			se.Tag = "MonoTrust";
			at.FromXml (se);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:ApplicationTrustTest.cs


示例12: FromXml_Null

		public void FromXml_Null ()
		{
			ApplicationTrust at = new ApplicationTrust ();
			at.FromXml (null);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:5,代码来源:ApplicationTrustTest.cs


示例13: ToFromXmlRoundtrip

		public void ToFromXmlRoundtrip ()
		{
			ApplicationTrust at = new ApplicationTrust ();
			at.ApplicationIdentity = new ApplicationIdentity ("Mono Unit Test");
			at.DefaultGrantSet = new PolicyStatement (new PermissionSet (PermissionState.Unrestricted));
			at.ExtraInfo = "Mono";
			at.IsApplicationTrustedToRun = true;
			at.Persist = true;

			SecurityElement se = at.ToXml ();
			string expected = AdjustLineEnds ("<ApplicationTrust version=\"1\"\r\nFullName=\"Mono Unit Test, Culture=neutral\"\r\nTrustedToRun=\"true\"\r\nPersist=\"true\">\r\n<DefaultGrant>\r\n<PolicyStatement version=\"1\">\r\n<PermissionSet class=\"System.Security.PermissionSet\"\r\nversion=\"1\"\r\nUnrestricted=\"true\"/>\r\n</PolicyStatement>\r\n</DefaultGrant>\r\n<ExtraInfo Data=\"0001000000FFFFFFFF01000000000000000601000000044D6F6E6F0B\"/>\r\n</ApplicationTrust>\r\n");
			Assert.AreEqual (expected, AdjustLineEnds (at.ToXml ().ToString ()), "XML");

			ApplicationTrust copy = new ApplicationTrust ();
			copy.FromXml (se);
			se = copy.ToXml ();
			Assert.AreEqual (expected, AdjustLineEnds (at.ToXml ().ToString ()), "Copy");
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:18,代码来源:ApplicationTrustTest.cs


示例14: CopyTo

 public void CopyTo (ApplicationTrust[] array, int index) {
     ((ICollection)this).CopyTo(array, index);
 } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:3,代码来源:ApplicationTrust.cs


示例15: ApplicationIdentity_Change

		public void ApplicationIdentity_Change ()
		{
			ApplicationTrust at = new ApplicationTrust ();
			at.ApplicationIdentity = new ApplicationIdentity ("Mono Unit Test");
			// ... but it can be changed
			at.ApplicationIdentity = new ApplicationIdentity ("Mono Unit Test Too");
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:ApplicationTrustTest.cs


示例16: SetupDomainSecurityForHomogeneousDomain

        [System.Security.SecurityCritical]  // auto-generated
        private void SetupDomainSecurityForHomogeneousDomain(ApplicationTrust appTrust,
                                                             bool runtimeSuppliedHomogenousGrantSet)
        {
            // If the CLR has supplied the homogenous grant set (that is, this domain would have been
            // heterogenous in v2.0), then we need to strip the ApplicationTrust from the AppDomainSetup of
            // the current domain.  This prevents code which does:
            //   AppDomain.CreateDomain(..., AppDomain.CurrentDomain.SetupInformation);
            // 
            // From looking like it is trying to create a homogenous domain intentionally, and therefore
            // having its evidence check bypassed.
            if (runtimeSuppliedHomogenousGrantSet)
            {
                BCLDebug.Assert(_FusionStore.ApplicationTrust != null, "Expected to find runtime supplied ApplicationTrust");
#if FEATURE_CAS_POLICY
                _FusionStore.ApplicationTrust = null;
#endif // FEATURE_CAS_POLICY
            }

            _applicationTrust = appTrust;

            // Set the homogeneous bit in the VM's ApplicationSecurityDescriptor.
            SetSecurityHomogeneousFlag(GetNativeHandle(),
                                       runtimeSuppliedHomogenousGrantSet);
        }
开发者ID:Rayislandstyle,项目名称:dotnet-coreclr,代码行数:25,代码来源:AppDomain.cs


示例17: SetupDomainSecurityForApplication

 [System.Security.SecurityCritical]  // auto-generated
 private void SetupDomainSecurityForApplication(ApplicationIdentity appIdentity,
                                                ApplicationTrust appTrust)
 {
     // Set the Application trust on the managed side.
     _applicationIdentity = appIdentity;
     SetupDomainSecurityForHomogeneousDomain(appTrust, false);
 }
开发者ID:Rayislandstyle,项目名称:dotnet-coreclr,代码行数:8,代码来源:AppDomain.cs


示例18: SetupDomainSecurityForApplication

 private void SetupDomainSecurityForApplication(System.ApplicationIdentity appIdentity, System.Security.Policy.ApplicationTrust appTrust)
 {
     this._applicationIdentity = appIdentity;
     this._applicationTrust = appTrust;
     nSetSecurityHomogeneousFlag();
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:6,代码来源:AppDomain.cs


示例19: DetermineApplicationTrustInternal

        //
        // Internal
        //

        internal static ApplicationTrust DetermineApplicationTrustInternal (ActivationContext activationContext, TrustManagerContext context) {
            ApplicationTrust trust = null;
            ApplicationTrustCollection userTrusts = new ApplicationTrustCollection(true);

            // See if there is a persisted trust decision for this application.
            if ((context == null || !context.IgnorePersistedDecision)) {
                trust = userTrusts[activationContext.Identity.FullName];
                if (trust != null)
                    return trust;
            }

            // There is no cached trust decision so invoke the trust manager.
            trust = ApplicationTrustManager.DetermineApplicationTrust(activationContext, context);
            if (trust == null)
                trust = new ApplicationTrust(activationContext.Identity);
            // make sure the application identity is correctly set.
            trust.ApplicationIdentity = activationContext.Identity;
            if (trust.Persist)
                userTrusts.Add(trust);

            return trust;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:26,代码来源:applicationsecuritymanager.cs


示例20: CreateApplicationTrust

        private static ApplicationTrust CreateApplicationTrust(ActivationContext activationContext,
                                                               ApplicationSecurityInfo info,
                                                               ApplicationTrustExtraInfo appTrustExtraInfo,
                                                               bool trust,
                                                               bool persist)
        {
            ApplicationTrust appTrust = new ApplicationTrust(activationContext.Identity);

            appTrust.ExtraInfo = appTrustExtraInfo;
            appTrust.IsApplicationTrustedToRun = trust;
            appTrust.DefaultGrantSet = new PolicyStatement(info.DefaultRequestSet, (PolicyStatementAttribute) 0);
            appTrust.Persist = persist;

            return appTrust;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:15,代码来源:TrustManager.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Policy.Evidence类代码示例发布时间:2022-05-26
下一篇:
C# Permissions.UrlIdentityPermission类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap