public function BasicAuth::challengeException in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php \Drupal\basic_auth\Authentication\Provider\BasicAuth::challengeException()
Constructs an exception which is used to generate the challenge.
The request. @var \Exception $exception 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 133 - Contains \Drupal\basic_auth\Authentication\Provider\BasicAuth.
Class
- BasicAuth
- HTTP Basic authentication provider.
Namespace
Drupal\basic_auth\Authentication\ProviderCode
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);
}