public static void checkInClient(MyClientContainer client, String cookieValue) { string cookie = cookieValue.Trim(); client.SessionVariables.Cookie = cookieValue; cookieTable.Add(cookie, client); //handle permissions with enum member of ClientContainer }
protected override IProtocolMatcher[] generateProtocolEngines(TcpClient client) { string endpoint = client.Client.RemoteEndPoint.ToString(); string ip = endpoint.Substring(0, endpoint.IndexOf(':')); foreach (string addr in blocked) { if (ip.Equals(addr)) { Disconnect(client); return(null); } } MyClientContainer Client = new MyClientContainer(client); Client.SessionVariables = new SessionInfo() { IsAuthenticated = false }; if (Connected != null) { Connected(Client); } return(new IProtocolMatcher[] { new HttpProtocolMatcher() { Engine = new myHttpEngine(client.GetStream(), Client) } }); }
public static void sDisconnect(MyClientContainer client) { if (Disconnected != null) { Disconnected(client); } }
//protected override void proccessHttp(HttpEngine http, String message) //{ // App.Log.logEvent(message, Event.EVENT_FLAGS.NORMAL | Event.EVENT_FLAGS.DEBUG); // base.proccessHttp(http, message); //} public virtual void Disconnect(MyClientContainer client) { // if (Disconnected != null) { Disconnected(client); } base.Disconnect(client.getClient()); }
//Check client username is the right seed for password cookie public static bool setSession(MyClientContainer client) { try { MyClientContainer matchingClient = cookieTable[client.Cookies[myHttpEngine.SESSIONID_COOKIE_PASSWORD].Trim()]; client.SessionVariables = matchingClient.SessionVariables; //Syncs the two sessions //client.Auth = ""; // MyClientContainer needs this value for the GUI return(true); } catch (KeyNotFoundException) { return(false); } }
public myHttpEngine(Stream networkStream, MyClientContainer client) : base(networkStream, client.getClient()) { //Only rewrite clientcontainer vlues if it is recognized that they are missing. //se then on / request //this.client = new ClientContainer(client); this.client = client; needsUpdate = true; isFirst = true; //addPageMutation("{RSAKEY}", BitConverter.ToString(Bouncer.rcsp.ExportParameters(false).Modulus).Replace("-", "")); //addPageMutation("{RSAEX}", BitConverter.ToString(Bouncer.rcsp.ExportParameters(false).Exponent, 0).ToString().Replace("-", "")); //feedRemoteListHtml(); }
public static bool isServerMaster(MyClientContainer client) { return(true); }
public static void allowClient(MyClientContainer client, string username) { client.SessionVariables.Auth = username; allowClient(client); }
public static void allowClient(MyClientContainer client) { client.SessionVariables.IsAuthenticated = true; }
public void RefreshClientInfo(MyClientContainer client) { //Dispatcher.Invoke(new Action(() => mylist.Add(client))); }
public void ConnectionInit(MyClientContainer client) { Dispatcher.Invoke(new Action(() => mylist.Add(client))); }
public void ConnectionDisconnect(MyClientContainer client) { Dispatcher.Invoke(new Action(() => mylist.Remove(client))); }