[英]Symfony logout. Change target path protocol from HTTP to HTTPS
There are two ways of doing this with Symfony 4. Symfony 4 有两种方法可以做到这一点。
# config/packages/security.yaml
security:
# ...
access_control:
# ...
# catch all URLs starting with /api/user
- { path: '^/api/user', roles: ROLE_USER, requires_channel: https }
// src/Controller/SecurityController.php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
class SecurityController extends AbstractController
{
/**
* @Route("/api/user/logout-end", name="api-user-logoutEnd", schemes={"https"})
*/
public function apiUserLogoutEnd()
{
// ...
}
}
It could be that "Logout" is https, but the following site is not. “注销”可能是 https,但以下站点不是。 Then you can apply the methods on that route, too.
然后,您也可以在该路线上应用这些方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.