public void Clear() { _references.Clear(); _definitions.Clear(); _namespaces.Clear(); _permissions = GetDefaultPermissions(); }
public override object Execute(Object o, IList args) { IStackWalk permission = null; try { permission = CreateStackWalk(); if (this.PermitOnly) { permission.PermitOnly(); } else { permission.Deny(); } return(this.Invoker.Execute(o, args)); } finally { if (permission != null) { if (this.PermitOnly) { CodeAccessPermission.RevertPermitOnly(); } else { CodeAccessPermission.RevertDeny(); } } } }
public Request(Server server, Host host, Connection connection) : base(String.Empty, String.Empty, null) { _connectionPermission = new PermissionSet(PermissionState.Unrestricted); _server = server; _host = host; _connection = connection; }
public Request(Server server, Host host, Connection connection, IIdentity client) : base(string.Empty, string.Empty, null) { _connectionPermission = new PermissionSet(PermissionState.Unrestricted); _server = server; _host = host; _connection = connection; _clientIdentity = client; }
internal static void ExecutePrivileged(IStackWalk permission, PrivilegedCallback callback) { permission.Assert(); try { callback(); } finally { CodeAccessPermission.RevertAssert(); } }
// A better implementation would cache this information over the lifetime of the application, // so the permission only needs to be evaluated once. private static bool CheckPermission(IStackWalk requestedPermission) { try { // Try to get this permission. requestedPermission.Demand(); return(true); } catch { return(false); } }
internal static void DemandEnvironmentPermissions <T>(ClientBase <T> proxy) where T : class { if (!SecurityEnabled(proxy.Endpoint) || IsAnonymous(proxy.Endpoint)) { return; } IPermission permission = new EnvironmentPermission(EnvironmentPermissionAccess.Read, "USERNAME"); IStackWalk environment = permission as IStackWalk; environment.Assert(); string windowsUserName = proxy.ClientCredentials.Windows.ClientCredential.UserName; CodeAccessPermission.RevertAssert(); if (windowsUserName == String.Empty && proxy.ClientCredentials.UserName.UserName == null) { Debug.Assert(WindowsSecurityEnabled(proxy.Endpoint)); permission.Demand(); } }
public Compiler SetPermissions(IStackWalk permissions) { _permissions = permissions; return this; }
public Request(Host host, Connection connection) : base(string.Empty, string.Empty, null) { this.m_connectionPermission = new PermissionSet(PermissionState.Unrestricted); this.m_host = host; this.m_connection = connection; }
public Compiler SetPermissions(IStackWalk permissions) { _permissions = permissions; return(this); }