Authenticate calendar and user
@return bool
499024
public static function authenticate() {
		$credentials = array(
			'calendar_guid' => (int) get_input('guid'),
			'user_guid' => (int) get_input('u'),
			'token' => get_input('t'),
		);

		$pam = new ElggPAM(self::POLICY);
		$authenticated = $pam->authenticate($credentials);
		if (!$authenticated) {
			throw new LoginException($pam->getFailureMessage());
		} else {
			$user = get_entity($credentials['user_guid']);
			login($user);
		}
		return $authenticated;
	}
165544
public function login()
    {
        if ($this->validate()) {
            return Yii::getApp()->getUser()->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0);
        }
        return false;
    }
306955
public function authenticate()
    {
        $u = $this->authenticateBySession();
        if ($u) {
            return $u;
        }

        $u = $this->authenticateByToken();
        if ($u) {
            return $u;
        }

        return null;
    }
159356
private function authenticate()
    {
        $form = new RemoteIdentityForm;
        $form->attributes = array(
            'adapter'  => $this->getUserProfile(),
            'provider' => $this->getProvider()
        );

        return $form->login();
    }
44721
public function authUser()
    {
        $session = $this->Controller->request->session();
        if ($session->check('Auth.CakeAdmin')) {
            return $session->read('Auth.CakeAdmin');
        }
        return false;
    }
129340
public function authenticate()
    {
        $object = 'login';
        $url = sprintf('/api/%s/version/%s', $object, $this->version);
        $parameters = array(
            'email'    => $this->email,
            'password' => $this->password,
            'user_key' => $this->userKey,
            'format'   => $this->format
        );

        $this->apiKey = $this->doPost($object, $url, $parameters);

        return $this->apiKey;
    }
906399
function authenticate() {
        switch ($this->_passwordAuthenticationPlatform) {
            case \USERCREDENTIAL_PASSWORDLOGINPLATFORM_NATIVE:
                return $this->authenticateNative();
            case \USERCREDENTIAL_PASSWORDLOGINPLATFORM_LDAP:
                return $this->authenticateLDAP();
            default:
                throw new UserCredentialException('Unknown native authentication platform requested');
        }
    }
305557
public function isAuthenticated()
    {
        if ($this->isAuthenticated === null) {
            try {
                $this->authenticate();
            } catch (AuthenticationRequiredException $exception) {
            }
        }
        return $this->isAuthenticated;
    }
614185
public function authenticate() {
        /* Anti Injection de login */
        $login1 = Security\AntiInjection::antiSqlInjection1($this->getIdentity());
        $login2 = Security\AntiInjection::antiSqlInjection2($login1);
        $identity = Security\AntiInjection::antiSqlInjection3($login2);

        /* Anti Injection de senha */
        $senha1 = Security\AntiInjection::antiSqlInjection1($this->getCredential());
        $senha2 = Security\AntiInjection::antiSqlInjection2($senha1);
        $senha3 = Security\AntiInjection::antiSqlInjection3($senha2);

        /* Criptografa a senha */
        $crypt = new Security\Crypt();
        $credential = $crypt->encrypt($senha3);

        //Define os dados para processar o login
        $this->setIdentity($identity)->setCredential($credential);

        //Faz inner join dos dados do perfil no SELECT do Auth_Adapter
        $select = $this->getDbSelect();

        if (!empty($this->whereConditions)) {
            foreach ($this->whereConditions as $valueWhereConditions) {
                $select->where($valueWhereConditions);
            }
        }

        //Efetua o login
        $result = parent::authenticate();

        //Verifica se o login foi efetuado com sucesso
        if ($result->isValid()) {
            //Recupera o objeto do usuário, sem a senha
            $info = $this->getResultRowObject($this->returnColumns, $this->credentialColumn);

            $storage = new SessionStorage();
            $storage->write($info);

            if ($result->getCode()) {
                return new ResultValidation(ResultValidation::SUCCESS, ((array) $info));
            } else {
                return new ResultValidation(ResultValidation::FAILURE, null);
            }
        } else {
            return new ResultValidation(ResultValidation::FAILURE, null);
        }
    }
377451
protected function authenticate()
    {
        $headers = [
            'Accept: application/json',
            'Content-Type: application/json; charset=utf-8',
        ];

        if (!empty($this->secret_token)) {
            $headers[] = 'X-AppSecretToken:'.$this->secret_token;
        }

        if (!empty($this->grant_token)) {
            $headers[] = 'X-AgreementGrantToken:'.$this->grant_token;
        }

        //default headers
        $options = [
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_SSL_VERIFYPEER => true,
            CURLOPT_HTTPAUTH       => CURLAUTH_BASIC,
            CURLOPT_HTTPHEADER     => $headers,
        ];

        curl_setopt_array($this->ch, $options);
    }
1238412
public function authenticate()
    {
        $code = $this->getMvcEvent()->getRequest()->getQuery('code');
        if(!$code) {
            return new Result(
                $this->authenticationService,
                Result::FAILURE_CREDENTIAL_INVALID,
                array(),
                array("No 'code' available")
            );
        }
        
        try {
            $provider = $this->getProvider();
            $token = $provider->getAccessToken('authorization_code', ['code' => $code]);
            
            $userProfile = $provider->getUserDetails($token);
            
            $res = new OAuth2Result(
                $this->authenticationService,
                Result::SUCCESS,
                $userProfile->uid
            );
            $res->setUserProfile($this->createUserProfile($userProfile));
            
            $res->setAccessToken($token->accessToken);
            $res->setRefreshToken($token->refreshToken);
            $res->setExpiresIn($token->expires);
            
            return $res;
            
        } catch(\Exception $e) {
            return new Result(
                $this->authenticationService,
                Result::FAILURE_CREDENTIAL_INVALID,
                $code,
                array($e->getMessage())
            );
        }
    }
210248
public function ajaxauthenticateAction()
    {
        // $this->getServiceLocator()->get('Zend\Log')->info('ajaxloginAction -
        // AUTHENT : ');
        if ($this->zfcUserAuthentication()
            ->getAuthService()
            ->hasIdentity()) {
            return true;
        }
        $adapter = $this->zfcUserAuthentication()->getAuthAdapter();
        $adapter->prepareForAuthentication($this->getRequest());
        $auth = $this->zfcUserAuthentication()->getAuthService()->authenticate($adapter);

        if (! $auth->isValid()) {
            $adapter->resetAdapters();

            return false;
        }

        $user = $this->zfcUserAuthentication()->getIdentity();

        if ($user->getState() && $user->getState() === 2) {
            $this->getUserService()->getUserMapper()->activate($user);
        }
        $this->getEventManager()->trigger('login.post', $this, array('user' => $user));
        return true;
    }
277149
public function login() {

		if ( $this->validate() ) {

			$user = $this->getUser();

			if( $this->admin ) {

				$user->loadPermissions();

				if( !$user->isPermitted( CoreGlobal::PERM_ADMIN ) ) {

					$this->addError( "email", Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_NOT_ALLOWED ) );

					return false;
				}
			}

			$user->lastLoginAt = DateUtil::getDateTime();

			$user->save();

			return Yii::$app->user->login( $user, $this->rememberMe ? $this->interval : 0 );
		}

		return false;
	}
147547
public function forceAuthentication()
    {
        if (self::isAuthenticated()) {
            return true;
        } elseif ($this->getTicket()) {
            return $this->validateCas();
        }
        session_write_close();
        $this->redirectToCas();
        // never reached
        return true;
    }
1225827
public function isAuthenticated()
    {
        try {
            $session = $this->sessionStorage->retrieveAccessToken($this->getServiceName());
            if (!$session) {
                return false;
            }
            return $session->getEndOfLife() > time();
        } catch (TokenNotFoundException $e) {
            return false;
        }
    }
1217256
public function authenticate()
	{
		// Backwards compatibility for Contao 4.4
		if (!$this instanceof UserInterface) {
			if ($this->frontendHelperUserAuthenticated === null) {
				$this->frontendHelperUserAuthenticated = \User::authenticate();
			}
			return $this->frontendHelperUserAuthenticated;
		}

		return $this->username && $this->intId;
	}
450041
public function authenticate()
    {
        /* @var $user \Grid\User\Model\User\Structure */
        $user = $this->getModel()
                     ->findByEmail( $this->email );

        if ( empty( $user ) )
        {
            return new Result( Result::FAILURE_IDENTITY_NOT_FOUND, null );
        }

        if ( ! $user->isActive() ||
             ! $user->verifyPassword( $this->password, true ) )
        {
            return new Result( Result::FAILURE_CREDENTIAL_INVALID, null );
        }

        return new Result( Result::SUCCESS, $user );
    }