@param $clientId
@param $username
@param $password

@return array|boolean
963905
protected function checkUserCredentials($clientId, $username, $password)
    {
        try {
            if (null === $client = $this->app['repo.api-applications']->findByClientId($clientId)) {
                return false;
            }
            $this->setClient($client);

            $usrId = $this->app['auth.native']->getUsrId($username, $password, Request::createFromGlobals());

            if (!$usrId) {
                return false;
            }

            if (null === $user = $this->app['repo.users']->find($usrId)) {
                return false;
            }

            $account = $this->updateAccount($user);

            return [
                'redirect_uri' => $this->client->getRedirectUri(),
                'client_id'    => $this->client->getClientId(),
                'account_id'   => $account->getId(),
            ];
        } catch (AccountLockedException $e) {
            return false;
        } catch (RequireCaptchaException $e) {
            return false;
        } catch (\Exception $e) {
            return false;
        }
    }
1361959
public function isPublicClient($clientId)
    {
        $client = $this->getClientDataMapper()->findByUuid($clientId);

        if (! $client instanceof Entity\Client) {
            return false;
        }

        return $client->isPublic();
    }
612069
public function checkClientCredentials($client_id, $client_secret = null)
    {
        return isset($this->clientCredentials[$client_id]['secret']) && $this->clientCredentials[$client_id]['secret'] === $client_secret;
    }
1157003
public function getUserEntityByUserCredentials(
        $username,
        $password,
        $grantType,
        ClientEntityInterface $clientEntity
    ) {
        $user = new \Concrete\Core\User\User($username, $password);
        if ($user && !$user->isError() && $user->isActive()) {
            return $this->getEntityManager()->getRepository(User::class)->find($user->getUserID());
        }
    }
455687
public function initialize($email, $password, array $clientConfig = [])
    {
        $mergedConfig = array_merge(
            $this->clientConfig,
            $clientConfig,
            [
                'headers' => [
                    'User-Agent' => "RIPS-API-Connector/{$this->version}",
                ],
            ],
            [
                'headers' => $this->getAuthHeaders($email, $password, $clientConfig)
            ]
        );

        $client = new Client($mergedConfig);
        $this->callbacks = new CallbackRequests($client);
        $this->applications = new ApplicationRequests($client);
        $this->licenses = new LicenseRequests($client);
        $this->logs = new LogRequests($client);
        $this->orgs = new OrgRequests($client);
        $this->quotas = new QuotaRequests($client);
        $this->settings = new SettingRequests($client);
        $this->sources = new SourceRequests($client);
        $this->status = new StatusRequests($client);
        $this->teams = new TeamRequests($client);
        $this->users = new UserRequests($client);
        $this->oauth2 = new OAuth2Requests($client);
        $this->activities = new ActivityRequests($client);
        $this->maintenance = new MaintenanceRequests($client);
        $this->languages = new LanguageRequests($client);
        $this->systems = new SystemRequests($client);
    }
967183
public function checkClientCredentials($client_id, $client_secret = null)
    {
        $result = $this->collection('client_table')->findOne(array('client_id' => $client_id));

        return $result['client_secret'] == $client_secret;
    }
1119318
public function login($username, $password)
    {
        $model       = $this->slice->getRequired('model');
        $loginFields = $this->slice->getRequired('loginFields');
        $hashField   = $this->slice->getRequired('hashField');

        $userQuery = $this->provider->auth()->orm()->repository($model);

        foreach ($loginFields as $field)
        {
            $userQuery->whereOr($field, $username);
        }

        $user = $userQuery->findOne();

        if ($user && $this->verify($password, $user->get($hashField)))
        {
            $this->provider->setUser($user);
        }

        return $user;
    }
447102
public function checkClientCredentials($client_id, $client_secret = null)
    {
        $sql    = sprintf('SELECT * from %s where client_id = :client_id', $this->config['client_table']);
        $result = $this->fetch($sql, compact('client_id'));

        // make this extensible
        return $result ? $result['client_secret'] == $client_secret : false;
    }
1142281
public function getClientDetails($client_id)
    {
        $result = $this->client->getItem(array(
            "TableName"=> $this->config['client_table'],
            "Key" => array('client_id'   => array('S' => $client_id))
        ));
        if ($result->count()==0) {
            return false ;
        }
        $result = $this->dynamo2array($result);
        foreach (array('client_id', 'client_secret', 'redirect_uri', 'grant_types', 'scope', 'user_id') as $key => $val) {
            if (!array_key_exists ($val, $result)) {
                $result[$val] = null;
            }
        }

        return $result;
    }
532767
public static function signIn($username , $password)
	{
		$ip = self::getClientIp();
		$ua = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? $_SERVER['HTTP_USER_AGENT'] : '';
		$ts = date("U");

		if ( self::isValidPassword($username , $password) ) {

			self::sessionWrite( array( 'username' => $username ) );
			self::reload();
			self::$auth['users'][ $username ]['logincount'] = (int) @self::$auth['users'][ $username ]['logincount'] + 1;
			self::$auth['users'][ $username ]['lastlogin'] = array(
				'ip' => $ip,
				'ua' => $ua,
				'ts' => $ts
			);
			self::log( 'signin' , $username , $ts , $ip , $ua );
			self::save();

			return self::$auth['users'][ $username ];
		}

		self::log( 'signinerr' , $username , $ts , $ip , $ua );
		self::save();

		return false;
	}
1035104
public function create($userId, $name, $redirect, $personalAccess = false, $password = false)
    {
        $client = (new Client)->forceFill([
            'user_id' => $userId,
            'name' => $name,
            'secret' => str_random(40),
            'redirect' => $redirect,
            'personal_access_client' => $personalAccess,
            'password_client' => $password,
            'revoked' => false,
        ]);

        $client->save();

        return $client;
    }
188624
public function authenticate($username, $password, array $scopes = [], array $client = [], $grant_type = 'password', $is_email = false)
	{
		$scope = implode(',', $scopes);

		$request_data = [
			'password'      => $password,
			'client_id'     => $client['client_id'],
			'client_secret' => $client['client_secret'],
			'grant_type'    => $grant_type,
			'scope'         => $scope,
		];

		if ($is_email) {
			$request_data['email'] = $username;
		} else {
			$request_data['username'] = $username;
		}

		$response = $this->post($this->oauthUrl(), $request_data)->getJson();

		// If this was a successful auth, set the access token
		if (isset($response->access_token)) {
			$this->access_tokens[$username] = $response->access_token;
		}

		return $response;
	}
490428
public function connect($username, $password)
    {
        $error = parent::connect($username, $password);

        if ($error) {
            return $error;
        }

        return $this->load_script();
    }
1369681
public function withCredentials($username, $password)
    {
        if (null === $username || null === $password) {
            // No change if credentials or null
            return $this;
        }

        $new = $this->setValue('username', $username)
            ->setValue('password', $password)
            ->setValue('credentials', [$username, $password]);

        // To keep BC
        $new->username = $username;
        $new->password = $password;
        $new->credentials = [$username, $password];

        return $new;
    }
34884
public function createClient(Client $client, $password)
    {
        $data = $client->toArray();
        $data['password_confirm'] = $data['password'] = $password;
        $data['send_email'] = 0;
        $data['submit'] = 'Save';

        $response = $this->post('/en/client/add', $data);

        if ($response->getStatusCode() == 200) {
            $error = $this->getBetween((string)$response->getBody(), '<ul class="errors">', '</ul>');
            $error = $this->getBetween($error, '<li>', '</li>');
            throw new YouHostingException("Unable to create profile: " . $error);
        }

        $response = $this->get($response->getHeader('Location'));

        $client->id = $this->getBetweenReverse((string)$response->getBody(), '/en/client/view/id/', '">' . $client->email);
        return $client;
    }
1374867
public function removeClientUser($client_id, $user_id)
    {
        $sql    = 'DELETE from %s where client_id = :client_id and user_id = :user_id';
        $sql    = sprintf($sql, $this->config['client_user_table']);
        $params = array_map('trim', compact('client_id', 'user_id'));

        return $this->db->prepare($sql)->execute($params);
    }
1051364
public function getClientDetails($client_id)
    {
        if (!isset($this->clientCredentials[$client_id])) {
            return false;
        }

        $clientDetails = array_merge(array(
            'client_id'     => $client_id,
            'client_secret' => null,
            'redirect_uri'  => null,
            'scope'         => null,
        ), $this->clientCredentials[$client_id]);

        return $clientDetails;
    }