public BasicAuth::challengeException(Request $request, \Exception $previous)
Constructs an exception which is used to generate the challenge.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The request.
\Exception $previous: The previous exception.
Return value
\Symfony\Component\HttpKernel\Exception\HttpExceptionInterface|null An exception to be used in order to generate an authentication challenge.
Overrides AuthenticationProviderChallengeInterface::challengeException
File
- core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php, line 128
Class
- BasicAuth
- HTTP Basic authentication provider.
Namespace
Drupal\basic_auth\Authentication\Provider
Code
1 2 3 4 5 6 7 | public function challengeException(Request $request , \Exception $previous ) { $site_name = $this ->configFactory->get( 'system.site' )->get( 'name' ); $challenge = SafeMarkup::format( 'Basic realm="@realm"' , array ( '@realm' => ! empty ( $site_name ) ? $site_name : 'Access restricted' , )); return new UnauthorizedHttpException((string) $challenge , 'No authentication credentials provided.' , $previous ); } |
Please login to continue.