denyUnlessFeatureIsActive(); $provider = $this->client->getProvider(); $url = $provider->getAuthorizationUrl(); $state = $provider->getState(); $request->getSession()->set('oauth2state', $state); return $this->redirect($url); } #[Route('/myep-auth/check', name: 'app_myep_auth_check')] public function check(): void { // only reached when the authenticator did not handle the request, which with the // feature switched off it never does $this->denyUnlessFeatureIsActive(); } /** * The login is not merely hidden while the feature is off: the callback creates and * updates local accounts, so the routes must not be reachable by direct URL either. */ private function denyUnlessFeatureIsActive(): void { if (false === $this->featureManager->isActive('myep_login')) { throw $this->createNotFoundException(); } } }