Beispiel #1
0
 /**
  * Constructor
  *
  * @param \Jazzee\Interfaces\AdminController
  */
 public function __construct(\Jazzee\Interfaces\AdminController $controller)
 {
     if (!$controller->isPreviewMode()) {
         throw new \Jazzee\Exception('Preview mode authentication is only available in preview mode.');
     }
     $this->_controller = $controller;
     if ($this->_controller->getStore()->check(self::SESSION_VAR_ID)) {
         $this->_user = $this->_controller->getEntityManager()->getRepository('\\Jazzee\\Entity\\User')->find($this->_controller->getStore()->get(self::SESSION_VAR_ID));
     }
 }
 /**
  * Constructor
  *
  * @param \Jazzee\Interfaces\AdminController
  */
 public function __construct(\Jazzee\Interfaces\AdminController $controller)
 {
     $this->_controller = $controller;
     if ($controller->getConfig()->getStatus() != 'DEVELOPMENT' and $controller->getConfig()->getStatus() != 'PREVIEW') {
         throw new \Jazzee\Exception('Attmpted to use ApiFormAuthentication in a production environment.');
     }
     if ($this->_controller->getStore()->check(self::SESSION_VAR_ID)) {
         $this->_user = $this->_controller->getEntityManager()->getRepository('\\Jazzee\\Entity\\User')->find($this->_controller->getStore()->get(self::SESSION_VAR_ID));
     }
 }
Beispiel #3
0
 /**
  * Constructor
  *
  * Grab the desired user from the configuration file and log in as them
  * @param \Jazzee\Interfaces\AdminController
  */
 public function __construct(\Jazzee\Interfaces\AdminController $controller)
 {
     $this->_controller = $controller;
     if (!in_array($controller->getConfig()->getStatus(), array('DEVELOPMENT', 'PREVIEW'))) {
         throw new \Jazzee\Exception('Attmpted to use NoAuthentication in a non development/preview environment.');
     }
     if ($this->_controller->getStore()->check(self::SESSION_VAR_ID)) {
         $this->_user = $this->_controller->getEntityManager()->getRepository('\\Jazzee\\Entity\\User')->find($this->_controller->getStore()->get(self::SESSION_VAR_ID));
     }
 }
Beispiel #4
0
 /**
  * @SuppressWarnings(PHPMD.ExitExpression)
  */
 public function logoutUser()
 {
     $this->_user = null;
     $this->_controller->getStore()->expire();
     header('Location: ' . $this->_controller->getConfig()->getShibbolethLogoutUrl());
     exit(0);
 }
Beispiel #5
0
 /**
  * Constructor
  *
  * Require authentication and setup the user if a valid session is detected
  *
  * @param \Jazzee\Interfaces\AdminController
  */
 public function __construct(\Jazzee\Interfaces\AdminController $controller)
 {
     $config = $controller->getConfig();
     require_once $config->getSimpleSAMLIncludePath();
     $this->_as = new \SimpleSAML_Auth_Simple($config->getSimpleSAMLAuthenticationSource());
     $this->_as->requireAuth();
     $attrs = $this->_as->getAttributes();
     if (!isset($attrs[$config->getSimpleSAMLUsernameAttribute()][0])) {
         throw new Exception($config->getSimpleSAMLUsernameAttribute() . ' attribute is missing from authentication source.');
     }
     $this->_user = $controller->getEntityManager()->getRepository('\\Jazzee\\Entity\\User')->findOneBy(array('uniqueName' => $attrs[$config->getSimpleSAMLUsernameAttribute()][0], 'isActive' => true));
     if ($this->_user) {
         $this->_user->setFirstName($attrs[$config->getSimpleSAMLFirstNameAttribute()][0]);
         $this->_user->setLastName($attrs[$config->getSimpleSAMLLastNameAttribute()][0]);
         $this->_user->setEmail($attrs[$config->getSimpleSAMLEmailAddressAttribute()][0]);
         $controller->getEntityManager()->persist($this->_user);
     }
 }