Subiendo proyecto completo sin restricciones de git ignore
This commit is contained in:
28
vendor/league/oauth1-client/tests/ClientCredentialsTest.php
vendored
Normal file
28
vendor/league/oauth1-client/tests/ClientCredentialsTest.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace League\OAuth1\Client\Tests;
|
||||
|
||||
use League\OAuth1\Client\Credentials\ClientCredentials;
|
||||
use Mockery as m;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ClientCredentialsTest extends TestCase
|
||||
{
|
||||
protected function tearDown(): void
|
||||
{
|
||||
m::close();
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testManipulating()
|
||||
{
|
||||
$credentials = new ClientCredentials;
|
||||
$this->assertNull($credentials->getIdentifier());
|
||||
$credentials->setIdentifier('foo');
|
||||
$this->assertEquals('foo', $credentials->getIdentifier());
|
||||
$this->assertNull($credentials->getSecret());
|
||||
$credentials->setSecret('foo');
|
||||
$this->assertEquals('foo', $credentials->getSecret());
|
||||
}
|
||||
}
|
||||
156
vendor/league/oauth1-client/tests/HmacSha1SignatureTest.php
vendored
Normal file
156
vendor/league/oauth1-client/tests/HmacSha1SignatureTest.php
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
|
||||
namespace League\OAuth1\Client\Tests;
|
||||
|
||||
use League\OAuth1\Client\Signature\HmacSha1Signature;
|
||||
use Mockery as m;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class HmacSha1SignatureTest extends TestCase
|
||||
{
|
||||
protected function tearDown(): void
|
||||
{
|
||||
m::close();
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testSigningRequest()
|
||||
{
|
||||
$signature = new HmacSha1Signature($this->getMockClientCredentials());
|
||||
|
||||
$uri = 'http://www.example.com/?qux=corge';
|
||||
$parameters = ['foo' => 'bar', 'baz' => null];
|
||||
|
||||
$this->assertEquals('A3Y7C1SUHXR1EBYIUlT3d6QT1cQ=', $signature->sign($uri, $parameters));
|
||||
}
|
||||
|
||||
public function testSigningRequestWhereThePortIsNotStandard()
|
||||
{
|
||||
$signature = new HmacSha1Signature($this->getMockClientCredentials());
|
||||
|
||||
$uri = 'http://www.example.com:8080/?qux=corge';
|
||||
$parameters = ['foo' => 'bar', 'baz' => null];
|
||||
|
||||
$this->assertEquals('ECcWxyi5UOC1G0MxH0ygm6Pd6JE=', $signature->sign($uri, $parameters));
|
||||
}
|
||||
|
||||
public function testQueryStringFromArray()
|
||||
{
|
||||
$array = ['a' => 'b'];
|
||||
$res = $this->invokeQueryStringFromData($array);
|
||||
|
||||
$this->assertSame(
|
||||
'a%3Db',
|
||||
$res
|
||||
);
|
||||
}
|
||||
|
||||
public function testQueryStringFromIndexedArray()
|
||||
{
|
||||
$array = ['a', 'b'];
|
||||
$res = $this->invokeQueryStringFromData($array);
|
||||
|
||||
$this->assertSame(
|
||||
'0%3Da%261%3Db',
|
||||
$res
|
||||
);
|
||||
}
|
||||
|
||||
public function testQueryStringFromMultiDimensionalArray()
|
||||
{
|
||||
$array = [
|
||||
'a' => [
|
||||
'b' => [
|
||||
'c' => 'd',
|
||||
],
|
||||
'e' => [
|
||||
'f' => 'g',
|
||||
],
|
||||
],
|
||||
'h' => 'i',
|
||||
'empty' => '',
|
||||
'null' => null,
|
||||
'false' => false,
|
||||
];
|
||||
|
||||
// Convert to query string.
|
||||
$res = $this->invokeQueryStringFromData($array);
|
||||
|
||||
$this->assertSame(
|
||||
'a%5Bb%5D%5Bc%5D%3Dd%26a%5Be%5D%5Bf%5D%3Dg%26h%3Di%26empty%3D%26null%3D%26false%3D',
|
||||
$res
|
||||
);
|
||||
|
||||
// Reverse engineer the string.
|
||||
$res = urldecode($res);
|
||||
|
||||
$this->assertSame(
|
||||
'a[b][c]=d&a[e][f]=g&h=i&empty=&null=&false=',
|
||||
$res
|
||||
);
|
||||
|
||||
// Finally, parse the string back to an array.
|
||||
parse_str($res, $original_array);
|
||||
|
||||
// And ensure it matches the orignal array (approximately).
|
||||
$this->assertSame(
|
||||
[
|
||||
'a' => [
|
||||
'b' => [
|
||||
'c' => 'd',
|
||||
],
|
||||
'e' => [
|
||||
'f' => 'g',
|
||||
],
|
||||
],
|
||||
'h' => 'i',
|
||||
'empty' => '',
|
||||
'null' => '', // null value gets lost in string translation
|
||||
'false' => '', // false value gets lost in string translation
|
||||
],
|
||||
$original_array
|
||||
);
|
||||
}
|
||||
|
||||
public function testSigningRequestWithMultiDimensionalParams()
|
||||
{
|
||||
$signature = new HmacSha1Signature($this->getMockClientCredentials());
|
||||
|
||||
$uri = 'http://www.example.com/';
|
||||
$parameters = [
|
||||
'a' => [
|
||||
'b' => [
|
||||
'c' => 'd',
|
||||
],
|
||||
'e' => [
|
||||
'f' => 'g',
|
||||
],
|
||||
],
|
||||
'h' => 'i',
|
||||
'empty' => '',
|
||||
'null' => null,
|
||||
'false' => false,
|
||||
];
|
||||
|
||||
$this->assertEquals('ZUxiJKugeEplaZm9e4hshN0I70U=', $signature->sign($uri, $parameters));
|
||||
}
|
||||
|
||||
protected function invokeQueryStringFromData(array $args)
|
||||
{
|
||||
$signature = new HmacSha1Signature(m::mock('League\OAuth1\Client\Credentials\ClientCredentialsInterface'));
|
||||
$refl = new \ReflectionObject($signature);
|
||||
$method = $refl->getMethod('queryStringFromData');
|
||||
$method->setAccessible(true);
|
||||
|
||||
return $method->invokeArgs($signature, [$args]);
|
||||
}
|
||||
|
||||
protected function getMockClientCredentials()
|
||||
{
|
||||
$clientCredentials = m::mock('League\OAuth1\Client\Credentials\ClientCredentialsInterface');
|
||||
$clientCredentials->shouldReceive('getSecret')->andReturn('clientsecret');
|
||||
|
||||
return $clientCredentials;
|
||||
}
|
||||
}
|
||||
43
vendor/league/oauth1-client/tests/PlainTextSignatureTest.php
vendored
Normal file
43
vendor/league/oauth1-client/tests/PlainTextSignatureTest.php
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace League\OAuth1\Client\Tests;
|
||||
|
||||
use League\OAuth1\Client\Signature\PlainTextSignature;
|
||||
use Mockery as m;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PlainTextSignatureTest extends TestCase
|
||||
{
|
||||
protected function tearDown(): void
|
||||
{
|
||||
m::close();
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testSigningRequest()
|
||||
{
|
||||
$signature = new PlainTextSignature($this->getMockClientCredentials());
|
||||
$this->assertEquals('clientsecret&', $signature->sign($uri = 'http://www.example.com/'));
|
||||
|
||||
$signature->setCredentials($this->getMockCredentials());
|
||||
$this->assertEquals('clientsecret&tokensecret', $signature->sign($uri));
|
||||
$this->assertEquals('PLAINTEXT', $signature->method());
|
||||
}
|
||||
|
||||
protected function getMockClientCredentials()
|
||||
{
|
||||
$clientCredentials = m::mock('League\OAuth1\Client\Credentials\ClientCredentialsInterface');
|
||||
$clientCredentials->shouldReceive('getSecret')->andReturn('clientsecret');
|
||||
|
||||
return $clientCredentials;
|
||||
}
|
||||
|
||||
protected function getMockCredentials()
|
||||
{
|
||||
$credentials = m::mock('League\OAuth1\Client\Credentials\CredentialsInterface');
|
||||
$credentials->shouldReceive('getSecret')->andReturn('tokensecret');
|
||||
|
||||
return $credentials;
|
||||
}
|
||||
}
|
||||
75
vendor/league/oauth1-client/tests/RsaClientCredentialsTest.php
vendored
Normal file
75
vendor/league/oauth1-client/tests/RsaClientCredentialsTest.php
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace League\OAuth1\Client\Tests;
|
||||
|
||||
use League\OAuth1\Client\Credentials\CredentialsException;
|
||||
use League\OAuth1\Client\Credentials\RsaClientCredentials;
|
||||
use OpenSSLAsymmetricKey;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class RsaClientCredentialsTest extends TestCase
|
||||
{
|
||||
public function testGetRsaPublicKey()
|
||||
{
|
||||
$credentials = new RsaClientCredentials();
|
||||
$credentials->setRsaPublicKey(__DIR__ . '/test_rsa_publickey.pem');
|
||||
|
||||
/** @var resource|OpenSSLAsymmetricKey $key */
|
||||
$key = $credentials->getRsaPublicKey();
|
||||
$this->assertFalse(is_null($key));
|
||||
|
||||
$this->assertEquals($key, $credentials->getRsaPublicKey());
|
||||
}
|
||||
|
||||
public function testGetRsaPublicKeyNotExists()
|
||||
{
|
||||
$this->expectException(CredentialsException::class);
|
||||
|
||||
$credentials = new RsaClientCredentials();
|
||||
$credentials->setRsaPublicKey('fail');
|
||||
|
||||
$credentials->getRsaPublicKey();
|
||||
}
|
||||
|
||||
public function testGetRsaPublicKeyInvalid()
|
||||
{
|
||||
$this->expectException(CredentialsException::class);
|
||||
|
||||
$credentials = new RsaClientCredentials();
|
||||
$credentials->setRsaPublicKey(__DIR__ . '/test_rsa_invalidkey.pem');
|
||||
|
||||
$credentials->getRsaPublicKey();
|
||||
}
|
||||
|
||||
public function testGetRsaPrivateKey()
|
||||
{
|
||||
$credentials = new RsaClientCredentials();
|
||||
$credentials->setRsaPrivateKey(__DIR__ . '/test_rsa_privatekey.pem');
|
||||
|
||||
/** @var resource|OpenSSLAsymmetricKey $key */
|
||||
$key = $credentials->getRsaPrivateKey();
|
||||
$this->assertFalse(is_null($key));
|
||||
|
||||
$this->assertEquals($key, $credentials->getRsaPrivateKey());
|
||||
}
|
||||
|
||||
public function testGetRsaPrivateKeyNotExists()
|
||||
{
|
||||
$this->expectException(CredentialsException::class);
|
||||
|
||||
$credentials = new RsaClientCredentials();
|
||||
$credentials->setRsaPrivateKey('fail');
|
||||
|
||||
$credentials->getRsaPrivateKey();
|
||||
}
|
||||
|
||||
public function testGetRsaPrivateKeyInvalid()
|
||||
{
|
||||
$this->expectException(CredentialsException::class);
|
||||
|
||||
$credentials = new RsaClientCredentials();
|
||||
$credentials->setRsaPrivateKey(__DIR__ . '/test_rsa_invalidkey.pem');
|
||||
|
||||
$credentials->getRsaPrivateKey();
|
||||
}
|
||||
}
|
||||
148
vendor/league/oauth1-client/tests/RsaSha1SignatureTest.php
vendored
Normal file
148
vendor/league/oauth1-client/tests/RsaSha1SignatureTest.php
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
namespace League\OAuth1\Client\Tests;
|
||||
|
||||
use League\OAuth1\Client\Credentials\ClientCredentialsInterface;
|
||||
use League\OAuth1\Client\Credentials\RsaClientCredentials;
|
||||
use League\OAuth1\Client\Signature\RsaSha1Signature;
|
||||
use Mockery;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class RsaSha1SignatureTest extends TestCase
|
||||
{
|
||||
public function testMethod()
|
||||
{
|
||||
$signature = new RsaSha1Signature($this->getClientCredentials());
|
||||
$this->assertEquals('RSA-SHA1', $signature->method());
|
||||
}
|
||||
|
||||
public function testSigningRequest()
|
||||
{
|
||||
$signature = new RsaSha1Signature($this->getClientCredentials());
|
||||
|
||||
$uri = 'http://www.example.com/?qux=corge';
|
||||
$parameters = ['foo' => 'bar', 'baz' => null];
|
||||
|
||||
$this->assertEquals('h8vpV4CYnLwss+rWicKE4sY6AiW2+DT6Fe7qB8jA7LSLhX5jvLEeX1D8E2ynSePSksAY48j+OSLu9vo5juS2duwNK8UA2Rtnnvuj6UFxpx70dpjHAsQg6EbycGptL/SChDkxfpG8LhuwX1FlFa+H0jLYXI5Dy8j90g51GRJbj48=', $signature->sign($uri, $parameters));
|
||||
}
|
||||
|
||||
public function testQueryStringFromArray()
|
||||
{
|
||||
$array = ['a' => 'b'];
|
||||
$res = $this->invokeQueryStringFromData($array);
|
||||
|
||||
$this->assertSame(
|
||||
'a%3Db',
|
||||
$res
|
||||
);
|
||||
}
|
||||
|
||||
public function testQueryStringFromIndexedArray()
|
||||
{
|
||||
$array = ['a', 'b'];
|
||||
$res = $this->invokeQueryStringFromData($array);
|
||||
|
||||
$this->assertSame(
|
||||
'0%3Da%261%3Db',
|
||||
$res
|
||||
);
|
||||
}
|
||||
|
||||
public function testQueryStringFromMultiDimensionalArray()
|
||||
{
|
||||
$array = [
|
||||
'a' => [
|
||||
'b' => [
|
||||
'c' => 'd',
|
||||
],
|
||||
'e' => [
|
||||
'f' => 'g',
|
||||
],
|
||||
],
|
||||
'h' => 'i',
|
||||
'empty' => '',
|
||||
'null' => null,
|
||||
'false' => false,
|
||||
];
|
||||
|
||||
// Convert to query string.
|
||||
$res = $this->invokeQueryStringFromData($array);
|
||||
|
||||
$this->assertSame(
|
||||
'a%5Bb%5D%5Bc%5D%3Dd%26a%5Be%5D%5Bf%5D%3Dg%26h%3Di%26empty%3D%26null%3D%26false%3D',
|
||||
$res
|
||||
);
|
||||
|
||||
// Reverse engineer the string.
|
||||
$res = urldecode($res);
|
||||
|
||||
$this->assertSame(
|
||||
'a[b][c]=d&a[e][f]=g&h=i&empty=&null=&false=',
|
||||
$res
|
||||
);
|
||||
|
||||
// Finally, parse the string back to an array.
|
||||
parse_str($res, $original_array);
|
||||
|
||||
// And ensure it matches the orignal array (approximately).
|
||||
$this->assertSame(
|
||||
[
|
||||
'a' => [
|
||||
'b' => [
|
||||
'c' => 'd',
|
||||
],
|
||||
'e' => [
|
||||
'f' => 'g',
|
||||
],
|
||||
],
|
||||
'h' => 'i',
|
||||
'empty' => '',
|
||||
'null' => '', // null value gets lost in string translation
|
||||
'false' => '', // false value gets lost in string translation
|
||||
],
|
||||
$original_array
|
||||
);
|
||||
}
|
||||
|
||||
public function testSigningRequestWithMultiDimensionalParams()
|
||||
{
|
||||
$signature = new RsaSha1Signature($this->getClientCredentials());
|
||||
|
||||
$uri = 'http://www.example.com/';
|
||||
$parameters = [
|
||||
'a' => [
|
||||
'b' => [
|
||||
'c' => 'd',
|
||||
],
|
||||
'e' => [
|
||||
'f' => 'g',
|
||||
],
|
||||
],
|
||||
'h' => 'i',
|
||||
'empty' => '',
|
||||
'null' => null,
|
||||
'false' => false,
|
||||
];
|
||||
|
||||
$this->assertEquals('X9EkmOEbA5CoF2Hicf3ciAumpp1zkKxnVZkh/mEwWyF2DDcrfou9XF11WvbBu3G4loJGeX4GY1FsIrQpsjEILbn0e7Alyii/x8VA9mBwdqMhQVl49jF0pdowocc03M04cAbAOMNObT7tMmDs+YTFgRxEGCiUkq9AizP1cW3+eBo=', $signature->sign($uri, $parameters));
|
||||
}
|
||||
|
||||
protected function invokeQueryStringFromData(array $args)
|
||||
{
|
||||
$signature = new RsaSha1Signature(Mockery::mock(ClientCredentialsInterface::class));
|
||||
$refl = new \ReflectionObject($signature);
|
||||
$method = $refl->getMethod('queryStringFromData');
|
||||
$method->setAccessible(true);
|
||||
|
||||
return $method->invokeArgs($signature, [$args]);
|
||||
}
|
||||
|
||||
protected function getClientCredentials()
|
||||
{
|
||||
$credentials = new RsaClientCredentials();
|
||||
$credentials->setRsaPublicKey(__DIR__ . '/test_rsa_publickey.pem');
|
||||
$credentials->setRsaPrivateKey(__DIR__ . '/test_rsa_privatekey.pem');
|
||||
|
||||
return $credentials;
|
||||
}
|
||||
}
|
||||
313
vendor/league/oauth1-client/tests/ServerTest.php
vendored
Normal file
313
vendor/league/oauth1-client/tests/ServerTest.php
vendored
Normal file
@@ -0,0 +1,313 @@
|
||||
<?php
|
||||
|
||||
namespace League\OAuth1\Client\Tests;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use League\OAuth1\Client\Credentials\ClientCredentials;
|
||||
use League\OAuth1\Client\Credentials\RsaClientCredentials;
|
||||
use League\OAuth1\Client\Signature\RsaSha1Signature;
|
||||
use Mockery as m;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class ServerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Setup resources and dependencies.
|
||||
*/
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
|
||||
require_once __DIR__ . '/stubs/ServerStub.php';
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
m::close();
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testCreatingWithArray()
|
||||
{
|
||||
$server = new ServerStub($this->getMockClientCredentials());
|
||||
|
||||
$credentials = $server->getClientCredentials();
|
||||
$this->assertInstanceOf('League\OAuth1\Client\Credentials\ClientCredentialsInterface', $credentials);
|
||||
$this->assertEquals('myidentifier', $credentials->getIdentifier());
|
||||
$this->assertEquals('mysecret', $credentials->getSecret());
|
||||
$this->assertEquals('http://app.dev/', $credentials->getCallbackUri());
|
||||
}
|
||||
|
||||
public function testCreatingWithArrayRsa()
|
||||
{
|
||||
$config = [
|
||||
'identifier' => 'app_key',
|
||||
'secret' => 'secret',
|
||||
'callback_uri' => 'https://example.com/callback',
|
||||
'rsa_public_key' => __DIR__ . '/test_rsa_publickey.pem',
|
||||
'rsa_private_key' => __DIR__ . '/test_rsa_privatekey.pem',
|
||||
];
|
||||
$server = new ServerStub($config);
|
||||
|
||||
$credentials = $server->getClientCredentials();
|
||||
$this->assertInstanceOf(RsaClientCredentials::class, $credentials);
|
||||
|
||||
$signature = $server->getSignature();
|
||||
$this->assertInstanceOf(RsaSha1Signature::class, $signature);
|
||||
}
|
||||
|
||||
public function testCreatingWithObject()
|
||||
{
|
||||
$credentials = new ClientCredentials;
|
||||
$credentials->setIdentifier('myidentifier');
|
||||
$credentials->setSecret('mysecret');
|
||||
$credentials->setCallbackUri('http://app.dev/');
|
||||
|
||||
$server = new ServerStub($credentials);
|
||||
|
||||
$this->assertEquals($credentials, $server->getClientCredentials());
|
||||
}
|
||||
|
||||
public function testCreatingWithInvalidInput()
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
new ServerStub(uniqid());
|
||||
}
|
||||
|
||||
public function testGettingTemporaryCredentials()
|
||||
{
|
||||
$server = m::mock('League\OAuth1\Client\Tests\ServerStub[createHttpClient]', [$this->getMockClientCredentials()]);
|
||||
|
||||
$server->shouldReceive('createHttpClient')->andReturn($client = m::mock('stdClass'));
|
||||
|
||||
$me = $this;
|
||||
$client->shouldReceive('post')->with('http://www.example.com/temporary', m::on(function ($options) use ($me) {
|
||||
$headers = $options['headers'];
|
||||
|
||||
$me->assertTrue(isset($headers['Authorization']));
|
||||
|
||||
// OAuth protocol specifies a strict number of
|
||||
// headers should be sent, in the correct order.
|
||||
// We'll validate that here.
|
||||
$pattern
|
||||
= '/OAuth oauth_consumer_key=".*?", oauth_nonce="[a-zA-Z0-9]+", oauth_signature_method="HMAC-SHA1", oauth_timestamp="\d{10}", oauth_version="1.0", oauth_callback="'
|
||||
. preg_quote('http%3A%2F%2Fapp.dev%2F', '/') . '", oauth_signature=".*?"/';
|
||||
|
||||
$matches = preg_match($pattern, $headers['Authorization']);
|
||||
$me->assertEquals(1, $matches, 'Asserting that the authorization header contains the correct expression.');
|
||||
|
||||
return true;
|
||||
}))->once()->andReturn($response = m::mock('stdClass'));
|
||||
$response->shouldReceive('getBody')
|
||||
->andReturn('oauth_token=temporarycredentialsidentifier&oauth_token_secret=temporarycredentialssecret&oauth_callback_confirmed=true');
|
||||
|
||||
$credentials = $server->getTemporaryCredentials();
|
||||
$this->assertInstanceOf('League\OAuth1\Client\Credentials\TemporaryCredentials', $credentials);
|
||||
$this->assertEquals('temporarycredentialsidentifier', $credentials->getIdentifier());
|
||||
$this->assertEquals('temporarycredentialssecret', $credentials->getSecret());
|
||||
}
|
||||
|
||||
public function testGettingAuthorizationUrl()
|
||||
{
|
||||
$server = new ServerStub($this->getMockClientCredentials());
|
||||
|
||||
$expected = 'http://www.example.com/authorize?oauth_token=foo';
|
||||
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl('foo'));
|
||||
|
||||
$credentials = m::mock('League\OAuth1\Client\Credentials\TemporaryCredentials');
|
||||
$credentials->shouldReceive('getIdentifier')->andReturn('foo');
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl($credentials));
|
||||
}
|
||||
|
||||
public function testGettingAuthorizationUrlWithOptions()
|
||||
{
|
||||
$server = new ServerStub($this->getMockClientCredentials());
|
||||
$expected = 'http://www.example.com/authorize?oauth_token=foo';
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl('foo', ['oauth_token' => 'bar']));
|
||||
|
||||
$expected = 'http://www.example.com/authorize?test=bar&oauth_token=foo';
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl('foo', ['test' => 'bar']));
|
||||
}
|
||||
|
||||
public function testGettingTokenCredentialsFailsWithManInTheMiddle()
|
||||
{
|
||||
$server = new ServerStub($this->getMockClientCredentials());
|
||||
|
||||
$credentials = m::mock('League\OAuth1\Client\Credentials\TemporaryCredentials');
|
||||
$credentials->shouldReceive('getIdentifier')->andReturn('foo');
|
||||
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
$server->getTokenCredentials($credentials, 'bar', 'verifier');
|
||||
}
|
||||
|
||||
public function testGettingTokenCredentials()
|
||||
{
|
||||
$server = m::mock('League\OAuth1\Client\Tests\ServerStub[createHttpClient]', [$this->getMockClientCredentials()]);
|
||||
|
||||
$temporaryCredentials = m::mock('League\OAuth1\Client\Credentials\TemporaryCredentials');
|
||||
$temporaryCredentials->shouldReceive('getIdentifier')->andReturn('temporarycredentialsidentifier');
|
||||
$temporaryCredentials->shouldReceive('getSecret')->andReturn('temporarycredentialssecret');
|
||||
|
||||
$server->shouldReceive('createHttpClient')->andReturn($client = m::mock('stdClass'));
|
||||
|
||||
$me = $this;
|
||||
$client->shouldReceive('post')->with('http://www.example.com/token', m::on(function ($options) use ($me) {
|
||||
$headers = $options['headers'];
|
||||
$body = $options['form_params'];
|
||||
|
||||
$me->assertTrue(isset($headers['Authorization']));
|
||||
$me->assertFalse(isset($headers['User-Agent']));
|
||||
|
||||
// OAuth protocol specifies a strict number of
|
||||
// headers should be sent, in the correct order.
|
||||
// We'll validate that here.
|
||||
$pattern
|
||||
= '/OAuth oauth_consumer_key=".*?", oauth_nonce="[a-zA-Z0-9]+", oauth_signature_method="HMAC-SHA1", oauth_timestamp="\d{10}", oauth_version="1.0", oauth_token="temporarycredentialsidentifier", oauth_signature=".*?"/';
|
||||
|
||||
$matches = preg_match($pattern, $headers['Authorization']);
|
||||
$me->assertEquals(1, $matches, 'Asserting that the authorization header contains the correct expression.');
|
||||
|
||||
$me->assertSame($body, ['oauth_verifier' => 'myverifiercode']);
|
||||
|
||||
return true;
|
||||
}))->once()->andReturn($response = m::mock('stdClass'));
|
||||
$response->shouldReceive('getBody')
|
||||
->andReturn('oauth_token=tokencredentialsidentifier&oauth_token_secret=tokencredentialssecret');
|
||||
|
||||
$credentials = $server->getTokenCredentials($temporaryCredentials, 'temporarycredentialsidentifier', 'myverifiercode');
|
||||
$this->assertInstanceOf('League\OAuth1\Client\Credentials\TokenCredentials', $credentials);
|
||||
$this->assertEquals('tokencredentialsidentifier', $credentials->getIdentifier());
|
||||
$this->assertEquals('tokencredentialssecret', $credentials->getSecret());
|
||||
}
|
||||
|
||||
public function testGettingTokenCredentialsWithUserAgent()
|
||||
{
|
||||
$userAgent = 'FooBar';
|
||||
$server = m::mock('League\OAuth1\Client\Tests\ServerStub[createHttpClient]', [$this->getMockClientCredentials()]);
|
||||
|
||||
$temporaryCredentials = m::mock('League\OAuth1\Client\Credentials\TemporaryCredentials');
|
||||
$temporaryCredentials->shouldReceive('getIdentifier')->andReturn('temporarycredentialsidentifier');
|
||||
$temporaryCredentials->shouldReceive('getSecret')->andReturn('temporarycredentialssecret');
|
||||
|
||||
$server->shouldReceive('createHttpClient')->andReturn($client = m::mock('stdClass'));
|
||||
|
||||
$me = $this;
|
||||
$client->shouldReceive('post')->with('http://www.example.com/token', m::on(function ($options) use ($me, $userAgent) {
|
||||
$headers = $options['headers'];
|
||||
$body = $options['form_params'];
|
||||
|
||||
$me->assertTrue(isset($headers['Authorization']));
|
||||
$me->assertTrue(isset($headers['User-Agent']));
|
||||
$me->assertEquals($userAgent, $headers['User-Agent']);
|
||||
|
||||
// OAuth protocol specifies a strict number of
|
||||
// headers should be sent, in the correct order.
|
||||
// We'll validate that here.
|
||||
$pattern
|
||||
= '/OAuth oauth_consumer_key=".*?", oauth_nonce="[a-zA-Z0-9]+", oauth_signature_method="HMAC-SHA1", oauth_timestamp="\d{10}", oauth_version="1.0", oauth_token="temporarycredentialsidentifier", oauth_signature=".*?"/';
|
||||
|
||||
$matches = preg_match($pattern, $headers['Authorization']);
|
||||
$me->assertEquals(1, $matches, 'Asserting that the authorization header contains the correct expression.');
|
||||
|
||||
$me->assertSame($body, ['oauth_verifier' => 'myverifiercode']);
|
||||
|
||||
return true;
|
||||
}))->once()->andReturn($response = m::mock('stdClass'));
|
||||
$response->shouldReceive('getBody')
|
||||
->andReturn('oauth_token=tokencredentialsidentifier&oauth_token_secret=tokencredentialssecret');
|
||||
|
||||
$credentials = $server->setUserAgent($userAgent)
|
||||
->getTokenCredentials($temporaryCredentials, 'temporarycredentialsidentifier', 'myverifiercode');
|
||||
$this->assertInstanceOf('League\OAuth1\Client\Credentials\TokenCredentials', $credentials);
|
||||
$this->assertEquals('tokencredentialsidentifier', $credentials->getIdentifier());
|
||||
$this->assertEquals('tokencredentialssecret', $credentials->getSecret());
|
||||
}
|
||||
|
||||
public function testGettingUserDetails()
|
||||
{
|
||||
$server = m::mock(
|
||||
'League\OAuth1\Client\Tests\ServerStub[createHttpClient,protocolHeader]',
|
||||
[$this->getMockClientCredentials()]
|
||||
);
|
||||
|
||||
$temporaryCredentials = m::mock('League\OAuth1\Client\Credentials\TokenCredentials');
|
||||
$temporaryCredentials->shouldReceive('getIdentifier')->andReturn('tokencredentialsidentifier');
|
||||
$temporaryCredentials->shouldReceive('getSecret')->andReturn('tokencredentialssecret');
|
||||
|
||||
$server->shouldReceive('createHttpClient')->andReturn($client = m::mock('stdClass'));
|
||||
|
||||
$me = $this;
|
||||
$client->shouldReceive('get')->with('http://www.example.com/user', m::on(function ($options) use ($me) {
|
||||
$headers = $options['headers'];
|
||||
|
||||
$me->assertTrue(isset($headers['Authorization']));
|
||||
|
||||
// OAuth protocol specifies a strict number of
|
||||
// headers should be sent, in the correct order.
|
||||
// We'll validate that here.
|
||||
$pattern
|
||||
= '/OAuth oauth_consumer_key=".*?", oauth_nonce="[a-zA-Z0-9]+", oauth_signature_method="HMAC-SHA1", oauth_timestamp="\d{10}", oauth_version="1.0", oauth_token="tokencredentialsidentifier", oauth_signature=".*?"/';
|
||||
|
||||
$matches = preg_match($pattern, $headers['Authorization']);
|
||||
$me->assertEquals(1, $matches, 'Asserting that the authorization header contains the correct expression.');
|
||||
|
||||
return true;
|
||||
}))->once()->andReturn($response = m::mock(ResponseInterface::class));
|
||||
$response->shouldReceive('getBody')->once()->andReturn(json_encode([
|
||||
'foo' => 'bar',
|
||||
'id' => 123,
|
||||
'contact_email' => 'baz@qux.com',
|
||||
'username' => 'fred',
|
||||
]));
|
||||
|
||||
$user = $server->getUserDetails($temporaryCredentials);
|
||||
$this->assertInstanceOf('League\OAuth1\Client\Server\User', $user);
|
||||
$this->assertEquals('bar', $user->firstName);
|
||||
$this->assertEquals(123, $server->getUserUid($temporaryCredentials));
|
||||
$this->assertEquals('baz@qux.com', $server->getUserEmail($temporaryCredentials));
|
||||
$this->assertEquals('fred', $server->getUserScreenName($temporaryCredentials));
|
||||
}
|
||||
|
||||
public function testGettingHeaders()
|
||||
{
|
||||
$server = new ServerStub($this->getMockClientCredentials());
|
||||
|
||||
$tokenCredentials = m::mock('League\OAuth1\Client\Credentials\TokenCredentials');
|
||||
$tokenCredentials->shouldReceive('getIdentifier')->andReturn('mock_identifier');
|
||||
$tokenCredentials->shouldReceive('getSecret')->andReturn('mock_secret');
|
||||
|
||||
// OAuth protocol specifies a strict number of
|
||||
// headers should be sent, in the correct order.
|
||||
// We'll validate that here.
|
||||
$pattern
|
||||
= '/OAuth oauth_consumer_key=".*?", oauth_nonce="[a-zA-Z0-9]+", oauth_signature_method="HMAC-SHA1", oauth_timestamp="\d{10}", oauth_version="1.0", oauth_token="mock_identifier", oauth_signature=".*?"/';
|
||||
|
||||
// With a GET request
|
||||
$headers = $server->getHeaders($tokenCredentials, 'GET', 'http://example.com/');
|
||||
$this->assertTrue(isset($headers['Authorization']));
|
||||
|
||||
$matches = preg_match($pattern, $headers['Authorization']);
|
||||
$this->assertEquals(1, $matches, 'Asserting that the authorization header contains the correct expression.');
|
||||
|
||||
// With a POST request
|
||||
$headers = $server->getHeaders($tokenCredentials, 'POST', 'http://example.com/', ['body' => 'params']);
|
||||
$this->assertTrue(isset($headers['Authorization']));
|
||||
|
||||
$matches = preg_match($pattern, $headers['Authorization']);
|
||||
$this->assertEquals(1, $matches, 'Asserting that the authorization header contains the correct expression.');
|
||||
}
|
||||
|
||||
protected function getMockClientCredentials()
|
||||
{
|
||||
return [
|
||||
'identifier' => 'myidentifier',
|
||||
'secret' => 'mysecret',
|
||||
'callback_uri' => 'http://app.dev/',
|
||||
];
|
||||
}
|
||||
}
|
||||
349
vendor/league/oauth1-client/tests/TrelloServerTest.php
vendored
Normal file
349
vendor/league/oauth1-client/tests/TrelloServerTest.php
vendored
Normal file
@@ -0,0 +1,349 @@
|
||||
<?php namespace League\OAuth1\Client\Tests;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use League\OAuth1\Client\Credentials\ClientCredentials;
|
||||
use League\OAuth1\Client\Server\Trello;
|
||||
use Mockery as m;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class TrelloTest extends TestCase
|
||||
{
|
||||
protected function tearDown(): void
|
||||
{
|
||||
m::close();
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testCreatingWithArray()
|
||||
{
|
||||
$server = new Trello($this->getMockClientCredentials());
|
||||
|
||||
$credentials = $server->getClientCredentials();
|
||||
$this->assertInstanceOf('League\OAuth1\Client\Credentials\ClientCredentialsInterface', $credentials);
|
||||
$this->assertEquals($this->getApplicationKey(), $credentials->getIdentifier());
|
||||
$this->assertEquals('mysecret', $credentials->getSecret());
|
||||
$this->assertEquals('http://app.dev/', $credentials->getCallbackUri());
|
||||
}
|
||||
|
||||
public function testCreatingWithObject()
|
||||
{
|
||||
$credentials = new ClientCredentials;
|
||||
$credentials->setIdentifier('myidentifier');
|
||||
$credentials->setSecret('mysecret');
|
||||
$credentials->setCallbackUri('http://app.dev/');
|
||||
|
||||
$server = new Trello($credentials);
|
||||
|
||||
$this->assertEquals($credentials, $server->getClientCredentials());
|
||||
}
|
||||
|
||||
public function testGettingTemporaryCredentials()
|
||||
{
|
||||
$server = m::mock('League\OAuth1\Client\Server\Trello[createHttpClient]', [$this->getMockClientCredentials()]);
|
||||
|
||||
$server->shouldReceive('createHttpClient')->andReturn($client = m::mock('stdClass'));
|
||||
|
||||
$me = $this;
|
||||
$client->shouldReceive('post')->with('https://trello.com/1/OAuthGetRequestToken', m::on(function ($options) use ($me) {
|
||||
$headers = $options['headers'];
|
||||
|
||||
$me->assertTrue(isset($headers['Authorization']));
|
||||
|
||||
// OAuth protocol specifies a strict number of
|
||||
// headers should be sent, in the correct order.
|
||||
// We'll validate that here.
|
||||
$pattern = '/OAuth oauth_consumer_key=".*?", oauth_nonce="[a-zA-Z0-9]+", oauth_signature_method="HMAC-SHA1", oauth_timestamp="\d{10}", oauth_version="1.0", oauth_callback="' . preg_quote('http%3A%2F%2Fapp.dev%2F', '/') . '", oauth_signature=".*?"/';
|
||||
|
||||
$matches = preg_match($pattern, $headers['Authorization']);
|
||||
$me->assertEquals(1, $matches, 'Asserting that the authorization header contains the correct expression.');
|
||||
|
||||
return true;
|
||||
}))->once()->andReturn($response = m::mock(ResponseInterface::class));
|
||||
$response->shouldReceive('getBody')->andReturn('oauth_token=temporarycredentialsidentifier&oauth_token_secret=temporarycredentialssecret&oauth_callback_confirmed=true');
|
||||
|
||||
$credentials = $server->getTemporaryCredentials();
|
||||
$this->assertInstanceOf('League\OAuth1\Client\Credentials\TemporaryCredentials', $credentials);
|
||||
$this->assertEquals('temporarycredentialsidentifier', $credentials->getIdentifier());
|
||||
$this->assertEquals('temporarycredentialssecret', $credentials->getSecret());
|
||||
}
|
||||
|
||||
public function testGettingDefaultAuthorizationUrl()
|
||||
{
|
||||
$server = new Trello($this->getMockClientCredentials());
|
||||
|
||||
$expected = 'https://trello.com/1/OAuthAuthorizeToken?response_type=fragment&scope=read&expiration=1day&oauth_token=foo';
|
||||
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl('foo'));
|
||||
|
||||
$credentials = m::mock('League\OAuth1\Client\Credentials\TemporaryCredentials');
|
||||
$credentials->shouldReceive('getIdentifier')->andReturn('foo');
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl($credentials));
|
||||
}
|
||||
|
||||
public function testGettingAuthorizationUrlWithExpirationAfterConstructingWithExpiration()
|
||||
{
|
||||
$credentials = $this->getMockClientCredentials();
|
||||
$expiration = $this->getApplicationExpiration(2);
|
||||
$credentials['expiration'] = $expiration;
|
||||
$server = new Trello($credentials);
|
||||
|
||||
$expected = 'https://trello.com/1/OAuthAuthorizeToken?response_type=fragment&scope=read&expiration=' . urlencode($expiration) . '&oauth_token=foo';
|
||||
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl('foo'));
|
||||
|
||||
$credentials = m::mock('League\OAuth1\Client\Credentials\TemporaryCredentials');
|
||||
$credentials->shouldReceive('getIdentifier')->andReturn('foo');
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl($credentials));
|
||||
}
|
||||
|
||||
public function testGettingAuthorizationUrlWithExpirationAfterSettingExpiration()
|
||||
{
|
||||
$expiration = $this->getApplicationExpiration(2);
|
||||
$server = new Trello($this->getMockClientCredentials());
|
||||
$server->setApplicationExpiration($expiration);
|
||||
|
||||
$expected = 'https://trello.com/1/OAuthAuthorizeToken?response_type=fragment&scope=read&expiration=' . urlencode($expiration) . '&oauth_token=foo';
|
||||
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl('foo'));
|
||||
|
||||
$credentials = m::mock('League\OAuth1\Client\Credentials\TemporaryCredentials');
|
||||
$credentials->shouldReceive('getIdentifier')->andReturn('foo');
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl($credentials));
|
||||
}
|
||||
|
||||
public function testGettingAuthorizationUrlWithNameAfterConstructingWithName()
|
||||
{
|
||||
$credentials = $this->getMockClientCredentials();
|
||||
$name = $this->getApplicationName();
|
||||
$credentials['name'] = $name;
|
||||
$server = new Trello($credentials);
|
||||
|
||||
$expected = 'https://trello.com/1/OAuthAuthorizeToken?response_type=fragment&scope=read&expiration=1day&name=' . urlencode($name) . '&oauth_token=foo';
|
||||
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl('foo'));
|
||||
|
||||
$credentials = m::mock('League\OAuth1\Client\Credentials\TemporaryCredentials');
|
||||
$credentials->shouldReceive('getIdentifier')->andReturn('foo');
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl($credentials));
|
||||
}
|
||||
|
||||
public function testGettingAuthorizationUrlWithNameAfterSettingName()
|
||||
{
|
||||
$name = $this->getApplicationName();
|
||||
$server = new Trello($this->getMockClientCredentials());
|
||||
$server->setApplicationName($name);
|
||||
|
||||
$expected = 'https://trello.com/1/OAuthAuthorizeToken?response_type=fragment&scope=read&expiration=1day&name=' . urlencode($name) . '&oauth_token=foo';
|
||||
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl('foo'));
|
||||
|
||||
$credentials = m::mock('League\OAuth1\Client\Credentials\TemporaryCredentials');
|
||||
$credentials->shouldReceive('getIdentifier')->andReturn('foo');
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl($credentials));
|
||||
}
|
||||
|
||||
public function testGettingAuthorizationUrlWithScopeAfterConstructingWithScope()
|
||||
{
|
||||
$credentials = $this->getMockClientCredentials();
|
||||
$scope = $this->getApplicationScope(false);
|
||||
$credentials['scope'] = $scope;
|
||||
$server = new Trello($credentials);
|
||||
|
||||
$expected = 'https://trello.com/1/OAuthAuthorizeToken?response_type=fragment&scope=' . urlencode($scope) . '&expiration=1day&oauth_token=foo';
|
||||
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl('foo'));
|
||||
|
||||
$credentials = m::mock('League\OAuth1\Client\Credentials\TemporaryCredentials');
|
||||
$credentials->shouldReceive('getIdentifier')->andReturn('foo');
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl($credentials));
|
||||
}
|
||||
|
||||
public function testGettingAuthorizationUrlWithScopeAfterSettingScope()
|
||||
{
|
||||
$scope = $this->getApplicationScope(false);
|
||||
$server = new Trello($this->getMockClientCredentials());
|
||||
$server->setApplicationScope($scope);
|
||||
|
||||
$expected = 'https://trello.com/1/OAuthAuthorizeToken?response_type=fragment&scope=' . urlencode($scope) . '&expiration=1day&oauth_token=foo';
|
||||
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl('foo'));
|
||||
|
||||
$credentials = m::mock('League\OAuth1\Client\Credentials\TemporaryCredentials');
|
||||
$credentials->shouldReceive('getIdentifier')->andReturn('foo');
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl($credentials));
|
||||
}
|
||||
|
||||
public function testGettingTokenCredentialsFailsWithManInTheMiddle()
|
||||
{
|
||||
$server = new Trello($this->getMockClientCredentials());
|
||||
|
||||
$credentials = m::mock('League\OAuth1\Client\Credentials\TemporaryCredentials');
|
||||
$credentials->shouldReceive('getIdentifier')->andReturn('foo');
|
||||
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
$server->getTokenCredentials($credentials, 'bar', 'verifier');
|
||||
}
|
||||
|
||||
public function testGettingTokenCredentials()
|
||||
{
|
||||
$server = m::mock('League\OAuth1\Client\Server\Trello[createHttpClient]', [$this->getMockClientCredentials()]);
|
||||
|
||||
$temporaryCredentials = m::mock('League\OAuth1\Client\Credentials\TemporaryCredentials');
|
||||
$temporaryCredentials->shouldReceive('getIdentifier')->andReturn('temporarycredentialsidentifier');
|
||||
$temporaryCredentials->shouldReceive('getSecret')->andReturn('temporarycredentialssecret');
|
||||
|
||||
$server->shouldReceive('createHttpClient')->andReturn($client = m::mock('stdClass'));
|
||||
|
||||
$me = $this;
|
||||
$client->shouldReceive('post')->with('https://trello.com/1/OAuthGetAccessToken', m::on(function ($options) use ($me) {
|
||||
$headers = $options['headers'];
|
||||
$body = $options['form_params'];
|
||||
|
||||
$me->assertTrue(isset($headers['Authorization']));
|
||||
|
||||
// OAuth protocol specifies a strict number of
|
||||
// headers should be sent, in the correct order.
|
||||
// We'll validate that here.
|
||||
$pattern = '/OAuth oauth_consumer_key=".*?", oauth_nonce="[a-zA-Z0-9]+", oauth_signature_method="HMAC-SHA1", oauth_timestamp="\d{10}", oauth_version="1.0", oauth_token="temporarycredentialsidentifier", oauth_signature=".*?"/';
|
||||
|
||||
$matches = preg_match($pattern, $headers['Authorization']);
|
||||
$me->assertEquals(1, $matches, 'Asserting that the authorization header contains the correct expression.');
|
||||
|
||||
$me->assertSame($body, ['oauth_verifier' => 'myverifiercode']);
|
||||
|
||||
return true;
|
||||
}))->once()->andReturn($response = m::mock(ResponseInterface::class));
|
||||
$response->shouldReceive('getBody')->andReturn('oauth_token=tokencredentialsidentifier&oauth_token_secret=tokencredentialssecret');
|
||||
|
||||
$credentials = $server->getTokenCredentials($temporaryCredentials, 'temporarycredentialsidentifier', 'myverifiercode');
|
||||
$this->assertInstanceOf('League\OAuth1\Client\Credentials\TokenCredentials', $credentials);
|
||||
$this->assertEquals('tokencredentialsidentifier', $credentials->getIdentifier());
|
||||
$this->assertEquals('tokencredentialssecret', $credentials->getSecret());
|
||||
}
|
||||
|
||||
public function testGettingUserDetails()
|
||||
{
|
||||
$server = m::mock('League\OAuth1\Client\Server\Trello[createHttpClient,protocolHeader]', [$this->getMockClientCredentials()]);
|
||||
|
||||
$temporaryCredentials = m::mock('League\OAuth1\Client\Credentials\TokenCredentials');
|
||||
$temporaryCredentials->shouldReceive('getIdentifier')->andReturn('tokencredentialsidentifier');
|
||||
$temporaryCredentials->shouldReceive('getSecret')->andReturn('tokencredentialssecret');
|
||||
|
||||
$server->shouldReceive('createHttpClient')->andReturn($client = m::mock('stdClass'));
|
||||
|
||||
$me = $this;
|
||||
$client->shouldReceive('get')->with('https://trello.com/1/members/me?key=' . $this->getApplicationKey() . '&token=' . $this->getAccessToken(), m::on(function ($options) use ($me) {
|
||||
$headers = $options['headers'];
|
||||
|
||||
$me->assertTrue(isset($headers['Authorization']));
|
||||
|
||||
// OAuth protocol specifies a strict number of
|
||||
// headers should be sent, in the correct order.
|
||||
// We'll validate that here.
|
||||
$pattern = '/OAuth oauth_consumer_key=".*?", oauth_nonce="[a-zA-Z0-9]+", oauth_signature_method="HMAC-SHA1", oauth_timestamp="\d{10}", oauth_version="1.0", oauth_token="tokencredentialsidentifier", oauth_signature=".*?"/';
|
||||
|
||||
$matches = preg_match($pattern, $headers['Authorization']);
|
||||
$me->assertEquals(1, $matches, 'Asserting that the authorization header contains the correct expression.');
|
||||
|
||||
return true;
|
||||
}))->once()->andReturn($response = m::mock(ResponseInterface::class));
|
||||
$response->shouldReceive('getBody')->once()->andReturn($this->getUserPayload());
|
||||
|
||||
$user = $server
|
||||
->setAccessToken($this->getAccessToken())
|
||||
->getUserDetails($temporaryCredentials);
|
||||
$this->assertInstanceOf('League\OAuth1\Client\Server\User', $user);
|
||||
$this->assertEquals('Matilda Wormwood', $user->name);
|
||||
$this->assertEquals('545df696e29c0dddaed31967', $server->getUserUid($temporaryCredentials));
|
||||
$this->assertEquals(null, $server->getUserEmail($temporaryCredentials));
|
||||
$this->assertEquals('matildawormwood12', $server->getUserScreenName($temporaryCredentials));
|
||||
}
|
||||
|
||||
protected function getMockClientCredentials()
|
||||
{
|
||||
return [
|
||||
'identifier' => $this->getApplicationKey(),
|
||||
'secret' => 'mysecret',
|
||||
'callback_uri' => 'http://app.dev/',
|
||||
];
|
||||
}
|
||||
|
||||
protected function getAccessToken()
|
||||
{
|
||||
return 'lmnopqrstuvwxyz';
|
||||
}
|
||||
|
||||
protected function getApplicationKey()
|
||||
{
|
||||
return 'abcdefghijk';
|
||||
}
|
||||
|
||||
protected function getApplicationExpiration($days = 0)
|
||||
{
|
||||
return is_numeric($days) && $days > 0 ? $days . 'day' . ($days == 1 ? '' : 's') : 'never';
|
||||
}
|
||||
|
||||
protected function getApplicationName()
|
||||
{
|
||||
return 'fizz buzz';
|
||||
}
|
||||
|
||||
protected function getApplicationScope($readonly = true)
|
||||
{
|
||||
return $readonly ? 'read' : 'read,write';
|
||||
}
|
||||
|
||||
private function getUserPayload()
|
||||
{
|
||||
return '{
|
||||
"id": "545df696e29c0dddaed31967",
|
||||
"avatarHash": null,
|
||||
"bio": "I have magical powers",
|
||||
"bioData": null,
|
||||
"confirmed": true,
|
||||
"fullName": "Matilda Wormwood",
|
||||
"idPremOrgsAdmin": [],
|
||||
"initials": "MW",
|
||||
"memberType": "normal",
|
||||
"products": [],
|
||||
"status": "idle",
|
||||
"url": "https://trello.com/matildawormwood12",
|
||||
"username": "matildawormwood12",
|
||||
"avatarSource": "none",
|
||||
"email": null,
|
||||
"gravatarHash": "39aaaada0224f26f0bb8f1965326dcb7",
|
||||
"idBoards": [
|
||||
"545df696e29c0dddaed31968",
|
||||
"545e01d6c7b2dd962b5b46cb"
|
||||
],
|
||||
"idOrganizations": [
|
||||
"54adfd79f9aea14f84009a85",
|
||||
"54adfde13b0e706947bc4789"
|
||||
],
|
||||
"loginTypes": null,
|
||||
"oneTimeMessagesDismissed": [],
|
||||
"prefs": {
|
||||
"sendSummaries": true,
|
||||
"minutesBetweenSummaries": 1,
|
||||
"minutesBeforeDeadlineToNotify": 1440,
|
||||
"colorBlind": false,
|
||||
"timezoneInfo": {
|
||||
"timezoneNext": "CDT",
|
||||
"dateNext": "2015-03-08T08:00:00.000Z",
|
||||
"offsetNext": 300,
|
||||
"timezoneCurrent": "CST",
|
||||
"offsetCurrent": 360
|
||||
}
|
||||
},
|
||||
"trophies": [],
|
||||
"uploadedAvatarHash": null,
|
||||
"premiumFeatures": [],
|
||||
"idBoardsPinned": null
|
||||
}';
|
||||
}
|
||||
}
|
||||
38
vendor/league/oauth1-client/tests/TwitterServerTest.php
vendored
Normal file
38
vendor/league/oauth1-client/tests/TwitterServerTest.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace League\OAuth1\Client\Tests;
|
||||
|
||||
use Generator;
|
||||
use League\OAuth1\Client\Server\Twitter;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class TwitterServerTest extends TestCase
|
||||
{
|
||||
public function sampleTemporaryCredentialUrls(): Generator
|
||||
{
|
||||
yield 'No application scope' => [
|
||||
null, 'https://api.twitter.com/oauth/request_token',
|
||||
];
|
||||
|
||||
yield "Read" => [
|
||||
'read', 'https://api.twitter.com/oauth/request_token?x_auth_access_type=read',
|
||||
];
|
||||
|
||||
yield "Write" => [
|
||||
'write', 'https://api.twitter.com/oauth/request_token?x_auth_access_type=write',
|
||||
];
|
||||
}
|
||||
|
||||
/** @dataProvider sampleTemporaryCredentialUrls */
|
||||
public function testItProvidesNoApplicationScopeByDefault(?string $applicationScope, string $url): void
|
||||
{
|
||||
$twitter = new Twitter([
|
||||
'identifier' => 'mykey',
|
||||
'secret' => 'mysecret',
|
||||
'callback_uri' => 'http://app.dev/',
|
||||
'scope' => $applicationScope,
|
||||
]);
|
||||
|
||||
self::assertEquals($url, $twitter->urlTemporaryCredentials());
|
||||
}
|
||||
}
|
||||
255
vendor/league/oauth1-client/tests/XingServerTest.php
vendored
Normal file
255
vendor/league/oauth1-client/tests/XingServerTest.php
vendored
Normal file
@@ -0,0 +1,255 @@
|
||||
<?php namespace League\OAuth1\Client\Tests;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use League\OAuth1\Client\Credentials\ClientCredentials;
|
||||
use League\OAuth1\Client\Server\Xing;
|
||||
use Mockery as m;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class XingTest extends TestCase
|
||||
{
|
||||
protected function tearDown(): void
|
||||
{
|
||||
m::close();
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testCreatingWithArray()
|
||||
{
|
||||
$server = new Xing($this->getMockClientCredentials());
|
||||
|
||||
$credentials = $server->getClientCredentials();
|
||||
$this->assertInstanceOf('League\OAuth1\Client\Credentials\ClientCredentialsInterface', $credentials);
|
||||
$this->assertEquals($this->getApplicationKey(), $credentials->getIdentifier());
|
||||
$this->assertEquals('mysecret', $credentials->getSecret());
|
||||
$this->assertEquals('http://app.dev/', $credentials->getCallbackUri());
|
||||
}
|
||||
|
||||
public function testCreatingWithObject()
|
||||
{
|
||||
$credentials = new ClientCredentials;
|
||||
$credentials->setIdentifier('myidentifier');
|
||||
$credentials->setSecret('mysecret');
|
||||
$credentials->setCallbackUri('http://app.dev/');
|
||||
|
||||
$server = new Xing($credentials);
|
||||
|
||||
$this->assertEquals($credentials, $server->getClientCredentials());
|
||||
}
|
||||
|
||||
public function testGettingTemporaryCredentials()
|
||||
{
|
||||
$server = m::mock('League\OAuth1\Client\Server\Xing[createHttpClient]', [$this->getMockClientCredentials()]);
|
||||
|
||||
$server->shouldReceive('createHttpClient')->andReturn($client = m::mock('stdClass'));
|
||||
|
||||
$me = $this;
|
||||
$client->shouldReceive('post')->with('https://api.xing.com/v1/request_token', m::on(function ($options) use ($me) {
|
||||
$headers = $options['headers'];
|
||||
$me->assertTrue(isset($headers['Authorization']));
|
||||
|
||||
// OAuth protocol specifies a strict number of
|
||||
// headers should be sent, in the correct order.
|
||||
// We'll validate that here.
|
||||
$pattern = '/OAuth oauth_consumer_key=".*?", oauth_nonce="[a-zA-Z0-9]+", oauth_signature_method="HMAC-SHA1", oauth_timestamp="\d{10}", oauth_version="1.0", oauth_callback="' . preg_quote('http%3A%2F%2Fapp.dev%2F', '/') . '", oauth_signature=".*?"/';
|
||||
|
||||
$matches = preg_match($pattern, $headers['Authorization']);
|
||||
$me->assertEquals(1, $matches, 'Asserting that the authorization header contains the correct expression.');
|
||||
|
||||
return true;
|
||||
}))->once()->andReturn($response = m::mock(ResponseInterface::class));
|
||||
$response->shouldReceive('getBody')->andReturn('oauth_token=temporarycredentialsidentifier&oauth_token_secret=temporarycredentialssecret&oauth_callback_confirmed=true');
|
||||
|
||||
$credentials = $server->getTemporaryCredentials();
|
||||
$this->assertInstanceOf('League\OAuth1\Client\Credentials\TemporaryCredentials', $credentials);
|
||||
$this->assertEquals('temporarycredentialsidentifier', $credentials->getIdentifier());
|
||||
$this->assertEquals('temporarycredentialssecret', $credentials->getSecret());
|
||||
}
|
||||
|
||||
public function testGettingDefaultAuthorizationUrl()
|
||||
{
|
||||
$server = new Xing($this->getMockClientCredentials());
|
||||
|
||||
$expected = 'https://api.xing.com/v1/authorize?oauth_token=foo';
|
||||
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl('foo'));
|
||||
|
||||
$credentials = m::mock('League\OAuth1\Client\Credentials\TemporaryCredentials');
|
||||
$credentials->shouldReceive('getIdentifier')->andReturn('foo');
|
||||
$this->assertEquals($expected, $server->getAuthorizationUrl($credentials));
|
||||
}
|
||||
|
||||
public function testGettingTokenCredentialsFailsWithManInTheMiddle()
|
||||
{
|
||||
$server = new Xing($this->getMockClientCredentials());
|
||||
|
||||
$credentials = m::mock('League\OAuth1\Client\Credentials\TemporaryCredentials');
|
||||
$credentials->shouldReceive('getIdentifier')->andReturn('foo');
|
||||
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
$server->getTokenCredentials($credentials, 'bar', 'verifier');
|
||||
}
|
||||
|
||||
public function testGettingTokenCredentials()
|
||||
{
|
||||
$server = m::mock('League\OAuth1\Client\Server\Xing[createHttpClient]', [$this->getMockClientCredentials()]);
|
||||
|
||||
$temporaryCredentials = m::mock('League\OAuth1\Client\Credentials\TemporaryCredentials');
|
||||
$temporaryCredentials->shouldReceive('getIdentifier')->andReturn('temporarycredentialsidentifier');
|
||||
$temporaryCredentials->shouldReceive('getSecret')->andReturn('temporarycredentialssecret');
|
||||
|
||||
$server->shouldReceive('createHttpClient')->andReturn($client = m::mock('stdClass'));
|
||||
|
||||
$me = $this;
|
||||
$client->shouldReceive('post')->with('https://api.xing.com/v1/access_token', m::on(function ($options) use ($me) {
|
||||
$headers = $options['headers'];
|
||||
$body = $options['form_params'];
|
||||
|
||||
$me->assertTrue(isset($headers['Authorization']));
|
||||
|
||||
// OAuth protocol specifies a strict number of
|
||||
// headers should be sent, in the correct order.
|
||||
// We'll validate that here.
|
||||
$pattern = '/OAuth oauth_consumer_key=".*?", oauth_nonce="[a-zA-Z0-9]+", oauth_signature_method="HMAC-SHA1", oauth_timestamp="\d{10}", oauth_version="1.0", oauth_token="temporarycredentialsidentifier", oauth_signature=".*?"/';
|
||||
|
||||
$matches = preg_match($pattern, $headers['Authorization']);
|
||||
$me->assertEquals(1, $matches, 'Asserting that the authorization header contains the correct expression.');
|
||||
|
||||
$me->assertSame($body, ['oauth_verifier' => 'myverifiercode']);
|
||||
|
||||
return true;
|
||||
}))->once()->andReturn($response = m::mock(ResponseInterface::class));
|
||||
$response->shouldReceive('getBody')->andReturn('oauth_token=tokencredentialsidentifier&oauth_token_secret=tokencredentialssecret');
|
||||
|
||||
$credentials = $server->getTokenCredentials($temporaryCredentials, 'temporarycredentialsidentifier', 'myverifiercode');
|
||||
$this->assertInstanceOf('League\OAuth1\Client\Credentials\TokenCredentials', $credentials);
|
||||
$this->assertEquals('tokencredentialsidentifier', $credentials->getIdentifier());
|
||||
$this->assertEquals('tokencredentialssecret', $credentials->getSecret());
|
||||
}
|
||||
|
||||
public function testGettingUserDetails()
|
||||
{
|
||||
$server = m::mock('League\OAuth1\Client\Server\Xing[createHttpClient,protocolHeader]', [$this->getMockClientCredentials()]);
|
||||
|
||||
$temporaryCredentials = m::mock('League\OAuth1\Client\Credentials\TokenCredentials');
|
||||
$temporaryCredentials->shouldReceive('getIdentifier')->andReturn('tokencredentialsidentifier');
|
||||
$temporaryCredentials->shouldReceive('getSecret')->andReturn('tokencredentialssecret');
|
||||
|
||||
$server->shouldReceive('createHttpClient')->andReturn($client = m::mock('stdClass'));
|
||||
|
||||
$me = $this;
|
||||
$client->shouldReceive('get')->with('https://api.xing.com/v1/users/me', m::on(function ($options) use ($me) {
|
||||
$headers = $options['headers'];
|
||||
|
||||
$me->assertTrue(isset($headers['Authorization']));
|
||||
|
||||
// OAuth protocol specifies a strict number of
|
||||
// headers should be sent, in the correct order.
|
||||
// We'll validate that here.
|
||||
$pattern = '/OAuth oauth_consumer_key=".*?", oauth_nonce="[a-zA-Z0-9]+", oauth_signature_method="HMAC-SHA1", oauth_timestamp="\d{10}", oauth_version="1.0", oauth_token="tokencredentialsidentifier", oauth_signature=".*?"/';
|
||||
|
||||
$matches = preg_match($pattern, $headers['Authorization']);
|
||||
$me->assertEquals(1, $matches, 'Asserting that the authorization header contains the correct expression.');
|
||||
|
||||
return true;
|
||||
}))->once()->andReturn($response = m::mock(ResponseInterface::class));
|
||||
$response->shouldReceive('getBody')->once()->andReturn($this->getUserPayload());
|
||||
|
||||
$user = $server->getUserDetails($temporaryCredentials);
|
||||
$this->assertInstanceOf('League\OAuth1\Client\Server\User', $user);
|
||||
$this->assertEquals('Roman Gelembjuk', $user->name);
|
||||
$this->assertEquals('17144430_0f9409', $server->getUserUid($temporaryCredentials));
|
||||
$this->assertEquals('XXXXXXXXXX@gmail.com', $server->getUserEmail($temporaryCredentials));
|
||||
$this->assertEquals('Roman Gelembjuk', $server->getUserScreenName($temporaryCredentials));
|
||||
}
|
||||
|
||||
protected function getMockClientCredentials()
|
||||
{
|
||||
return [
|
||||
'identifier' => $this->getApplicationKey(),
|
||||
'secret' => 'mysecret',
|
||||
'callback_uri' => 'http://app.dev/',
|
||||
];
|
||||
}
|
||||
|
||||
protected function getApplicationKey()
|
||||
{
|
||||
return 'abcdefghijk';
|
||||
}
|
||||
|
||||
protected function getApplicationExpiration($days = 0)
|
||||
{
|
||||
return is_numeric($days) && $days > 0 ? $days . 'day' . ($days == 1 ? '' : 's') : 'never';
|
||||
}
|
||||
|
||||
protected function getApplicationName()
|
||||
{
|
||||
return 'fizz buzz';
|
||||
}
|
||||
|
||||
private function getUserPayload()
|
||||
{
|
||||
return '{
|
||||
"users":[
|
||||
{
|
||||
"id":"17144430_0f9409",
|
||||
"active_email":"XXXXXXXXXX@gmail.com",
|
||||
"time_zone":
|
||||
{
|
||||
"utc_offset":3.0,
|
||||
"name":"Europe/Kiev"
|
||||
},
|
||||
"display_name":"Roman Gelembjuk",
|
||||
"first_name":"Roman",
|
||||
"last_name":"Gelembjuk",
|
||||
"gender":"m",
|
||||
"page_name":"Roman_Gelembjuk",
|
||||
"birth_date":
|
||||
{"year":null,"month":null,"day":null},
|
||||
"wants":null,
|
||||
"haves":null,
|
||||
"interests":null,
|
||||
"web_profiles":{},
|
||||
"badges":[],
|
||||
"photo_urls":
|
||||
{
|
||||
"large":"https://x1.xingassets.com/assets/frontend_minified/img/users/nobody_m.140x185.jpg",
|
||||
"maxi_thumb":"https://x1.xingassets.com/assets/frontend_minified/img/users/nobody_m.70x93.jpg",
|
||||
"medium_thumb":"https://x1.xingassets.com/assets/frontend_minified/img/users/nobody_m.57x75.jpg"
|
||||
},
|
||||
"permalink":"https://www.xing.com/profile/Roman_Gelembjuk",
|
||||
"languages":{"en":null},
|
||||
"employment_status":"EMPLOYEE",
|
||||
"organisation_member":null,
|
||||
"instant_messaging_accounts":{},
|
||||
"educational_background":
|
||||
{"degree":null,"primary_school":null,"schools":[],"qualifications":[]},
|
||||
"private_address":{
|
||||
"street":null,
|
||||
"zip_code":null,
|
||||
"city":null,
|
||||
"province":null,
|
||||
"country":null,
|
||||
"email":"XXXXXXXX@gmail.com",
|
||||
"fax":null,
|
||||
"phone":null,
|
||||
"mobile_phone":null}
|
||||
,"business_address":
|
||||
{
|
||||
"street":null,
|
||||
"zip_code":null,
|
||||
"city":"Ivano-Frankivsk",
|
||||
"province":null,
|
||||
"country":"UA",
|
||||
"email":null,
|
||||
"fax":null,"phone":null,"mobile_phone":null
|
||||
},
|
||||
"premium_services":[]
|
||||
}]}';
|
||||
}
|
||||
}
|
||||
77
vendor/league/oauth1-client/tests/stubs/ServerStub.php
vendored
Normal file
77
vendor/league/oauth1-client/tests/stubs/ServerStub.php
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace League\OAuth1\Client\Tests;
|
||||
|
||||
use League\OAuth1\Client\Credentials\TokenCredentials;
|
||||
use League\OAuth1\Client\Server\Server;
|
||||
use League\OAuth1\Client\Server\User;
|
||||
|
||||
class ServerStub extends Server
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function urlTemporaryCredentials()
|
||||
{
|
||||
return 'http://www.example.com/temporary';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function urlAuthorization()
|
||||
{
|
||||
return 'http://www.example.com/authorize';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function urlTokenCredentials()
|
||||
{
|
||||
return 'http://www.example.com/token';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function urlUserDetails()
|
||||
{
|
||||
return 'http://www.example.com/user';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function userDetails($data, TokenCredentials $tokenCredentials)
|
||||
{
|
||||
$user = new User;
|
||||
$user->firstName = $data['foo'];
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function userUid($data, TokenCredentials $tokenCredentials)
|
||||
{
|
||||
return isset($data['id']) ? $data['id'] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function userEmail($data, TokenCredentials $tokenCredentials)
|
||||
{
|
||||
return isset($data['contact_email']) ? $data['contact_email'] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function userScreenName($data, TokenCredentials $tokenCredentials)
|
||||
{
|
||||
return isset($data['username']) ? $data['username'] : null;
|
||||
}
|
||||
}
|
||||
1
vendor/league/oauth1-client/tests/test_rsa_invalidkey.pem
vendored
Normal file
1
vendor/league/oauth1-client/tests/test_rsa_invalidkey.pem
vendored
Normal file
@@ -0,0 +1 @@
|
||||
not a valid RSA key
|
||||
15
vendor/league/oauth1-client/tests/test_rsa_privatekey.pem
vendored
Normal file
15
vendor/league/oauth1-client/tests/test_rsa_privatekey.pem
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXAIBAAKBgQDJScPCpHHPakw9v4nhxi+cBumCml3WpMNDaE3Cxnkf6HALzoi8
|
||||
fQPx3XRfKSoLG6b7uTG+vDoLCL49ZCyYwrnggsFF08bJMqIhUHlZrkiyT5UhdTIh
|
||||
XEEFfb6XmieHNtra+ur8E3PVal4PEdOCEmJehBMJkiCsxNOJ/kCeYSMdbQIDAQAB
|
||||
AoGAMo7JkcEWKP/NCJFsg33xBWKjEj/NpBUcSnkPVwXc9IvAYObOZ3GLJRv3l9NS
|
||||
ERov9fgNK5hBh/X5OphHr1LxtqU5gAFYx5Qgt/WG3ZH9KScXkaPS3Oq2qK9krbA2
|
||||
BXYKP4NEqhjJTecy7M8bju5+lsjteyqVSsVLHdLhUfPRbE0CQQDyYP6iChqZm1AK
|
||||
A8x8PKvJsd4zSdxWXUYSmD7mAtek5VeWblbcXYYdeYPN6hNmqzaLelmrZI51x1Uf
|
||||
hf1ryIfrAkEA1JmdSsNuxi9MOY3HqErWYsqZ//mVOxVyCAwf7OWQ0rTHEQBhQwpS
|
||||
9nk0YFHI9t6nVUwXrZ7/7UJPTu8OjPKyBwJAYw2OomwcqM/XKvCYfeFRl1DwbOdv
|
||||
e4AM5gaAFgHtXP85B0o6hz5VU/BYFCvoF9o6pU+wG6IxsiJvQD3C7mx6VwJAbXYW
|
||||
PVs4WsQZe/ya0vSNQ1pLRjdr9XrKNoh/m4prMYGwiPloGotjQdIP/JO/ZBQplcpS
|
||||
2qrl3HPqv5poJHwE2wJBAM37BVINHR0zcSHfFLmSYrqmLx2oC3UAB3exmpYSUgOz
|
||||
wJqPfmPWuuXuu6h0Z2DazUan+2EiecX6C4ywkm+qk1I=
|
||||
-----END RSA PRIVATE KEY-----
|
||||
19
vendor/league/oauth1-client/tests/test_rsa_publickey.pem
vendored
Normal file
19
vendor/league/oauth1-client/tests/test_rsa_publickey.pem
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDEDCCAnmgAwIBAgIJAMhMVuHMz+EgMA0GCSqGSIb3DQEBBQUAMGQxCzAJBgNV
|
||||
BAYTAlVTMQswCQYDVQQIEwJUWDEPMA0GA1UEBxMGQXVzdGluMSEwHwYDVQQKExhJ
|
||||
bnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxFDASBgNVBAMTC2V4YW1wbGUuY29tMB4X
|
||||
DTE2MTEwMjIxMDUzNVoXDTIxMTEwMTIxMDUzNVowZDELMAkGA1UEBhMCVVMxCzAJ
|
||||
BgNVBAgTAlRYMQ8wDQYDVQQHEwZBdXN0aW4xITAfBgNVBAoTGEludGVybmV0IFdp
|
||||
ZGdpdHMgUHR5IEx0ZDEUMBIGA1UEAxMLZXhhbXBsZS5jb20wgZ8wDQYJKoZIhvcN
|
||||
AQEBBQADgY0AMIGJAoGBAMlJw8Kkcc9qTD2/ieHGL5wG6YKaXdakw0NoTcLGeR/o
|
||||
cAvOiLx9A/HddF8pKgsbpvu5Mb68OgsIvj1kLJjCueCCwUXTxskyoiFQeVmuSLJP
|
||||
lSF1MiFcQQV9vpeaJ4c22tr66vwTc9VqXg8R04ISYl6EEwmSIKzE04n+QJ5hIx1t
|
||||
AgMBAAGjgckwgcYwHQYDVR0OBBYEFLYKQbsK2oqRO83NbNXC2R6MkNcRMIGWBgNV
|
||||
HSMEgY4wgYuAFLYKQbsK2oqRO83NbNXC2R6MkNcRoWikZjBkMQswCQYDVQQGEwJV
|
||||
UzELMAkGA1UECBMCVFgxDzANBgNVBAcTBkF1c3RpbjEhMB8GA1UEChMYSW50ZXJu
|
||||
ZXQgV2lkZ2l0cyBQdHkgTHRkMRQwEgYDVQQDEwtleGFtcGxlLmNvbYIJAMhMVuHM
|
||||
z+EgMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEASwEwGQnRCqcNrb6k
|
||||
g6/xpeyHE9/ruTBIE4dtArQI0NosaERC3i4nRKbgfJfIuYEaYiga4dC51CQqKrbH
|
||||
YZ0dgYMzzp21OMQyKdz3E7csMJv5xxe5D2svdPzbBGU5+N80FYLx17f3UqsYFaAC
|
||||
X0/YTQsdlM5tHZOd1ZbQUrERqLs=
|
||||
-----END CERTIFICATE-----
|
||||
Reference in New Issue
Block a user