は、私はすべてのエンドポイントにセキュリティを追加したいバック同じパターンでsymfony 2.8で複数のファイアウォールを使用するには?
を終了RESTのAPIとして使用されるのsymfony 2.8のアプリケーションを持っているマッチング^/API私は3種類の認証方法を使用できるようにしたいと思い ^/api
uma/psr7-hmac-bundle、friendsofsymfony/oauth-server-bundle、APIKey認証を使用しています。
私は3つの異なるファイアウォールを定義しました。他の2つを削除すると、ファイアウォールごとにすべてが機能します。
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の認証者を定義/実装する方法がわかりません。
私はファイアウォールのコンテキストを調べましたが、ステートレスなので機能しません。
基本的に同じパターンで複数のファイアウォールをチェーンすることはできますか?または私がfriendsofsymfony/oauth-server-bundle、uma/psr7-hmac-bundleのような3番目のバンドルを使用していることを考慮して、3つの異なるオーセンティケータで1つのファイアウォールを定義する方法はありますか?
-bundle、friendsofsymfony/oauth-server-bundle? – PMoubed
https://symfony.com/doc/current/security/guard_authentication.html –