コード例 #1
0
        public void CreateAuthManager()
        {
            // Very Important: Before we start the monitoring thread
            // We need to keep the data in the new authserver up to date
            // We need to lock the m_SyncRequestQueue so that no synchronization request will be served in the mean time
            // Then we copy the data in an arbitrary existing AuthManager instance, 
            // This depends on the correct implementation of copy constructor of AuthManager and its data member
            // note that we do not lock the AuthManager instance we are going to copy
            // So that we are not going to exprience the deadlock
            // If the AuthManager is being modified by serving some requests, the new instance will be updated later
            
            // Sleep a little bit first before we start: for random number generator
            Thread.Sleep(5);

            lock (m_SyncRequestQueue)
            {
                int ID = m_AuthManagerList.Count;
                AuthManager am;
                if (ID == 0)
                {
                    am = new AuthManager();
                }
                else
                {
                    am = new AuthManager(m_AuthManagerList[0]);
                }
                AuthManagerMoniterThread ammt = new AuthManagerMoniterThread(ID, m_RequestQueue, am, m_ReturnRequestQueue, m_SyncRequestQueue);
                m_AuthManagerList.Add(am);
                m_AuthManagerMoniterThreadList.Add(ammt);

#if DEBUG
                Console.WriteLine("Create a AuthManager, ID: " + ID + " , Good Luck!");
#endif
                Thread td = new Thread(new ThreadStart(ammt.proc));
                m_MoniterThreadList.Add(td);
                td.Start();
            }
        }
コード例 #2
0
 // Call this function only with am locked
 private void ProcessSynchronizeRequest(AuthManager am, SynchronizeRequest syncreq)
 {
     Request req = syncreq.m_Request;
     string msg = "";
     switch (req.m_RequestType)
     {
         // If we created a new user, just call the Register function
         case RequestType.CreateUser:
             am.Register(req.m_Username, req.m_Password, out msg);
             break;
         // If we generate a token for a user, we need to create this token for other co-existing authservers
         case RequestType.Authenticate:
             am.AddSynchronizedToken(req.m_Token, req.m_Username, syncreq.m_ExpTime);
             break;
         default:
             break;
     }
 }
コード例 #3
0
 public AuthManagerMoniterThread(int ID, BlockingQueue<Request> bQ, AuthManager authManager, BlockingQueue<ReturnRequest> bQReturn, BlockingQueue<SynchronizeRequest> bQSync)
 {
     m_RequestQueue = bQ;
     m_AuthManager = authManager;
     m_ID = ID;
     m_ReturnRequestQueue = bQReturn;
     m_SyncRequestQueue = bQSync;
 }
コード例 #4
0
ファイル: AuthImplement.cs プロジェクト: Logeshkumar/Projects
 public AuthImplement(AuthManager mgr) 
 {
     m_Mgr = mgr;     
 }
コード例 #5
0
 /// <summary>
 /// Constructor of the class
 /// </summary>
 public AuthCommService() 
 {
     AuthMgr = new AuthManager();
 }
コード例 #6
0
ファイル: AuthManager.cs プロジェクト: Logeshkumar/Projects
  //Copy Constructor
 public AuthManager(AuthManager am)
 {
     //m_File = new CredentialFile(am.m_File);
     //m_TokenMgr = new TokenManager(am.tokenMgr);
 }
コード例 #7
0
ファイル: AuthValidate.cs プロジェクト: Logeshkumar/Projects
 public AuthValidate(AuthManager mgr) 
 {
     m_Mgr = mgr;     
 }
コード例 #8
0
ファイル: AuthServer.cs プロジェクト: Logeshkumar/Projects
        public AuthServer(AuthManager mgr) 
        {
 
        }