Skip to content

Instantly share code, notes, and snippets.

@caleywoods
Created February 19, 2012 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caleywoods/8b2ae80e23543a34ca8a to your computer and use it in GitHub Desktop.
Save caleywoods/8b2ae80e23543a34ca8a to your computer and use it in GitHub Desktop.
public function loginAction()
{
$params = $this->getRequest()->getParams();
$username = $params['username'];
$password = $params['password'];
// Check if DOM\ was used to login
$this->checkUsername($username);
$auth = Zend_Auth::getInstance();
/**
* Create a new ldap adapter using our options
* array and un/pw and then authenticate
*/
$config = new Zend_Config_Ini('../application/configs/application.ini', 'development');
$adapter = new Zend_Auth_Adapter_Ldap($config->ldap->toArray(), $username, $password);
$result = $auth->authenticate($adapter);
/**
* This holds the user information culled from AD
* DOM does some things in regards to where props
* are stored. We're pushing it into the session.
*
* description = employee number (also available as employeeid or employeenumber)
* it's stored in description because you can't see employeeid or num
* in the AD Users&Computers tool.
* mobile = dept number
*
* @return stdClass|boolean
*/
$this->employeeSession->_accountDetails = $adapter->getAccountObject();
/**
* Build the user object using the employeeid
* from AD
* @return Whiteboard_Model_User
*/
$user = new Whiteboard_Model_User();
$user->_employee_id = $this->employeeSession->_accountDetails->employeeid;
$user->userComplete();
Zend_Debug::dump($auth->getIdentity());
Zend_Debug::dump(Zend_Session::getId());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment