/**
  * getAuth checks Active Directory for valid credentials and returns true if they are found.
  * @param array $cred
  * @return bool
  * @see Staple_AuthAdapter::getAuth()
  */
 public function getAuth($cred)
 {
     if ($this->checkConfig($this->_settings)) {
         if (array_key_exists('username', $cred) and array_key_exists('password', $cred)) {
             if (strlen($cred['username']) >= 1 && strlen($cred['password']) >= 1) {
                 if (Staple_AD::validchars($cred['username']) == TRUE && Staple_AD::validchars($cred['password']) == TRUE) {
                     $pass = $cred['password'];
                     $LDAP = Staple_AD::get();
                     $this->uid = $cred['username'];
                     if ($LDAP->bind($this->uid, $pass)) {
                         return true;
                     }
                 }
             }
         }
     }
     return false;
 }