我想在Symfony \ Component \ Security \ Core \ Authentication \ AuthenticationProviderManager的函數authenticate()中添加一些代碼。symfony2覆蓋服務security.authentication.manager
我試着創建一個安全包的子包。 而我重新定義了security.authentication.manager服務,該軟件包像
<!-- Authentication related services -->
<service id="security.authentication.manager" class="%security.authentication.manager.class%" public="false">
<argument type="collection" />
</service>
但是,當我relad頁面,框架拋出一個異常:InvalidArgumentException:您必須至少添加一個身份驗證提供者。
我想這是因爲依賴是在父包配置中創建的。
如果不重新定義整個安全捆綁包,我必須做些什麼才能使它工作? 謝謝。
其實我需要做一些驗證。我需要調用外部API和測試證書登錄用戶之前,那麼如果用戶帳戶存在(外部API和本地數據庫)給我的授權訪問用戶。 – Rmannn
如果您從本地數據庫加載用戶,您是否可以在['EntityRepository']中執行此項工作(http://symfony.com/doc/current/cookbook/security/entity_provider.html#authenticating-someone-with-a-custom -entity提供商)? – jkucharovic
這是問題所在,實際上我想用登錄表單首先在api上搜索以查找用戶(不在db中),並且如果外部登錄返回用戶,它們將與數據庫同步。 因爲這個原因,我想能夠在驗證方法()中添加一些自定義測試,但我真的不知道如何正確覆蓋SecurityBundle – Rmannn