我有一个将被用来作为一个REST API一个symfony的2.8应用后端如何在symfony 2.8中对同一模式使用多个防火墙?
我想补充的安全性,所有终点匹配^/API 我想能够使用3种不同的认证方法^/api
我使用的是uma/psr7-hmac-bundle,friendsofsymfony/oauth-server-bundle,APIKey认证。
我定义了3个不同的防火墙,如果我删除了其他两个防火墙,一切都适用于每个防火墙。
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
oauth_token:
pattern: ^/oauth/v2/token
security: false
oauth_authorize:
pattern: ^/oauth/v2/auth
security: false
api_key:
pattern: ^/api
stateless: true
simple_preauth:
authenticator: api_key_authenticator
provider: api_key_user_provider
oauth_api:
pattern: ^/api
stateless: true
fos_oauth: true
provider: oauth_user
hmac_api:
pattern: ^/api
stateless: true
hmac:
apikey_header: 'X-Custom-Header-Key'
provider: hmac_user
如何将所有3个防火墙一起使用(链接它们)? (hmac_api,oauth_api,api_key)
我看着卫兵,但我不知道如何定义/实现HMAC和oAuth的Authenticators。
我查看了防火墙上下文,但因为它是无状态的,所以无法工作。
基本上我怎样才能链接多个防火墙相同的模式?或者我怎么能定义一个防火墙与3个不同的验证器,考虑到我正在使用第三部分包如friendsofsymfony/oauth-server-bundle,uma/psr7-hmac-bundle?
你如何定义的UMA/PSR7-HMAC认证程序-bundle,friendsofsymfony/oauth-server-bundle? – PMoubed
https://symfony.com/doc/current/security/guard_authentication.html –