This method create a new key and add it to the key set
The oldest key is removed.
public rotate ( ) |
/** * {@inheritdoc} */ protected function executeCommand(InputInterface $input, OutputInterface $output, RotatableInterface $jwkset) { $ttl = $input->getArgument('ttl'); $date = new \DateTime(); $interval = \DateInterval::createFromDateString($ttl); $date = $date->sub($interval); $mtime = $jwkset->getLastModificationTime(); if (null === $mtime) { $jwkset->regen(); } elseif ($mtime <= $date->getTimestamp()) { $jwkset->rotate(); } return 0; }