Check to ensure the auth parameters
satisfy the rule of the guard

@param array  $auth
@param array  $signature
@param string $prefix
@throws SignatureSignatureException
@return bool
182205
public function check(array $auth, array $signature, $prefix)
    {
        if (! isset($auth[$prefix . 'signature'])) {
            throw new SignatureSignatureException('The signature has not been set');
        }

        if ($auth[$prefix . 'signature'] !== $signature[$prefix . 'signature']) {
            throw new SignatureSignatureException('The signature is not valid');
        }

        return true;
    }
264581
protected function hasCredentials(array $credentials, $guard = null)
    {
        $provider = $this->app->make('auth')->guard($guard)->getProvider();

        $user = $provider->retrieveByCredentials($credentials);

        return $user && $provider->validateCredentials($user, $credentials);
    }
254815
private function checkAuthentication(array $authorization, $method, $password)
    {
        $A1 = md5("{$authorization['username']}:{$this->realm}:{$password}");
        $A2 = md5("{$method}:{$authorization['uri']}");

        $validResponse = md5("{$A1}:{$authorization['nonce']}:{$authorization['nc']}:{$authorization['cnonce']}:{$authorization['qop']}:{$A2}");

        return $authorization['response'] === $validResponse;
    }
1199037
public function validateSignature(string $secret, SignatureValidator $validator)
    {
        if (!$validator->isValid($this->payload, $secret, $this->signature)) {
            throw new \InvalidArgumentException("Invalid signature");
        }
    }
848043
public function verifyCallback($body, $signature)
    {
        $signature_buffer = base64_decode( $signature );
        return (1 == openssl_verify($body, $signature_buffer, self::getCallbackPublicKey(), OPENSSL_ALGO_SHA256));
    }
138710
public static function verifyMessageSignature($secret, $body = null, $signature = null) {

		// Compute hash of message using shared secret:
		$body = is_null($body) ? file_get_contents('php://input') : $body;
		$hash = base64_encode(hash_hmac('sha256', $body, $secret, true));

		// Compare hash to the signature:
		$signature = is_null($signature) ? $_SERVER['HTTP_X_ACUITY_SIGNATURE'] : $signature;
		if ($hash !== $signature) {
			throw new Exception('This message was forged!');
		}
	}
1003062
final protected function validateAgainstSignature(array $bill, ?string $signatureKey = null, array $parameters = []): bool
    {
        if (\is_null($signatureKey)) {
            return true;
        }

        if (! isset($bill['x_signature'])) {
            return false;
        }

        $signature = new Signature($signatureKey, $parameters);

        if (! $signature->verify($bill, $bill['x_signature'])) {
            throw new FailedSignatureVerification();
        }

        return true;
    }
1357061
public function normalizeSignatureCredentials(SignatureCredentials $credentials)
    {
        if (!$credentials instanceof AsymmetricCredentials) {
            throw new \InvalidArgumentException('RsaAlgorithms works with asymmetric credentials');
        }
        return array(
            'access_token' => $credentials->getMacId(),
            'mac_algorithm' => $credentials->getAlgorithm(),
            'public_key' => $credentials->getPublicKey(),
        );
    }
166655
public static function hasSignature($string, $signature)
    {
        if (ctype_xdigit($signature) === false) {
            throw new \InvalidArgumentException(sprintf('Invalid HEX signature provided: %s', $signature));
        }
        $signatureChars = str_split($signature, 2);
        $hexChars = array_map(
            function ($val) {
                return strtoupper(bin2hex($val));
            },
            str_split(substr($string, 0, count($signatureChars)))
        );

        return $hexChars === $signatureChars;
    }
225872
private function getAuthParams($prefix)
    {
        return array_intersect_key($this->params, array_flip($this->addPrefix($this->auth, $prefix)));
    }
1089990
public static function decodeCredentials($token, $auth) {
        try {
            return JWT::decode($token, $auth['key'], array('HS256'));
        } catch (SignatureInvalidException $e) {
            abortAuth(SignatureInvalidException::class);
        } catch (ExpiredException $e) {
            abortAuth(ExpiredException::class);
        }
    }
196881
private function buildAuthorizationHeader($signatureParameters) {
        $authorizationHeader = 'OAuth realm=""';
        
        foreach ($signatureParameters as $key=>$value) {
            $authorizationHeader.=','.$key."=".'"'.urlencode($value).'"';
        }
        return $authorizationHeader;
    }
682523
public function check(array $auth, array $signature, $prefix)
    {
        if (! isset($auth[$prefix . 'timestamp'])) {
            throw new SignatureTimestampException('The timestamp has not been set');
        }

        if (abs($auth[$prefix . 'timestamp'] - time()) >= $this->grace) {
            throw new SignatureTimestampException('The timestamp is invalid');
        }

        return true;
    }
573184
public function authenticate(string $auth)
    {
        if ($this->router === null) {
            return;
        }

        try {
            $response = $this->router->authenticate($auth, 'Basic');
            if (!($response instanceof Response)) {
                $response = new Response;
                $response->status = HttpResponse::HTTP_NO_CONTENT;
            }
            $response->output();
        } catch (RouterException $e) {
            $e->getResponse()->output();
        }
    }
644150
public function check_signature(Request $request, Consumer $consumer, Token $token, string $signature): bool
	{
		$built = $this->build_signature($request, $consumer, $token);
		return $built == $signature;
	}
329074
private function payload(array $auth, array $params)
    {
        $payload = array_merge($auth, $params);
        $payload = array_change_key_case($payload, CASE_LOWER);

        ksort($payload);

        return $payload;
    }
38572
public static final void signAuthToken(AuthToken token) {
        String signature = generateSignature(token);
        token.setSignature(signature);
    }