/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakedc/auth/src/Middleware
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/cakedc/auth/src/Middleware/SocialAuthMiddleware.php (2332B)
false,
'urlChecker' => 'Authentication.Default',
];
/**
* SocialAuthMiddleware constructor.
*
* @param array $config optional configuration
*/
public function __construct(array $config = [])
{
$this->setConfig($config);
}
/**
* @inheritDoc
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
if (!$this->checkUrl($request)) {
return $handler->handle($request);
}
$service = (new ServiceFactory())->createFromRequest($request);
if (!$service->isGetUserStep($request)) {
return (new Response())
->withLocation($service->getAuthorizationUrl($request));
}
$request = $request->withAttribute(SocialAuthenticator::SOCIAL_SERVICE_ATTRIBUTE, $service);
return $handler->handle($request);
}
/**
* Check if is target url
*
* @param \Psr\Http\Message\ServerRequestInterface $request The request.
* @return bool
*/
protected function checkUrl(ServerRequestInterface $request)
{
return $this->_getUrlChecker()->check($request, $this->getConfig('loginUrl'));
}
}