Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
50.00% |
5 / 10 |
|
28.57% |
2 / 7 |
CRAP | |
0.00% |
0 / 1 |
| ApieUserProvider | |
50.00% |
5 / 10 |
|
28.57% |
2 / 7 |
13.12 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| retrieveById | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| retrieveByToken | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| updateRememberToken | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| retrieveByCredentials | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| validateCredentials | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| rehashPasswordIfRequired | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace Apie\LaravelApie\Wrappers\Security; |
| 3 | |
| 4 | use Apie\Common\ApieFacade; |
| 5 | use Apie\Common\ValueObjects\DecryptedAuthenticatedUser; |
| 6 | use Apie\Core\Entities\EntityInterface; |
| 7 | use Illuminate\Contracts\Auth\Authenticatable; |
| 8 | use Illuminate\Contracts\Auth\UserProvider; |
| 9 | |
| 10 | class ApieUserProvider implements UserProvider |
| 11 | { |
| 12 | public function __construct(private readonly ApieFacade $apieFacade) |
| 13 | { |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * @return ApieUserDecorator<EntityInterface> |
| 18 | */ |
| 19 | public function retrieveById($identifier): ApieUserDecorator |
| 20 | { |
| 21 | $identifier = new DecryptedAuthenticatedUser($identifier); |
| 22 | $boundedContextId = $identifier->getBoundedContextId(); |
| 23 | $entity = $this->apieFacade->find($identifier->getId(), $boundedContextId); |
| 24 | return new ApieUserDecorator($identifier, $entity); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * @return ApieUserDecorator<EntityInterface>|null |
| 29 | */ |
| 30 | public function retrieveByToken($identifier, $token): ?ApieUserDecorator |
| 31 | { |
| 32 | return null; |
| 33 | } |
| 34 | |
| 35 | public function updateRememberToken(Authenticatable $user, $token): void |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * @param array<int|string, mixed> $credentials |
| 41 | * @return ApieUserDecorator<EntityInterface>|null |
| 42 | */ |
| 43 | public function retrieveByCredentials(#[\SensitiveParameter] array $credentials): ?ApieUserDecorator |
| 44 | { |
| 45 | // TODO find the verifyAuthentication action... |
| 46 | return null; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * @param array<int|string, mixed> $credentials |
| 51 | */ |
| 52 | public function validateCredentials(Authenticatable $user, #[\SensitiveParameter] array $credentials): bool |
| 53 | { |
| 54 | // TODO find the verifyAuthentication action... |
| 55 | return false; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * @param array<int|string, mixed> $credentials |
| 60 | */ |
| 61 | public function rehashPasswordIfRequired( |
| 62 | Authenticatable $user, |
| 63 | #[\SensitiveParameter] array $credentials, |
| 64 | bool $force = false |
| 65 | ): void { |
| 66 | // TODO find the verifyAuthentication action.... |
| 67 | } |
| 68 | } |