Skip to content

Commit fd66ab1

Browse files
authored
Merge pull request #1 from cleverage/feature/v2.0
Add a Doctrine custom type to handle encryption to avoid issues with Doctrine events
2 parents 1d565b0 + 043cbdc commit fd66ab1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+618
-476
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
/.idea/
2+
/.phpunit.result.cache
3+
/bin
4+
/composer.lock
5+
/var
6+
/vendor

EventSubscriber/CryptableSubscriber.php

Lines changed: 0 additions & 281 deletions
This file was deleted.

Resources/config/services/deprecated.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

Resources/config/services/registry.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

composer.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@
2222
"require": {
2323
"php": "^7.4",
2424
"ext-mbstring": "*",
25-
"symfony/framework-bundle": "^4.4|^5.1"
25+
"symfony/framework-bundle": "^4.4|^5.1",
26+
"doctrine/doctrine-bundle": "*",
27+
"doctrine/orm": "*",
28+
"symfony/stopwatch": "^4.4|^5.1",
29+
"symfony/security":"^4.4|^5.1"
30+
},
31+
"require-dev": {
32+
"phpunit/phpunit": "^9.4"
2633
},
2734
"suggest": {
2835
"doctrine/doctrine-bundle": "Use Doctrine to encrypt and decrypt entities automatically",
@@ -33,10 +40,18 @@
3340
},
3441
"autoload": {
3542
"psr-4": {
36-
"Sidus\\EncryptionBundle\\": ""
43+
"Sidus\\EncryptionBundle\\": "src/"
44+
}
45+
},
46+
"autoload-dev": {
47+
"psr-4": {
48+
"Sidus\\EncryptionBundle\\Tests\\": "tests/"
3749
}
3850
},
3951
"conflict": {
4052
"sidus/encryption-bundle": "*"
53+
},
54+
"config": {
55+
"bin-dir": "bin"
4156
}
4257
}

phpunit.xml.dist

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
3+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
5+
colors="true"
6+
bootstrap="tests/bootstrap.php">
7+
<coverage>
8+
<include>
9+
<directory>src</directory>
10+
</include>
11+
<report>
12+
<clover outputFile="var/phpunit/logs/clover.xml"/>
13+
<html outputDirectory="var/phpunit/coverage" lowUpperBound="35" highLowerBound="70"/>
14+
</report>
15+
</coverage>
16+
<php>
17+
<ini name="error_reporting" value="-1"/>
18+
<server name="APP_ENV" value="test" force="true"/>
19+
<server name="SHELL_VERBOSITY" value="-1"/>
20+
<server name="SYMFONY_PHPUNIT_REMOVE" value=""/>
21+
<server name="SYMFONY_PHPUNIT_VERSION" value="6.5"/>
22+
</php>
23+
<testsuites>
24+
<testsuite name="SidusEncryptionBundle Test Suite">
25+
<directory>tests</directory>
26+
</testsuite>
27+
</testsuites>
28+
<logging>
29+
<junit outputFile="var/phpunit/logs/junit.xml"/>
30+
</logging>
31+
</phpunit>

Authentication/AuthenticationProvider.php renamed to src/Authentication/AuthenticationProvider.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
*/
2626
class AuthenticationProvider extends DaoAuthenticationProvider
2727
{
28-
/** @var EncryptionManagerRegistry */
29-
protected $encryptionManagerRegistry;
28+
protected EncryptionManagerRegistry $encryptionManagerRegistry;
3029

3130
/**
3231
* @param EncryptionManagerRegistry $encryptionManagerRegistry
@@ -54,7 +53,6 @@ protected function retrieveUser($username, UsernamePasswordToken $token)
5453
$encryptionManager->decryptCipherKey($user, $token->getCredentials());
5554
} catch (EncryptionException $e) {
5655
throw new BadCredentialsException('Bad credentials.', 0, $e);
57-
$e->setUsername($username);
5856
}
5957
}
6058

0 commit comments

Comments
 (0)