diff --git a/service-api/app/src/App/src/Service/Authentication/AuthenticationService.php b/service-api/app/src/App/src/Service/Authentication/AuthenticationService.php index d6e39d9ead..4e996ff597 100644 --- a/service-api/app/src/App/src/Service/Authentication/AuthenticationService.php +++ b/service-api/app/src/App/src/Service/Authentication/AuthenticationService.php @@ -4,14 +4,15 @@ namespace App\Service\Authentication; +use Exception; use Facile\OpenIDClient\Client\ClientBuilder; use Facile\OpenIDClient\Client\Metadata\ClientMetadata; -use Facile\OpenIDClient\Issuer\IssuerBuilder; use Facile\OpenIDClient\Issuer\IssuerBuilderInterface; use Facile\OpenIDClient\Service\Builder\AuthorizationServiceBuilder; -use Psr\Log\InvalidArgumentException; use Psr\Log\LoggerInterface; +use RuntimeException; + use function Facile\OpenIDClient\base64url_encode; class AuthenticationService @@ -63,9 +64,9 @@ public function redirect(string $uiLocale): string 'claims' => '{"userinfo":{"https://vocab.account.gov.uk/v1/coreIdentityJWT": null}}', ] ); - } catch (InvalidArgumentException $e) { + } catch (Exception $e) { $this->logger->error('Unable to get authorisation uri: ' . $e->getMessage()); - throw $e; + throw new RuntimeException('Could not create authorisation uri'); } return $redirectAuthorisationUri;