silexドキュメント-を使用してLDAP認証用のカスタム認証プロバイダを作成しようとしています。silexアプリケーションのカスタム認証プロバイダ
しかし、$app['security.authentication_providers']
には2つのプロバイダがあります。一つ私がApp\LdapAuthenticationProvider
と1 Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider
を定義し、私は、ユーザーを承認しようとすると、クラスDaoAuthenticationProviderからApp\LdapUserProvider::loadUserByUsername()
の呼び出しがありますので、私はエラーを取得します。
$app['security.authentication_providers']
にプロバイダが1つしかない場合は、LDAPプロバイダがloadUserByUsernameを呼び出さないため、エラーが発生しないはずです。余分なプロバイダとどのように私はそれを取り除くことができますがある理由はここに
が$app['security.authentication_providers']
array (size=2)
0 => object(App\LdapAuthenticationProvider)[194]
private 'userProvider' =>
object(App\LdapUserProvider)[176]
private 'ldap' => resource(57, ldap link)
private 'defaultRoles' =>
array (size=1)
...
private 'providerKey' => string 'default' (length=7)
1 => object(Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider)[195]
private 'encoderFactory' =>
object(Symfony\Component\Security\Core\Encoder\EncoderFactory)[197]
private 'encoders' =>
array (size=1)
...
private 'userProvider' =>
object(App\LdapUserProvider)[176]
private 'ldap' => resource(57, ldap link)
private 'defaultRoles' =>
array (size=1)
...
private 'hideUserNotFoundExceptions' (Symfony\Component\Security\Core\Authentication\Provider\UserAuthenticationProvider) => boolean true
private 'userChecker' (Symfony\Component\Security\Core\Authentication\Provider\UserAuthenticationProvider) => object(Symfony\Component\Security\Core\User\UserChecker)[196]
private 'providerKey' (Symfony\Component\Security\Core\Authentication\Provider\UserAuthenticationProvider) => string 'default' (length=7)
のダンプであるので、誰もが知っているのですか?
bootstraping application、LdapAuthenticationListenerおよびLdapAuthenticationProviderのコードがあります。
しかし、まだ '' $ app ['security.authentication_providers'] ''には2つのプロバイダがあります。 – vansanblch
最終的なコードを投稿することはできますか? – heapOverflow
残念ながら私はできません。このプロジェクトは現在中止されており、私はそのプロジェクトにアクセスしていません。 しかし、主な考え方は、私がUsernamePasswordFormAuthenticationListenerから継承してアーカイブした正しいLdapAuthenticationListenerを書くことでした。そして、ブートストラップにldap認証を扱うための新しいファクトリを登録するコードがあります。また、pastebinのコードを見てみると、最初のコメントでlinkuが見つかりました。私はこれらのクラスのコードをあまり変更しなかったと思います。 – vansanblch