Skip to content

Commit 5122085

Browse files
OXDEV-9919 Refactoring and code cleanup
1 parent c861e4c commit 5122085

49 files changed

Lines changed: 725 additions & 392 deletions

Some content is hidden

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

metadata.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
//OAuth2 settings
118118
[
119119
'group' => 'oauth',
120-
'name' => ModuleSettingsService::FACEBOOK_ACTIVE,
120+
'name' => ModuleSettingsService::FACEBOOK_LOGIN_ENABLED,
121121
'type' => 'bool',
122122
'value' => false
123123
],

src/Authentication/OAuth2/Controller/OAuthController.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public function login(): void
1414
$providerCollector = $this->getService(ProviderCollectorInterface::class);
1515

1616
$provider = $providerCollector->getProvider($_GET['provider']);
17-
$provider->getClient();
1817

1918
Registry::getUtils()->redirect($provider->getAuthorizationUrl());
2019
}
@@ -25,15 +24,13 @@ public function redirect(): void
2524
->getService(ProviderCollectorInterface::class)
2625
->getProvider('facebook');
2726

28-
$provider->getClient();
29-
3027
$accessToken = $provider->getAccessToken($_GET['code']);
3128

32-
$userDTO = $provider->getUserInfo($accessToken);
29+
$userDataObject = $provider->getUserInfo($accessToken);
3330

3431
$this
3532
->getService(UserServiceInterface::class)
36-
->login($userDTO);
33+
->login($userDataObject);
3734

3835
Registry::getUtils()->redirect('');
3936
}

src/Authentication/OAuth2/DTO/UserDTO.php

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

src/Authentication/OAuth2/DTO/UserDTOInterface.php

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
/**
4+
* Copyright © OXID eSales AG. All rights reserved.
5+
* See LICENSE file for license details.
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace OxidEsales\SecurityModule\Authentication\OAuth2\DataObject;
11+
12+
readonly class User implements UserInterface
13+
{
14+
public function __construct(
15+
private ?string $email,
16+
) {
17+
}
18+
19+
public function getEmail(): ?string
20+
{
21+
return $this->email;
22+
}
23+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
/**
4+
* Copyright © OXID eSales AG. All rights reserved.
5+
* See LICENSE file for license details.
6+
*/
7+
8+
namespace OxidEsales\SecurityModule\Authentication\OAuth2\DataObject;
9+
10+
interface UserInterface
11+
{
12+
public function getEmail(): ?string;
13+
}

src/Authentication/OAuth2/Service/Provider/ProviderNotFound.php renamed to src/Authentication/OAuth2/Exception/ProviderNotFoundException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
declare(strict_types=1);
99

10-
namespace OxidEsales\SecurityModule\Authentication\OAuth2\Service\Provider;
10+
namespace OxidEsales\SecurityModule\Authentication\OAuth2\Exception;
1111

12-
class ProviderNotFound extends \Exception
12+
class ProviderNotFoundException extends \Exception
1313
{
1414
}

src/Authentication/OAuth2/Exception/UserBlockedException.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,4 @@
1111

1212
class UserBlockedException extends \Exception
1313
{
14-
public function __construct()
15-
{
16-
parent::__construct('ERROR_USER_BLOCKED');
17-
}
1814
}

src/Authentication/OAuth2/Exception/UserNotFoundException.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,4 @@
1111

1212
class UserNotFoundException extends \Exception
1313
{
14-
public function __construct()
15-
{
16-
parent::__construct('ERROR_USER_NOT_FOUND');
17-
}
1814
}

src/Authentication/OAuth2/Factory/services.yaml

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

0 commit comments

Comments
 (0)