Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8704a02a09 |
@@ -10,7 +10,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
mongo:
|
||||
image: mongo:7
|
||||
image: mongo:8
|
||||
options: >-
|
||||
--health-cmd "mongosh --quiet --eval \"db.adminCommand('ping')\""
|
||||
--health-interval 5s
|
||||
|
||||
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace KTXM\AuthenticationProviderTotp\Controllers;
|
||||
|
||||
use KTXC\Http\Response\JsonResponse;
|
||||
use KTXC\Context\IdentityContextInterface;
|
||||
use KTXC\SessionIdentity;
|
||||
use KTXF\Controller\ControllerAbstract;
|
||||
use KTXF\Routing\Attributes\AuthenticatedRoute;
|
||||
use KTXM\AuthenticationProviderTotp\Services\EnrollmentService;
|
||||
@@ -23,7 +23,7 @@ use KTXM\AuthenticationProviderTotp\Services\EnrollmentService;
|
||||
class EnrollmentController extends ControllerAbstract
|
||||
{
|
||||
public function __construct(
|
||||
private readonly IdentityContextInterface $identityContext,
|
||||
private readonly SessionIdentity $userIdentity,
|
||||
private readonly EnrollmentService $enrollmentService,
|
||||
) {}
|
||||
|
||||
@@ -33,7 +33,7 @@ class EnrollmentController extends ControllerAbstract
|
||||
#[AuthenticatedRoute('/totp/status', name: 'totp.status', methods: ['GET'])]
|
||||
public function status(): JsonResponse
|
||||
{
|
||||
$userId = $this->identityContext->identifier();
|
||||
$userId = $this->userIdentity->identifier();
|
||||
if (!$userId) {
|
||||
return new JsonResponse(
|
||||
['error' => 'User not authenticated', 'error_code' => 'unauthorized'],
|
||||
@@ -56,7 +56,7 @@ class EnrollmentController extends ControllerAbstract
|
||||
#[AuthenticatedRoute('/totp/enroll', name: 'totp.enroll.begin', methods: ['POST'])]
|
||||
public function beginEnrollment(string $accountName = ''): JsonResponse
|
||||
{
|
||||
$userId = $this->identityContext->identifier();
|
||||
$userId = $this->userIdentity->identifier();
|
||||
if (!$userId) {
|
||||
return new JsonResponse(
|
||||
['error' => 'User not authenticated', 'error_code' => 'unauthorized'],
|
||||
@@ -95,7 +95,7 @@ class EnrollmentController extends ControllerAbstract
|
||||
#[AuthenticatedRoute('/totp/enroll/verify', name: 'totp.enroll.verify', methods: ['POST'])]
|
||||
public function completeEnrollment(string $code): JsonResponse
|
||||
{
|
||||
$userId = $this->identityContext->identifier();
|
||||
$userId = $this->userIdentity->identifier();
|
||||
if (!$userId) {
|
||||
return new JsonResponse(
|
||||
['error' => 'User not authenticated', 'error_code' => 'unauthorized'],
|
||||
@@ -131,7 +131,7 @@ class EnrollmentController extends ControllerAbstract
|
||||
#[AuthenticatedRoute('/totp/enroll/remove', name: 'totp.enroll.remove', methods: ['POST'])]
|
||||
public function removeEnrollment(string $code): JsonResponse
|
||||
{
|
||||
$userId = $this->identityContext->identifier();
|
||||
$userId = $this->userIdentity->identifier();
|
||||
if (!$userId) {
|
||||
return new JsonResponse(
|
||||
['error' => 'User not authenticated', 'error_code' => 'unauthorized'],
|
||||
|
||||
@@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace KTXM\AuthenticationProviderTotp\Services;
|
||||
|
||||
use KTXC\Context\TenantContextInterface;
|
||||
use KTXC\SessionTenant;
|
||||
use KTXM\AuthenticationProviderTotp\Stores\EnrollmentStore;
|
||||
|
||||
/**
|
||||
@@ -26,7 +26,7 @@ class EnrollmentService
|
||||
private const SECRET_LENGTH = 20; // 160 bits as recommended by RFC 4226
|
||||
|
||||
public function __construct(
|
||||
private readonly TenantContextInterface $tenantContext,
|
||||
private readonly SessionTenant $tenant,
|
||||
private readonly EnrollmentStore $enrollmentStore,
|
||||
) {}
|
||||
|
||||
@@ -35,7 +35,7 @@ class EnrollmentService
|
||||
*/
|
||||
public function isEnrolled(string $userId): bool
|
||||
{
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$tenantId = $this->tenant->identifier();
|
||||
if (!$tenantId) {
|
||||
return false;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class EnrollmentService
|
||||
*/
|
||||
public function beginEnrollment(string $userId, array $config = []): array
|
||||
{
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$tenantId = $this->tenant->identifier();
|
||||
if (!$tenantId) {
|
||||
return [
|
||||
'success' => false,
|
||||
@@ -108,7 +108,7 @@ class EnrollmentService
|
||||
*/
|
||||
public function completeEnrollment(string $userId, string $code): array
|
||||
{
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$tenantId = $this->tenant->identifier();
|
||||
if (!$tenantId) {
|
||||
return [
|
||||
'success' => false,
|
||||
@@ -150,7 +150,7 @@ class EnrollmentService
|
||||
*/
|
||||
public function removeEnrollment(string $userId): array
|
||||
{
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$tenantId = $this->tenant->identifier();
|
||||
if (!$tenantId) {
|
||||
return [
|
||||
'success' => false,
|
||||
@@ -181,7 +181,7 @@ class EnrollmentService
|
||||
*/
|
||||
public function verifyCode(string $userId, string $code): array
|
||||
{
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$tenantId = $this->tenant->identifier();
|
||||
if (!$tenantId) {
|
||||
return [
|
||||
'success' => false,
|
||||
@@ -225,7 +225,7 @@ class EnrollmentService
|
||||
*/
|
||||
public function getEnrollmentSecret(string $userId): ?string
|
||||
{
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$tenantId = $this->tenant->identifier();
|
||||
if (!$tenantId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Generated
+38
-47
@@ -22,7 +22,7 @@
|
||||
"@vitest/coverage-v8": "^4.1.6",
|
||||
"@vue/test-utils": "^2.4.10",
|
||||
"@vue/tsconfig": "^0.9.0",
|
||||
"jsdom": "^30.0.0",
|
||||
"jsdom": "^29.1.1",
|
||||
"typescript": "~6.0.0",
|
||||
"vite": "^8.0.0",
|
||||
"vitest": "^4.1.6",
|
||||
@@ -30,38 +30,48 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@asamuzakjp/css-color": {
|
||||
"version": "6.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-6.0.5.tgz",
|
||||
"integrity": "sha512-mbhpPMmnw/kwW19aRNmSUl1QzLbdGo1SCuE49BT98MNwqF6zaHb3o2owssFc/PEO/4t2UjqtCNwocuDtJornzA==",
|
||||
"version": "5.1.11",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@csstools/css-calc": "^3.2.1",
|
||||
"@csstools/css-color-parser": "^4.1.9",
|
||||
"@asamuzakjp/generational-cache": "^1.0.1",
|
||||
"@csstools/css-calc": "^3.2.0",
|
||||
"@csstools/css-color-parser": "^4.1.0",
|
||||
"@csstools/css-parser-algorithms": "^4.0.0",
|
||||
"@csstools/css-tokenizer": "^4.0.0",
|
||||
"lru-cache": "^11.5.2"
|
||||
"@csstools/css-tokenizer": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^22.13.0 || >=24.0.0"
|
||||
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@asamuzakjp/dom-selector": {
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-8.3.0.tgz",
|
||||
"integrity": "sha512-UJLfKXBhrc8i1vH2eJXuYQMwlsLKWFw3O+CPqXSuVEiikeAim3UgrfWX0k4tA/X8cRFM8iZ7OaqBokFGbYusdg==",
|
||||
"version": "7.1.1",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@asamuzakjp/generational-cache": "^1.0.1",
|
||||
"@asamuzakjp/nwsapi": "^2.3.9",
|
||||
"bidi-js": "^1.0.3",
|
||||
"css-tree": "^3.2.1",
|
||||
"is-potential-custom-element-name": "^1.0.1",
|
||||
"lru-cache": "^11.5.2"
|
||||
"is-potential-custom-element-name": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^22.13.0 || >=24.0.0"
|
||||
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@asamuzakjp/generational-cache": {
|
||||
"version": "1.0.1",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@asamuzakjp/nwsapi": {
|
||||
"version": "2.3.9",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@babel/generator": {
|
||||
"version": "8.0.0",
|
||||
"license": "MIT",
|
||||
@@ -1700,39 +1710,37 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/jsdom": {
|
||||
"version": "30.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsdom/-/jsdom-30.0.0.tgz",
|
||||
"integrity": "sha512-JQHfRGmmKmaZoUAvIgff5jjG/0SzTQlGz8c7t72KzBzo8ZULEjAjnYE0sNwBOUA4QtWwYE2xoYitg8NFsmiYxA==",
|
||||
"version": "29.1.1",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@asamuzakjp/css-color": "^6.0.5",
|
||||
"@asamuzakjp/dom-selector": "^8.2.5",
|
||||
"@asamuzakjp/css-color": "^5.1.11",
|
||||
"@asamuzakjp/dom-selector": "^7.1.1",
|
||||
"@bramus/specificity": "^2.4.2",
|
||||
"@csstools/css-syntax-patches-for-csstree": "^1.1.6",
|
||||
"@exodus/bytes": "^1.15.1",
|
||||
"@csstools/css-syntax-patches-for-csstree": "^1.1.3",
|
||||
"@exodus/bytes": "^1.15.0",
|
||||
"css-tree": "^3.2.1",
|
||||
"data-urls": "^7.0.0",
|
||||
"decimal.js": "^10.6.0",
|
||||
"html-encoding-sniffer": "^6.0.0",
|
||||
"is-potential-custom-element-name": "^1.0.1",
|
||||
"lru-cache": "^11.5.2",
|
||||
"lru-cache": "^11.3.5",
|
||||
"parse5": "^8.0.1",
|
||||
"saxes": "^6.0.0",
|
||||
"symbol-tree": "^3.2.4",
|
||||
"tough-cookie": "^6.0.2",
|
||||
"undici": "^8.7.0",
|
||||
"tough-cookie": "^6.0.1",
|
||||
"undici": "^7.25.0",
|
||||
"w3c-xmlserializer": "^5.0.0",
|
||||
"webidl-conversions": "^8.0.1",
|
||||
"whatwg-mimetype": "^5.0.0",
|
||||
"whatwg-url": "^17.1.0",
|
||||
"whatwg-url": "^16.0.1",
|
||||
"xml-name-validator": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^22.22.2 || ^24.15.0 || >=26.0.0"
|
||||
"node": "^20.19.0 || ^22.13.0 || >=24.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"canvas": "^3.2.3"
|
||||
"canvas": "^3.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"canvas": {
|
||||
@@ -1740,21 +1748,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/jsdom/node_modules/whatwg-url": {
|
||||
"version": "17.1.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-17.1.0.tgz",
|
||||
"integrity": "sha512-3GeworPmc2ZfEEHP7lEbUfBX/L75wdEsi0rLNhXcXxnoN5jyq0SL5gCy06SGW2cyTIZdTvWIDQNQoza++vKeaw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@exodus/bytes": "^1.15.1",
|
||||
"tr46": "^6.0.0",
|
||||
"webidl-conversions": "^8.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^22.14.0 || >=24.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/jsesc": {
|
||||
"version": "3.1.0",
|
||||
"license": "MIT",
|
||||
@@ -2725,13 +2718,11 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "8.9.0",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-8.9.0.tgz",
|
||||
"integrity": "sha512-aWZpUj7XoGonMClx4gdDRfgBjqeA+F473aDmROQQbM9n6PRfK/u1q/a0X4wMTgcHfT8H6fpbt98PFuDUwFg2YA==",
|
||||
"version": "7.28.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=22.19.0"
|
||||
"node": ">=20.18.1"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@
|
||||
"vue-tsc": "^3.0.5",
|
||||
"@vitest/coverage-v8": "^4.1.6",
|
||||
"@vue/test-utils": "^2.4.10",
|
||||
"jsdom": "^30.0.0",
|
||||
"jsdom": "^29.1.1",
|
||||
"vitest": "^4.1.6"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user