Skip to content
This repository has been archived by the owner on Jul 21, 2022. It is now read-only.

Commit

Permalink
chore(deps): upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
matbour committed Feb 6, 2021
1 parent 23f4364 commit 0607e1d
Show file tree
Hide file tree
Showing 12 changed files with 2,209 additions and 2,586 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"require-dev": {
"laravel/framework": "^7.0",
"laravel/lumen-framework": "^7.0",
"mathrix-education/coding-standard": "2.0.1",
"mathieu-bour/coding-standard": "1.0.1",
"mockery/mockery": "^1.3",
"phpbench/phpbench": "^0.17.0",
"phpunit/phpunit": "^8.0",
Expand Down
4,720 changes: 2,160 additions & 2,560 deletions docs/package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
},
"homepage": "https://github.com/mathieu-bour/guardian#readme",
"devDependencies": {
"mermaid": "^8.5.0",
"vuepress": "^1.4.1",
"vuepress-plugin-mermaidjs": "^1.4.0"
"mermaid": "^8.9.0",
"vuepress": "^1.8.0",
"vuepress-plugin-mermaidjs": "^1.8.1"
}
}
2 changes: 1 addition & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<config name="php_version" value="70205"/>

<!-- Rules inherited from Doctrine -->
<rule ref="Mathrix">
<rule ref="Windy">
<exclude name="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator"/>
<exclude name="SlevomatCodingStandard.Functions.TrailingCommaInCall"/>
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint"/>
Expand Down
9 changes: 4 additions & 5 deletions src/Auth/GuardianRequestGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ protected function validateRequest(Request $request): bool
return false;
}

return ($this->lastAttempted = $this->getProvider()->retrieveById($claims['sub'])) !== false;
return ($this->lastAttempted = $this->getProvider()->retrieveById(
$claims['sub']
)) !== false;
}

/**
Expand All @@ -183,10 +185,7 @@ protected function validateCredentials(array $credentials): bool
return false;
}

return $this->getProvider()->validateCredentials(
$this->lastAttempted,
$credentials
);
return $this->getProvider()->validateCredentials($this->lastAttempted, $credentials);
}

/**
Expand Down
10 changes: 8 additions & 2 deletions src/Crypto/KeyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,14 @@ public function getAlgorithm(string $algorithm): string
}

$map = array_merge(
array_fill_keys(Constants::ECDSA_ALGORITHMS, 'web-token/jwt-signature-algorithm-ecdsa'),
array_fill_keys(Constants::EDDSA_ALGORITHMS, 'web-token/jwt-signature-algorithm-eddsa'),
array_fill_keys(
Constants::ECDSA_ALGORITHMS,
'web-token/jwt-signature-algorithm-ecdsa'
),
array_fill_keys(
Constants::EDDSA_ALGORITHMS,
'web-token/jwt-signature-algorithm-eddsa'
),
array_fill_keys(Constants::HMAC_ALGORITHMS, 'web-token/jwt-signature-algorithm-hmac'),
array_fill_keys(Constants::RSA_ALGORITHMS, 'web-token/jwt-signature-algorithm-rsa')
);
Expand Down
12 changes: 9 additions & 3 deletions src/Utils/IO.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public function read(string $path): string
}

if (!is_readable($path)) {
throw new IOException("File $path exists but is not readable with the current user privileges");
throw new IOException(
"File $path exists but is not readable with the current user privileges"
);
}

return file_get_contents($path);
Expand All @@ -59,11 +61,15 @@ public function write(string $path, $data)
}

if (file_exists($path) && !is_writable($path)) {
throw new IOException("File $path exists but is not writable with the current user privileges");
throw new IOException(
"File $path exists but is not writable with the current user privileges"
);
}

if (!is_writable($dir)) {
throw new IOException("Directory $dir exists but is not writable with the current user privileges");
throw new IOException(
"Directory $dir exists but is not writable with the current user privileges"
);
}

return file_put_contents($path, $data);
Expand Down
10 changes: 4 additions & 6 deletions tests/Functional/Auth/GuardianRequestGuardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,7 @@ public function testConstruct(): void
{
$container = Mockery::mock(Container::class);

$guard = new GuardianRequestGuard(
$container,
'guard',
self::CONFIG['guards']['guardian']
);
$guard = new GuardianRequestGuard($container, 'guard', self::CONFIG['guards']['guardian']);

$this->assertNotNull($guard);
}
Expand Down Expand Up @@ -221,7 +217,9 @@ public function testValidateRequestNoCredentials(): void
$authority = Mockery::mock(Authority::class);
$authority->expects('verify')->withArgs([$token, true]);
$authority->expects('check')->withArgs([$token, true]);
$authority->expects('unserialize->getPayload')->withNoArgs()->andReturns("{\"sub\":\"$id\"}");
$authority->expects('unserialize->getPayload')->withNoArgs()->andReturns(
"{\"sub\":\"$id\"}"
);

$provider = Mockery::mock(UserProvider::class);
$provider->expects('retrieveById')->withArgs([(string)$id]);
Expand Down
6 changes: 5 additions & 1 deletion tests/Functional/Crypto/AuthoritiesRegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ public function testCreate(): void
->withArgs(['bar'])
->andReturns(Mockery::mock(Claims::class));

$registry = new AuthoritiesRegistry($this->app->make(Container::class), $keysRegistry, $claimsRegistry);
$registry = new AuthoritiesRegistry(
$this->app->make(Container::class),
$keysRegistry,
$claimsRegistry
);
$this->assertNotNull($registry->create(['key' => 'foo', 'claims' => 'bar']));
}

Expand Down
10 changes: 8 additions & 2 deletions tests/Functional/Crypto/AuthorityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@ public function createUnserializeDataset(): array
*/
public function testUnserialize($jws, string $expectedPayload): void
{
$this->assertEquals($expectedPayload, $this->getAuthority()->unserialize($jws)->getPayload());
$this->assertEquals(
$expectedPayload,
$this->getAuthority()->unserialize($jws)->getPayload()
);
}

/**
Expand Down Expand Up @@ -249,6 +252,9 @@ public function testCheck(
$this->expectException($expectedException);
}

$this->assertEquals($expectValid, $this->getAuthority()->check($jws, $expectedException !== null));
$this->assertEquals(
$expectValid,
$this->getAuthority()->check($jws, $expectedException !== null)
);
}
}
4 changes: 3 additions & 1 deletion tests/Functional/Crypto/KeyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public function setUp(): void
*/
public function testConstruct(): void
{
$this->assertNotNull(new Key(JWKFactory::createOctKey(256), ['algorithm' => HS256::class]));
$this->assertNotNull(
new Key(JWKFactory::createOctKey(256), ['algorithm' => HS256::class])
);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/Functional/Crypto/KeysRegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ public function testCreate(): void
{
$config = ['foo' => 'bar'];
$keyFactory = Mockery::mock(KeyFactory::class);
$keyFactory->expects('createFromConfig')->withArgs([$config])->andReturns(Mockery::mock(Key::class));
$keyFactory->expects('createFromConfig')->withArgs([$config])->andReturns(
Mockery::mock(Key::class)
);
$this->app->instance(KeyFactory::class, $keyFactory);

/** @var KeysRegistry $registry */
Expand Down

0 comments on commit 0607e1d

Please sign in to comment.