示例#1
0
 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();
                    }
                }
            }
        }
示例#3
0
 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;
 }
示例#4
0
 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;
 }
示例#5
0
 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;
 }
示例#6
0
 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;
 }
示例#7
0
 internal static void ExecutePrivileged(IStackWalk permission, PrivilegedCallback callback)
 {
     permission.Assert();
     try
     {
         callback();
     }
     finally
     {
         CodeAccessPermission.RevertAssert();
     }
 }
示例#8
0
 internal static void ExecutePrivileged(IStackWalk permission, PrivilegedCallback callback)
 {
     permission.Assert();
     try
     {
         callback();
     }
     finally
     {
         CodeAccessPermission.RevertAssert();
     }
 }
示例#9
0
 // 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();
            }
        }
示例#11
0
 public Compiler SetPermissions(IStackWalk permissions)
 {
     _permissions = permissions;
     return this;
 }
示例#12
0
 public void Clear()
 {
     _references.Clear();
     _definitions.Clear();
     _namespaces.Clear();
     _permissions = GetDefaultPermissions();
 }
示例#13
0
 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;
 }
示例#14
0
 public Compiler SetPermissions(IStackWalk permissions)
 {
     _permissions = permissions;
     return(this);
 }