Update code to work with stricter JWT library checks
This commit is contained in:
parent
6e6b853112
commit
903ebf56eb
2 changed files with 6 additions and 3 deletions
|
@ -85,7 +85,7 @@ class AppServiceProvider extends ServiceProvider
|
||||||
|
|
||||||
// Configure JWT builder
|
// Configure JWT builder
|
||||||
$this->app->bind('Lcobucci\JWT\Configuration', function () {
|
$this->app->bind('Lcobucci\JWT\Configuration', function () {
|
||||||
$key = InMemory::plainText('testing');
|
$key = InMemory::plainText(config('app.key'));
|
||||||
|
|
||||||
$config = Configuration::forSymmetricSigner(new Sha256(), $key);
|
$config = Configuration::forSymmetricSigner(new Sha256(), $key);
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,10 @@ class TokenServiceTest extends TestCase
|
||||||
$this->assertSame($data, $validData);
|
$this->assertSame($data, $validData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @test */
|
/**
|
||||||
|
* @test
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
public function tokensWithDifferentSigningKeyThrowsException(): void
|
public function tokensWithDifferentSigningKeyThrowsException(): void
|
||||||
{
|
{
|
||||||
$this->expectException(RequiredConstraintsViolated::class);
|
$this->expectException(RequiredConstraintsViolated::class);
|
||||||
|
@ -56,7 +59,7 @@ class TokenServiceTest extends TestCase
|
||||||
->withClaim('me', $data['me'])
|
->withClaim('me', $data['me'])
|
||||||
->withClaim('scope', $data['scope'])
|
->withClaim('scope', $data['scope'])
|
||||||
->withClaim('nonce', bin2hex(random_bytes(8)))
|
->withClaim('nonce', bin2hex(random_bytes(8)))
|
||||||
->getToken($config->signer(), InMemory::plainText('r4andomk3y'))
|
->getToken($config->signer(), InMemory::plainText(random_bytes(32)))
|
||||||
->toString();
|
->toString();
|
||||||
|
|
||||||
$service = new TokenService();
|
$service = new TokenService();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue