Closed acrozes closed 7 years ago
I would like to point you to this article, it answers the question better than I could :) https://ocramius.github.io/blog/when-to-declare-classes-final/
You can always create your own handler by composition:
<?php
namespace My\App;
use Firebase\Auth\Token\Domain\Generator;
use Firebase\Auth\Token\Domain\Verifier;
use Firebase\Auth\Token\Handler;
use Lcobucci\JWT\Token;
class CustomHandler implements Generator, Verifier
{
/**
* @var Handler
*/
private $base;
public function __construct(Handler $baseHandler)
{
$this->base = $baseHandler;
}
public function createCustomToken($uid, array $claims = []): Token
{
return $this->base->createCustomToken($uid, $claims);
}
public function verifyIdToken($token): Token
{
$token = $this->base->verifyIdToken($token);
// Additional checks
return $token;
}
}
Hello,
Why
final class Handler implements Domain\Generator, Domain\Verifier
class is final ?I'd like to extend it to add a method to only verify if the token is expired ...
Thank you