Return the credentials based on the user name and password.

@return Credentials
190957
public Credentials getCredentials() {
        String username = getUsername();
        char[] password = getPassword();
        if (username != null) {
            return new SimpleCredentials(username, password);
        }
        return null;
    }
1303394
public function getBasicAuth()
    {
        if (empty($this->basicAuth))
            return "";

        if (empty($this->basicAuth["username"]))
            // Username cannot be empty in Basic Authentication
            return "";

        $username = $this->basicAuth["username"];
        $password = isset($this->basicAuth["password"]) ? $this->basicAuth["password"] : "";
        return sprintf("%s:%s@", $username, $password);
    }
593243
protected function getAuth()
    {
        if (isset($this->auth['username']) && isset($this->auth['password'])) {
            return [$this->auth['username'], $this->auth['password']];
        }
    }
442092
public function getRsaPublicKey()
    {
        if ($this->rsaPublicKey) {
            return $this->rsaPublicKey;
        }

        if (!file_exists($this->rsaPublicKeyFile)) {
            throw new CredentialsException('Could not read the public key file.');
        }

        $this->rsaPublicKey = openssl_get_publickey(file_get_contents($this->rsaPublicKeyFile));

        if (!$this->rsaPublicKey) {
            throw new CredentialsException('Cannot access public key for signing');
        }

        return $this->rsaPublicKey;
    }
500914
public function getAuthority()
    {
        return ($this->getUserInfo() !== '') ? $this->getUserInfo().
        '@' : ''.$this->getHost().($this->getPort() !== '') ? ':'.$this->getPort() : '';
    }
1177041
protected function getCredentials() {
        if (!$this->_credentials) {
            $this->_credentials = new CredentialList(
                $this->version,
                $this->solution['accountSid'],
                $this->solution['sid']
            );
        }

        return $this->_credentials;
    }
947808
public function retrieveByCredentials(array $credentials)
    {
        $criteria = [];
        foreach ($credentials as $key => $value) {
            if (!Str::contains($key, 'password')) {
                $criteria[$key] = $value;
            }
        }

        return $this->getRepository()->findOneBy($criteria);
    }
969847
public function clientCredentials()
    {
        if (! $this->credentials) {
            // $this->credentials = new ClientCredentials;
            $this->credentials = new Credentials('client_credentials');

            // Get API endpoints
            $this->endpointDiscovery();

            // Acquire the tokens and expiration and save
            $body = $this->acquireToken();
            $this->credentials->set($body);

            // Add credentials to the cache
            $creds = serialize($this->credentials);
            $expiration = $this->credentials->getExpiration();
            $this->cache->put($this->cacheKey, $creds, $expiration );
        }

        return $this;
    }
458574
private function getRootCredentials()
	{
		$secrets   = DIRECTORY_SEPARATOR . 'etc'  . DIRECTORY_SEPARATOR . 'hubzero.secrets';
		$conf_file = DIRECTORY_SEPARATOR . 'root' . DIRECTORY_SEPARATOR . '.my.cnf';
		$hub_maint = DIRECTORY_SEPARATOR . 'etc'  . DIRECTORY_SEPARATOR . 'mysql' . DIRECTORY_SEPARATOR . 'hubmaint.cnf';
		$deb_maint = DIRECTORY_SEPARATOR . 'etc'  . DIRECTORY_SEPARATOR . 'mysql' . DIRECTORY_SEPARATOR . 'debian.cnf';

		if (is_file($secrets) && is_readable($secrets))
		{
			$conf = Processor::instance('ini')->parse($secrets);
			$user = (isset($conf['DEFAULT']['MYSQL-ROOT-USER'])) ? $conf['DEFAULT']['MYSQL-ROOT-USER'] : 'root';
			$pw   = (isset($conf['DEFAULT']['MYSQL-ROOT'])) ? $conf['DEFAULT']['MYSQL-ROOT'] : false;

			if ($user && $pw)
			{
				return array('user' => $user, 'password' => $pw);
			}
		}

		if (is_file($conf_file) && is_readable($conf_file))
		{
			$conf = Processor::instance('ini')->parse($conf_file, true);
			$user = (isset($conf['client']['user'])) ? $conf['client']['user'] : false;
			$pw   = (isset($conf['client']['password'])) ? $conf['client']['password'] : false;

			if ($user && $pw)
			{
				return array('user' => $user, 'password' => $pw);
			}
		}

		if (is_file($hub_maint) && is_readable($hub_maint))
		{
			$conf = Processor::instance('ini')->parse($hub_maint, true);
			$user = (isset($conf['client']['user'])) ? $conf['client']['user'] : false;
			$pw   = (isset($conf['client']['password'])) ? $conf['client']['password'] : false;

			if ($user && $pw)
			{
				return array('user' => $user, 'password' => $pw);
			}
		}

		if (is_file($deb_maint) && is_readable($deb_maint))
		{
			$conf = Processor::instance('ini')->parse($deb_maint, true);
			$user = (isset($conf['client']['user'])) ? $conf['client']['user'] : false;
			$pw   = (isset($conf['client']['password'])) ? $conf['client']['password'] : false;

			if ($user && $pw)
			{
				return array('user' => $user, 'password' => $pw);
			}
		}

		return false;
	}
144243
protected function getListCredential()
    {
        $options = $this->query_filter;
        $options['limit'] = $this->data_limit;

        return $this->credential->getList($options);
    }
1133587
public function getUser()
    {
        if (empty($this->obHelper)) {
            return null;
        }

        $sAuthFacadeClass = $this->obHelper->getAuthFacade();

        return $sAuthFacadeClass::getUser();
    }
469879
protected function getRepositoryCredentials()
    {
        $config = (array) $this->config->getContextually('vcs');
        $credentials = (array) $this->localStorage->get('credentials');

        return array_merge($config, $credentials);
    }
1204439
public Credentials userSignIn(Credentials credentials) throws DAOException {
            Credentials dbCreds = getUserByEmail(dao,credentials.getEmailAddress());
            if (dbCreds == null){
                throw new DAOException(HttpStatus.SC_UNAUTHORIZED,"User Doesnt exist");
            }
            else {
                //check if we are resetting the password
                if(dbCreds.getValidation()!=null && dbCreds.getValidation().equals(credentials.getValidation())){
                    credentials.decryptPassword(keyManager.getPrivateKey()); //decrypt the password
                    dbCreds.setPassword(BCrypt.hashpw(credentials.getPassword(), BCrypt.gensalt(10))); //set the new password
                }
                //else check password
                else {
                    String en = credentials.getPassword();
                    credentials.decryptPassword(keyManager.getPrivateKey()); //decrypt the password
                    String de = credentials.getPassword();
                    String ha = BCrypt.hashpw(de, BCrypt.gensalt(10));
                    System.out.println("Comparing passwords.\n" +
                            "Encrypted: " + en + "\n" +
                            "Decrypted: " + de + "\n" +
                            "Hashed:    " + ha + "\n" +
                            "Stored:    " + dbCreds.getPassword());
                    if (!BCrypt.checkpw(de, dbCreds.getPassword())){
                        throw new DAOException(HttpStatus.SC_UNAUTHORIZED,"User Already Exists");
                    }
                }

//              check if token is expired, if so return/set new
                AuthTokenUtils.AuthToken token;
                try {
                    token = new AuthTokenUtils.AuthToken(keyManager.getSymmetricKey(),dbCreds.getAuthToken());
                } catch (AuthenticationException e) {
                    throw new DAOException(HttpStatus.SC_INTERNAL_SERVER_ERROR,"internal error");
                }
                if (c.getTime().getTime() > token.expirationDate) {
                    dbCreds.setAuthToken(AuthTokenUtils.getNewToken(keyManager.getSymmetricKey(), dbCreds));
                    dao.save(dbCreds);
                }

                return dbCreds;
            }
    }
863644
public function authenticate()
	{
		$username = $this->input->get('username', false, 'username');
		$password = $this->input->get('password', false, 'raw');

		if (!$username || !$password)
		{
			$this->status = Authentication::NO_CREDENTIALS;

			return false;
		}

		return $this->doAuthenticate($username, $password);
	}
1339554
public function getConnectionsCredentials()
    {
        $connectionName = null;
        if ($this->connections) {
            $this->presentConnections($this->connections);
            if ($this->command->confirm('Do you want to add a connection to this?', false)) {
                $connectionName = $this->command->ask('What do you want to name it?');
            }
        } else {
            $connectionName = $this->command->ask('No connections have been set, let\'s create one, what do you want to name it?', 'production');
        }

        // If the user does not want to add any more connection
        // then we can quit
        if (!$connectionName) {
            return $this->connections;
        }

        $this->getConnectionCredentials($connectionName);

        return $this->getConnectionsCredentials();
    }
481716
public function getUser()
    {
        if (!isset($this->_user)) {
            $this->_user = new ComConnectOauthUser();
            $data = $this->_getUserData();
            if ($data) {
                foreach ($data as $key => $value) {
                    $this->_user->$key = $value;
                }
            }
        }

        return $this->_user;
    }
989152
public static function getCredential($userId)
    {
        $model = new User_Credential();
        $where = 'account_id = ' . $model->_toDb($userId, 'account_id');
        $creds = $model->getList(array(
            'filter' => $where
        ));
        if ($creds === false or count($creds) !== 1) {
            return false;
        }
        return $creds[0];
    }