// Constructor. public Url(String name) { if(name == null) { throw new ArgumentNullException("name"); } parser = new UrlParser(name); }
public UrlMembershipCondition(String url) { if(url == null) { throw new ArgumentNullException("url"); } parser = new UrlParser(url); }
// Determine if we have an application directory match. private static bool Match(UrlParser url, String dir) { if(dir.EndsWith("/")) { dir = dir + "*"; } else { dir = dir + "/*"; } UrlParser parser = new UrlParser(dir); return parser.Matches(url); }
// Implement the IMembership interface. public bool Check(Evidence evidence) { if (evidence == null) { return(false); } IEnumerator e = evidence.GetHostEnumerator(); while (e.MoveNext()) { Site s = (e.Current as Site); if (s != null) { if (UrlParser.HostMatches(site, s.Name)) { return(true); } } } return(false); }
// Implement the ISecurityPolicyEncodable interface. public void FromXml(SecurityElement et, PolicyLevel level) { if(et == null) { throw new ArgumentNullException("et"); } if(et.Tag != "IMembershipCondition") { throw new ArgumentException(_("Security_PolicyName")); } if(et.Attribute("version") != "1") { throw new ArgumentException(_("Security_PolicyVersion")); } String value = et.Attribute("Url"); if(value != null) { parser = new UrlParser(value); } else { throw new ArgumentException(_("Arg_InvalidUrl")); } }
// Create a new site from a URL. public static Site CreateFromUrl(String url) { UrlParser parser = new UrlParser(url); return new Site(parser.Host); }
// Create a new site from a URL. public static Site CreateFromUrl(String url) { UrlParser parser = new UrlParser(url); return(new Site(parser.Host)); }
// Make a policy from url information. private PolicyStatement MakePolicy(UrlParser url) { if(String.Compare(url.Scheme, "file", true) != 0) { return null; } PermissionSet permSet = new PermissionSet (PermissionState.None); permSet.AddPermission(new FileIOPermission(access, url.Rest)); return new PolicyStatement (permSet, PolicyStatementAttribute.Nothing); }