refactor: migrate to scoped execution contexts
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -4,8 +4,8 @@ namespace KTXM\AuthenticationProviderPassword\Controllers;
|
||||
|
||||
use KTXC\Http\Response\JsonResponse;
|
||||
use KTXC\Service\UserAccountsService;
|
||||
use KTXC\SessionIdentity;
|
||||
use KTXC\SessionTenant;
|
||||
use KTXC\Context\IdentityContextInterface;
|
||||
use KTXC\Context\TenantContextInterface;
|
||||
use KTXF\Controller\ControllerAbstract;
|
||||
use KTXF\Routing\Attributes\AuthenticatedRoute;
|
||||
use KTXF\Security\Crypto;
|
||||
@@ -15,8 +15,8 @@ use KTXM\AuthenticationProviderPassword\Stores\CredentialStore;
|
||||
class PasswordController extends ControllerAbstract
|
||||
{
|
||||
public function __construct(
|
||||
private readonly SessionIdentity $sessionIdentity,
|
||||
private readonly SessionTenant $sessionTenant,
|
||||
private readonly IdentityContextInterface $identityContext,
|
||||
private readonly TenantContextInterface $tenantContext,
|
||||
private readonly CredentialStore $credentialStore,
|
||||
private readonly Provider $provider,
|
||||
private readonly Crypto $crypto,
|
||||
@@ -27,8 +27,8 @@ class PasswordController extends ControllerAbstract
|
||||
#[AuthenticatedRoute('/password/update', name: 'password.update', methods: ['POST'])]
|
||||
public function update(string $current_password, string $new_password): JsonResponse
|
||||
{
|
||||
$tenantId = $this->sessionTenant->identifier();
|
||||
$identifier = $this->sessionIdentity->mailAddress();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$identifier = $this->identityContext->mailAddress();
|
||||
|
||||
if ($tenantId === null || $identifier === null) {
|
||||
return new JsonResponse(['error' => 'Invalid session state'], 400);
|
||||
@@ -56,7 +56,7 @@ class PasswordController extends ControllerAbstract
|
||||
#[AuthenticatedRoute('/status', name: 'password.admin.status', methods: ['POST'], permissions: ['authentication_provider_password.admin.view', 'authentication_provider_password.admin.manage'])]
|
||||
public function getStatus(string $uid): JsonResponse
|
||||
{
|
||||
$tenantId = $this->sessionTenant->identifier();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
|
||||
if ($tenantId === null) {
|
||||
return new JsonResponse(['error' => 'Invalid session state'], 400);
|
||||
@@ -82,7 +82,7 @@ class PasswordController extends ControllerAbstract
|
||||
#[AuthenticatedRoute('/reset', name: 'password.admin.reset', methods: ['POST'], permissions: ['authentication_provider_password.admin.manage'])]
|
||||
public function adminReset(string $uid, string $password): JsonResponse
|
||||
{
|
||||
$tenantId = $this->sessionTenant->identifier();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
|
||||
if ($tenantId === null) {
|
||||
return new JsonResponse(['error' => 'Invalid session state'], 400);
|
||||
@@ -113,7 +113,7 @@ class PasswordController extends ControllerAbstract
|
||||
#[AuthenticatedRoute('/remove', name: 'password.admin.remove', methods: ['POST'], permissions: ['authentication_provider_password.admin.manage'])]
|
||||
public function adminRemove(string $uid): JsonResponse
|
||||
{
|
||||
$tenantId = $this->sessionTenant->identifier();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
|
||||
if ($tenantId === null) {
|
||||
return new JsonResponse(['error' => 'Invalid session state'], 400);
|
||||
|
||||
Reference in New Issue
Block a user