在 Symfony 4 中,该AuthenticatorInterface::supports()
方法有以下注释:
interface AuthenticatorInterface extends AuthenticationEntryPointInterface
{
/**
* Does the authenticator support the given Request?
*
* If this returns false, the authenticator will be skipped.
*
* @param Request $request
*
* @return bool
*/
public function supports(Request $request);
我觉得措辞令人困惑。当我尝试实现这一点时,我的第一直觉是如果请求包含一个username
和password
字段,则返回 true,但后来我记得我收到的所有请求都经过身份验证,即使我没有使用登录表单。
该supports()
方法是一种覆盖security.firewalls.myFirewall.pattern
参数的方法吗?它是处理多个身份验证器之间的流程的东西吗?
我应该如何使用这个界面?