title: How to set the timeout while using Zend_auth in Zend framework
body: <p>I am using Zend_auth for authentication purposes.Code for the same is as follows:</p>
  
  <pre><code>             $authAdapter = $this-&gt;getAuthAdapter();
              $authAdapter-&gt;setIdentity($username)
                      -&gt;setCredential($password);
              $auth = Zend_Auth::getInstance();
              $result = $auth-&gt;authenticate($authAdapter);
              # is the user a valid one?
              if ($result-&gt;isValid()) {
                  # all info about this user from the login table
                  # ommit only the password, we don't need that
                  $userInfo = $authAdapter-&gt;getResultRowObject(null, 'password');
  
                  # the default storage is a session with namespace Zend_Auth
                  $authStorage = $auth-&gt;getStorage();
                  $authStorage-&gt;write($userInfo);
                  $emp_id = $userInfo-&gt;employee_id;
                  $userInfo = Zend_Auth::getInstance()-&gt;getStorage()-&gt;read();
                  $array_db = new Application_Model_SetMstDb();
                  $array_name = $array_db-&gt;getName($emp_id);
  
                  foreach ($array_name as $name) :
                      $fname = $name['first_name'];
                      $lname = $name['last_name'];
                  endforeach;
  
                  $firstname = new stdClass;
                  $lastname = new stdClass;
                  $userInfo-&gt;firstname = $fname;
                  $userInfo-&gt;lastname = $lname;
  
                  $privilege_id = $userInfo-&gt;privilege_id;
                  echo 'privilege in Login: ' . $privilege_id;
                  $this-&gt;_redirect('index/index');
              } else {
                  $errorMessage = "Invalid username or password";
                  $this-&gt;view-&gt;error = $errorMessage;
                }
  </code></pre>
  
  <p>where getAuthAdapter() as follows:</p>
  
  <pre><code>     protected function getAuthAdapter() {
      $dbAdapter = Zend_Db_Table::getDefaultAdapter();
      $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
  
      $authAdapter-&gt;setTableName('credentials')
              -&gt;setIdentityColumn('employee_id')
              -&gt;setCredentialColumn('password');
  
  
      return $authAdapter;
  }
  </code></pre>
  
  <p>I want to set a session timeout.I want to set a timeout of 5 mins and when user does not being active for 5 mins then session should be expired that is logout action should be called whose code is as follows:</p>
  
  <pre><code>      public function logoutAction() {
      // action body
      Zend_Auth::getInstance()-&gt;clearIdentity();
      $this-&gt;_redirect('login/index');
     }
  </code></pre>
  
  <p>Thanks in advance.Plz Help me.Its urgent.</p>
  
  <p>When I use </p>
  
  <pre><code>    $session = new Zend_Session_Namespace( 'Zend_Auth' ); 
      $session-&gt;setExpirationSeconds( 60 ); 
  </code></pre>
  
  <p>control redirects to login page automatically after 60 seconds but I want that if the user of the application in inactive for 60 seconds then only it redirects.At present whether user is active or not redirection occurs.</p>