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

C# Policy.PolicyLevel类代码示例

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

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



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

示例1: FromXml

		public void FromXml (SecurityElement e, PolicyLevel level)
		{
			MembershipConditionHelper.CheckSecurityElement (e, "e", version, version);
			if (!Boolean.TryParse (e.Attribute ("LookAtDir"), out _lookAtDir))
				_lookAtDir = false;
			// PolicyLevel isn't used as there's no need to resolve NamedPermissionSet references
		}
开发者ID:runefs,项目名称:Marvin,代码行数:7,代码来源:ApplicationMembershipCondition.cs


示例2: ToXml

 public SecurityElement ToXml(PolicyLevel level)
 {
     SecurityElement element = new SecurityElement("IMembershipCondition");
     XMLUtil.AddClassAttribute(element, base.GetType(), "System.Security.Policy.AllMembershipCondition");
     element.AddAttribute("version", "1");
     return element;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:AllMembershipCondition.cs


示例3: CreateAppDomain

        public AppDomain CreateAppDomain( PolicyLevel policyLevel )
        {
            var domain = AppDomain.CreateDomain( "medium", AppDomain.CurrentDomain.Evidence );

            domain.SetAppDomainPolicy( policyLevel );
            return domain;
        }
开发者ID:chKarner,项目名称:innovatian.configuration,代码行数:7,代码来源:MediumTrustContext.cs


示例4: ToXml

 public SecurityElement ToXml( PolicyLevel level )
 {
     SecurityElement root = new SecurityElement( "IMembershipCondition" );
     System.Security.Util.XMLUtil.AddClassAttribute( root, this.GetType(), this.GetType().FullName );
     root.AddAttribute( "version", "1" );
     return root;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:GACMembershipCondition.cs


示例5: FromXml

        public void FromXml( SecurityElement e, PolicyLevel level )
        {
            if (e == null)
                throw new ArgumentNullException("e");

            if (!e.Tag.Equals( "IMembershipCondition" ))
                throw new ArgumentException( Environment.GetResourceString( "Argument_MembershipConditionElement" ) );
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:8,代码来源:gacmembershipcondition.cs


示例6: ListPermissionSets

 private static void ListPermissionSets(PolicyLevel pLevel)
 {
     IList namedPermissions = pLevel.NamedPermissionSets;
     IEnumerator namedPermission = namedPermissions.GetEnumerator();
     while (namedPermission.MoveNext())
     {
         Console.WriteLine("\t" + ((NamedPermissionSet)namedPermission.Current).Name);
     }
 }
开发者ID:oblivious,项目名称:Oblivious,代码行数:9,代码来源:Program.cs


示例7: ToXml

        public SecurityElement ToXml( PolicyLevel level )
        {
            SecurityElement root = new SecurityElement( "IMembershipCondition" );
            System.Security.Util.XMLUtil.AddClassAttribute( root, this.GetType(), "System.Security.Policy.AllMembershipCondition" );
            // If you hit this assert then most likely you are trying to change the name of this class. 
            // This is ok as long as you change the hard coded string above and change the assert below.
            Contract.Assert( this.GetType().FullName.Equals( "System.Security.Policy.AllMembershipCondition" ), "Class name changed!" );

            root.AddAttribute( "version", "1" );
            
            return root;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:12,代码来源:AllMembershipCondition.cs


示例8: ParseXml

 protected override void ParseXml(SecurityElement e, PolicyLevel level)
 {
     string str = e.Attribute("Access");
     if (str != null)
     {
         this.m_access = (FileIOPermissionAccess) Enum.Parse(typeof(FileIOPermissionAccess), str);
     }
     else
     {
         this.m_access = FileIOPermissionAccess.NoAccess;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:FileCodeGroup.cs


示例9: FromXml

 public void FromXml(SecurityElement e, PolicyLevel level)
 {
     if (e == null)
     {
         throw new ArgumentNullException("e");
     }
     if (!e.Tag.Equals("IMembershipCondition"))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_MembershipConditionElement"));
     }
     lock (this)
     {
         this.m_zone = System.Security.SecurityZone.NoZone;
         this.m_element = e;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:16,代码来源:ZoneMembershipCondition.cs


示例10: FromXml

		public void FromXml (SecurityElement e, PolicyLevel level)
		{
			_se = e;
		}
开发者ID:Anjoli,项目名称:mono,代码行数:4,代码来源:caspol.cs


示例11: FindCodeGroup

		static CodeGroup FindCodeGroup (string name, ref CodeGroup parent, ref PolicyLevel pl)
		{
			if (name.Length < 1)
				return null;
			
			// Notes:
			// - labels starts with numbers (e.g. 1.2.1)
			// - names cannot start with numbers (A-Z, 0-9 and _)
			bool label = Char.IsDigit (name, 0);

			// More notes
			// - we can't remove the root code group
			// - we remove only one group (e.g. name)
			for (int i=0; i < Levels.Count; i++) {
				pl = (PolicyLevel) Levels [i];
				parent = pl.RootCodeGroup;
				CodeGroup cg = null;
				if (label)
					cg = FindCodeGroupByLabel (name, "1", ref parent);
				else
					cg = FindCodeGroupByName (name, ref parent);
				
				if (cg != null)
					return cg;
			}
			Console.WriteLine ("CodeGroup with {0} '{1}' was not found!",
				label ? "label" : "name", name);
			return null;
		}
开发者ID:Anjoli,项目名称:mono,代码行数:29,代码来源:caspol.cs


示例12: ShowResolveGroup

		static void ShowResolveGroup (PolicyLevel pl, Evidence e)
		{
			Console.WriteLine ("{0}Level: {1}{0}", Environment.NewLine, pl.Label);
			CodeGroup cg = pl.ResolveMatchingCodeGroups (e);
			Console.WriteLine ("Code Groups:{0}", Environment.NewLine);
			ShowCodeGroup (cg, "1");
			Console.WriteLine ();
		}
开发者ID:Anjoli,项目名称:mono,代码行数:8,代码来源:caspol.cs


示例13: ResolvePolicyLevel

		internal static bool ResolvePolicyLevel (ref PermissionSet ps, PolicyLevel pl, Evidence evidence)
		{
			PolicyStatement pst = pl.Resolve (evidence);
			if (pst != null) {
				if (ps == null) {
					// only for initial (first) policy level processed
					ps = pst.PermissionSet;
				} else {
					ps = ps.Intersect (pst.PermissionSet);
					if (ps == null) {
						// null is equals to None - exist that null can throw NullReferenceException ;-)
						ps = new PermissionSet (PermissionState.None);
					}
				}

				if ((pst.Attributes & PolicyStatementAttribute.LevelFinal) == PolicyStatementAttribute.LevelFinal)
					return true;
			}
			return false;
		}
开发者ID:shana,项目名称:mono,代码行数:20,代码来源:SecurityManager.cs


示例14: InitializePolicyHierarchy

		private static void InitializePolicyHierarchy ()
		{
			string machinePolicyPath = Path.GetDirectoryName (Environment.GetMachineConfigPath ());
			// note: use InternalGetFolderPath to avoid recursive policy initialization
			string userPolicyPath = Path.Combine (Environment.UnixGetFolderPath (Environment.SpecialFolder.ApplicationData, Environment.SpecialFolderOption.Create), "mono");

			PolicyLevel enterprise = new PolicyLevel ("Enterprise", PolicyLevelType.Enterprise);
			_level = enterprise;
			enterprise.LoadFromFile (Path.Combine (machinePolicyPath, "enterprisesec.config"));

			PolicyLevel machine = new PolicyLevel ("Machine", PolicyLevelType.Machine);
			_level = machine;
			machine.LoadFromFile (Path.Combine (machinePolicyPath, "security.config"));

			PolicyLevel user = new PolicyLevel ("User", PolicyLevelType.User);
			_level = user;
			user.LoadFromFile (Path.Combine (userPolicyPath, "security.config"));

			ArrayList al = new ArrayList ();
			al.Add (enterprise);
			al.Add (machine);
			al.Add (user);

			_hierarchy = ArrayList.Synchronized (al);
			_level = null;
		}
开发者ID:shana,项目名称:mono,代码行数:26,代码来源:SecurityManager.cs


示例15: SavePolicyLevel

		public static void SavePolicyLevel (PolicyLevel level) 
		{
			// Yes this will throw a NullReferenceException, just like MS (see FDBK13121)
			level.Save ();
		}
开发者ID:shana,项目名称:mono,代码行数:5,代码来源:SecurityManager.cs


示例16: LoadPolicyLevelFromString

		public static PolicyLevel LoadPolicyLevelFromString (string str, PolicyLevelType type)
		{
			if (null == str)
				throw new ArgumentNullException ("str");

			PolicyLevel pl = null;
			try {
				pl = new PolicyLevel (type.ToString (), type);
				pl.LoadFromString (str);
			}
			catch (Exception e) {
				throw new ArgumentException (Locale.GetText ("Invalid policy XML"), e);
			}
			return pl;
		}
开发者ID:shana,项目名称:mono,代码行数:15,代码来源:SecurityManager.cs


示例17: LoadPolicyLevelFromFile

		public static PolicyLevel LoadPolicyLevelFromFile (string path, PolicyLevelType type)
		{
			if (path == null)
				throw new ArgumentNullException ("path");

			PolicyLevel pl = null;
			try {
				pl = new PolicyLevel (type.ToString (), type);
				pl.LoadFromFile (path);
			}
			catch (Exception e) {
				throw new ArgumentException (Locale.GetText ("Invalid policy XML"), e);
			}
			return pl;
		}
开发者ID:shana,项目名称:mono,代码行数:15,代码来源:SecurityManager.cs


示例18: ParseXml

        protected override void ParseXml( SecurityElement e, PolicyLevel level )
        {
            //Reset the exiting content
            ResetConnectAccess();

            SecurityElement et = e.SearchForChildByTag("connectAccessRules");

            if (et == null || et.Children == null)
            {
                SetDefaults();
                return;
            }

            foreach(SecurityElement codeOriginElem in et.Children)
            {
                if (codeOriginElem.Tag.Equals("codeOrigin"))
                {
                    string originScheme = codeOriginElem.Attribute("scheme");
                    bool oneAdded = false;

                    if (codeOriginElem.Children != null)
                    {
                        foreach(SecurityElement accessElem in codeOriginElem.Children)
                        {
                            if (accessElem.Tag.Equals("connectAccess"))
                            {
                                string connectScheme = accessElem.Attribute("scheme");
                                string connectPort   = accessElem.Attribute("port");
                                AddConnectAccess(originScheme, new CodeConnectAccess(connectScheme, connectPort));
                                oneAdded = true;
                            }
                            else {
                                // improper tag found, just ignore
                            }
                        }
                    }

                    if (!oneAdded)
                    {
                        //special case as to no talkback access for a given scheme
                        AddConnectAccess(originScheme, null);
                    }

                }
                else {
                    // improper tag found, just ignore
                }
            }
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:49,代码来源:netcodegroup.cs


示例19: CreateXml

        //
        protected override void CreateXml( SecurityElement element, PolicyLevel level )
        {
            DictionaryEntry[] rules = GetConnectAccessRules();
            if (rules == null)
                return;

            SecurityElement rulesElement = new SecurityElement("connectAccessRules");

            foreach (DictionaryEntry rule in rules)
            {
                SecurityElement codeOriginElement = new SecurityElement("codeOrigin");
                codeOriginElement.AddAttribute("scheme", (string) rule.Key);
                foreach (CodeConnectAccess access in (CodeConnectAccess[])rule.Value)
                {
                    SecurityElement accessElem = new SecurityElement("connectAccess");
                    accessElem.AddAttribute("scheme", access.Scheme);
                    accessElem.AddAttribute("port", access.StrPort);
                    codeOriginElement.AddChild(accessElem);
                }
                rulesElement.AddChild(codeOriginElement);
            }
            element.AddChild(rulesElement);
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:24,代码来源:netcodegroup.cs


示例20: FromXml

		public void FromXml (SecurityElement e, PolicyLevel level)
		{
			MembershipConditionHelper.CheckSecurityElement (e, "e", version, version);
			
			string u = e.Attribute ("Url");
#if NET_2_0
			if (u != null) {
				CheckUrl (u);
				url = new Url (u);
			} else {
				url = null;
			}
#else
			url = (u == null) ? null : new Url (u);
#endif
			userUrl = u;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:17,代码来源:UrlMembershipCondition.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Policy.PolicyStatement类代码示例发布时间:2022-05-26
下一篇:
C# Policy.Evidence类代码示例发布时间: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