bool Authenticate(Connection connection, string login, string password)
        {
            if (!Authentication.Instance.Authenticate(connection, login, password))
                return false;

            authenticatedClients.Add(connection);
            connection.Closed += HandleAuthenticatedClientDisconnected;

            if (OnAuthenticated != null)
                OnAuthenticated(connection);

            foreach (var entry in authenticatedMethods)
                connection.RegisterFuncImplementation(entry.Key, entry.Value);

            WrapUpdateMethods(connection);
            if (NewClientConnected != null)
                NewClientConnected(this, new ClientConnectionEventArgs(connection));
            return true;
        }
예제 #2
0
파일: Server.cs 프로젝트: rryk/omp-addon
 private void HandleNewClient(string servicepath, WebSocketHttpServerHandler handler)
 {
     Connection conn = new Connection(new WSConnectionWrapper(handler));
     conn.LoadIDL("http://yellow.cg.uni-saarland.de/home/kiara/idl/interface.kiara");
     conn.LoadIDL("http://yellow.cg.uni-saarland.de/home/kiara/idl/connectServer.kiara");
     conn.RegisterFuncImplementation("omp.interface.implements", "...",
         (Func<string, bool>)InterfaceImplements);
     conn.RegisterFuncImplementation("omp.connect.useCircuitCode", "...",
         (Action<UInt32, string, string>)((code, agentID, sessionID) =>
           ConnectUseCircuitCode(conn, code, agentID, sessionID)));
 }