Ejemplo n.º 1
0
        private static void AddAuthenticationsFromMruList(AuthenticationList authentications, MruConnections mruConnections, ProviderType providerId, Datasource datasource)
        {
            Datasources providerDatasources = mruConnections.FindDatasources(providerId);

            if (providerDatasources == null)
            {
                return;
            }

            if (providerDatasources.Datasource == null || providerDatasources.Datasource.Count == 0)
            {
                return;
            }

            Datasource mruDatasource = providerDatasources.FindDatasourceByAddress(datasource.Address);

            if (mruDatasource == null || mruDatasource.Authentications == null)
            {
                return;
            }

            foreach (var authentication in mruDatasource.Authentications)
            {
                if (authentications.Count >= MaxMruEntries)
                {
                    break;
                }
                if (!authentications.Contains(authentication))
                {
                    authentications.Add(authentication);
                }
            }
        }
Ejemplo n.º 2
0
 ///<summary>Initializes a new instance of the SocksClient class.</summary>
 ///<param name="ClientSocket">The Socket connection between this proxy server and the local client.</param>
 ///<param name="Destroyer">The method to be called when this SocksClient object disconnects from the local client and the remote server.</param>
 ///<param name="AuthList">The list with valid username/password combinations.</param>
 ///<remarks>If the AuthList is non-null, every client has to authenticate before he can use this proxy server to relay data. If it is null, the clients don't have to authenticate.</remarks>
 public SocksClient(Socket ClientSocket, DestroyDelegate Destroyer, AuthenticationList AuthList) : base(ClientSocket, Destroyer)
 {
     this.AuthList = AuthList;
     if (AuthList != null && AuthList.Count > 0)
     {
         MustAuthenticate = true;
     }
 }
Ejemplo n.º 3
0
        private static void AddAuthentications(Datasource datasource, MruConnections mruConnections, DbConnectionParameter mruParameter)
        {
            AuthenticationList authentications = new AuthenticationList();
            Authentication     authentication  = new Authentication()
            {
                Integrated = mruParameter.IntegratedSecurity,
                UserId     = mruParameter.UserId,
                Password   = mruParameter.Password
            };

            if (authentication.IsUsable)
            {
                authentications.Add(authentication);
            }
            AddAuthenticationsFromMruList(authentications, mruConnections, mruParameter.Provider, datasource);
            datasource.Authentications = authentications;
        }
Ejemplo n.º 4
0
        public static string GetData()
        {
            int i = 0;

            foreach (Role r in RoleList)
            {
                if (r.Name == System.Configuration.ConfigurationManager.AppSettings["GroupAdmin"])
                {
                    continue;
                }
                AuthenticationList.Add(new List <bool>());
                foreach (MenuMasterPermission tp in MenuMasterPermissionList)
                {
                    AuthenticationList[i].Add(MenuMasterAuthenticationManager.GetRolesForPermission(tp).Contains(r));
                }
                i++;
            }
            IEnumerable <Role> iRoleList = RoleList.Where(r => r.Name != System.Configuration.ConfigurationManager.AppSettings["GroupAdmin"]);
            var result = new { MenuMasterPermissionList = MenuMasterPermissionList, RoleList = iRoleList, AuthenticationList = AuthenticationList };

            System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
            return(js.Serialize(result));
        }
Ejemplo n.º 5
0
 ///<summary>Initializes a new instance of the SocksListener class.</summary>
 ///<param name="Port">The port to listen on.</param>
 ///<param name="Address">The address to listen on. You can specify IPAddress.Any to listen on all installed network cards.</param>
 ///<param name="AuthList">The list of valid login/password combinations. If you do not need password authentication, set this parameter to null.</param>
 ///<remarks>For the security of your server, try to avoid to listen on every network card (IPAddress.Any). Listening on a local IP address is usually sufficient and much more secure.</remarks>
 public SocksListener(IPAddress Address, int Port, AuthenticationList AuthList) : base(Port, Address)
 {
     this.AuthList     = AuthList;
     this.WhitelistIPs = new List <string>();
 }
Ejemplo n.º 6
0
 ///<summary>Initializes a new instance of the SocksListener class.</summary>
 ///<param name="Port">The port to listen on.</param>
 ///<param name="AuthList">The list of valid login/password combinations. If you do not need password authentication, set this parameter to null.</param>
 ///<remarks>The SocksListener will listen on all available network cards.</remarks>
 public SocksListener(int Port, AuthenticationList AuthList) : this(IPAddress.Any, Port, AuthList)
 {
 }
Ejemplo n.º 7
0
 ///<summary>Initializes a new instance of the Socks5Handler class.</summary>
 ///<param name="ClientConnection">The connection with the client.</param>
 ///<param name="Callback">The method to call when the SOCKS negotiation is complete.</param>
 ///<param name="AuthList">The authentication list to use when clients connect.</param>
 ///<exception cref="ArgumentNullException"><c>Callback</c> is null.</exception>
 ///<remarks>If the AuthList parameter is null, no authentication will be required when a client connects to the proxy server.</remarks>
 public Socks5Handler(Socket ClientConnection, NegotiationCompleteDelegate Callback, AuthenticationList AuthList) : base(ClientConnection, Callback)
 {
     this.AuthList = AuthList;
 }
Ejemplo n.º 8
0
 ///<summary>Initializes a new instance of the SocksListener class.</summary>
 ///<param name="Port">The port to listen on.</param>
 ///<param name="Address">The address to listen on. You can specify IPAddress.Any to listen on all installed network cards.</param>
 ///<param name="AuthList">The list of valid login/password combinations. If you do not need password authentication, set this parameter to null.</param>
 ///<remarks>For the security of your server, try to avoid to listen on every network card (IPAddress.Any). Listening on a local IP address is usually sufficient and much more secure.</remarks>
 public SocksListener(IPAddress Address, int Port, AuthenticationList AuthList) : base(Port, Address)
 {
     this.AuthList = AuthList;
 }
Ejemplo n.º 9
0
 ///<summary>Initializes a new instance of the SocksClient class.</summary>
 ///<param name="ClientSocket">The Socket connection between this proxy server and the local client.</param>
 ///<param name="Destroyer">The method to be called when this SocksClient object disconnects from the local client and the remote server.</param>
 ///<param name="AuthList">The list with valid username/password combinations.</param>
 ///<remarks>If the AuthList is non-null, every client has to authenticate before he can use this proxy server to relay data. If it is null, the clients don't have to authenticate.</remarks>
 public SocksClient(Socket ClientSocket, DestroyDelegate Destroyer, AuthenticationList AuthList) : base(ClientSocket, Destroyer)
 {
     this.AuthList = AuthList;
 }
Ejemplo n.º 10
0
 ///<summary>Initializes a new instance of the SocksClient class.</summary>
 ///<param name="ClientSocket">The Socket connection between this proxy server and the local client.</param>
 ///<param name="Destroyer">The method to be called when this SocksClient object disconnects from the local client and the remote server.</param>
 ///<param name="AuthList">The list with valid username/password combinations.</param>
 ///<remarks>If the AuthList is non-null, every client has to authenticate before he can use this proxy server to relay data. If it is null, the clients don't have to authenticate.</remarks>
 public SocksClient(SocketConnection ClientSocket, DestroyDelegate Destroyer, AuthenticationList AuthList) : base(ClientSocket, Destroyer)
 {
     this.AuthList = AuthList;
     this.Secure   = true;
 }