Example #1
0
 /**
  * Handles login using this service.
  *
  * @param array $credential
  * @param bool  $remember
  *
  * @return array
  * @throws \DreamFactory\Core\Exceptions\UnauthorizedException
  */
 public function handleLogin(array $credential, $remember = false)
 {
     $username = ArrayUtils::get($credential, 'username');
     $password = ArrayUtils::get($credential, 'password');
     $auth = $this->driver->authenticate($username, $password);
     if ($auth) {
         $ldapUser = $this->driver->getUser();
         $user = $this->createShadowADLdapUser($ldapUser);
         $user->last_login_date = Carbon::now()->toDateTimeString();
         $user->confirm_code = null;
         $user->save();
         Session::setUserInfoWithJWT($user, $remember);
         return Session::getPublicInfo();
     } else {
         throw new UnauthorizedException('Invalid username and password provided.');
     }
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function getDomain()
 {
     $baseDn = $this->driver->getBaseDn();
     return $this->driver->getDomainName($baseDn);
 }