Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"require-dev": {
"cakephp/cakephp": "^5.1.0",
"cakephp/cakephp-codesniffer": "^5.0",
"firebase/php-jwt": "^6.2",
"firebase/php-jwt": "^7.0",
"phpunit/phpunit": "^10.5.32 || ^11.3.3 || ^12.0.9"
},
"suggest": {
Expand Down
12 changes: 6 additions & 6 deletions tests/TestCase/Authenticator/JwtAuthenticatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function setUp(): void
'firstname' => 'larry',
];

$this->tokenHS256 = JWT::encode($data, 'secretKey', 'HS256');
$this->tokenHS256 = JWT::encode($data, 'secretKey0123456789secretKey0123456789', 'HS256');

$privKey1 = file_get_contents(__DIR__ . '/../../data/rsa1-private.pem');
$this->tokenRS256 = JWT::encode($data, $privKey1, 'RS256', 'jwk1');
Expand All @@ -100,7 +100,7 @@ public function testAuthenticateViaHeaderToken()
$this->request = $this->request->withAddedHeader('Authorization', 'Bearer ' . $this->tokenHS256);

$authenticator = new JwtAuthenticator($this->identifier, [
'secretKey' => 'secretKey',
'secretKey' => 'secretKey0123456789secretKey0123456789',
'subjectKey' => 'subjectId',
]);

Expand All @@ -123,7 +123,7 @@ public function testAuthenticateViaQueryParamToken()
);

$authenticator = new JwtAuthenticator($this->identifier, [
'secretKey' => 'secretKey',
'secretKey' => 'secretKey0123456789secretKey0123456789',
'subjectKey' => 'subjectId',
]);

Expand Down Expand Up @@ -159,7 +159,7 @@ public function testAuthenticationViaIdentifierAndSubject()
]));

$authenticator = new JwtAuthenticator($this->identifier, [
'secretKey' => 'secretKey',
'secretKey' => 'secretKey0123456789secretKey0123456789',
'returnPayload' => false,
'subjectKey' => 'subjectId',
]);
Expand Down Expand Up @@ -242,7 +242,7 @@ public function testInvalidToken()
);

$authenticator = new JwtAuthenticator($this->identifier, [
'secretKey' => 'secretKey',
'secretKey' => 'secretKey0123456789secretKey0123456789',
]);

$result = $authenticator->authenticate($this->request);
Expand All @@ -268,7 +268,7 @@ public function testGetPayloadHS256()
);

$authenticator = new JwtAuthenticator($this->identifier, [
'secretKey' => 'secretKey',
'secretKey' => 'secretKey0123456789secretKey0123456789',
]);

$result = $authenticator->getPayload();
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Middleware/AuthenticationMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -576,13 +576,13 @@ public function testJwtTokenAuthorizationThroughTheMiddlewareStack()
'firstname' => 'larry',
];

$token = JWT::encode($data, 'secretKey', 'HS256');
$token = JWT::encode($data, 'secretKey0123456789secretKey0123456789', 'HS256');

$this->service = new AuthenticationService([
'authenticators' => [
'Authentication.Form' => ['identifier' => 'Authentication.Password'],
'Authentication.Jwt' => [
'secretKey' => 'secretKey',
'secretKey' => 'secretKey0123456789secretKey0123456789',
'identifier' => 'Authentication.JwtSubject',
],
],
Expand Down
Loading