$app['security.authentication_manager']
からデフォルトの認証プロバイダUserAuthenticationProvider
を削除する方法はありますか?Silex 2:デフォルト認証プロバイダを削除するUserAuthenticationProvider
独自の認証プロバイダを作成しましたが、認証プロセスがそのように機能しないため、DaoAuthenticationProvider
を呼び出す既定のものを使用してユーザーパスワードを確認する必要はありません。
この時点で、認証マネージャは2つの認証プロバイダを呼び出します。私のカスタムとデフォルトの認証プロバイダです。成功した認証を許可するために、私はテストをスキップするためにDAOを上書きしますが、それはきれいではありません。
カスタム認証プロバイダ
$app['security.authentication_listener.factory.sds'] = $app->protect(function ($name, $options) use ($app) {
// define the authentication provider object
$app['security.authentication_provider.'.$name.'.sds'] = function() use ($app) {
return new CustomAuthenticationProvider($app['user.provider'], $app['security.encoder_factory']);
};
// define the authentication listener object
$app['security.authentication_listener.'.$name.'.sds'] = function() use ($app) {
return new CustomAuthenticationListener($app['security.token_storage'], $app['security.authentication_manager']);
};
return array(
// the authentication provider id
'security.authentication_provider.'.$name.'.sds',
// the authentication listener id
'security.authentication_listener.'.$name.'.sds',
// the entry point id
null,
// the position of the listener in the stack
'pre_auth'
);
});
は、カスタムcalssを使用してテストをスキップするDAOを上書きします。私はその点を避けるために、認証マネージャーからDAO呼び出しを取り除いています。
$app['security.authentication_provider.dao._proto'] = $app->protect(function ($name) use($app) {
return new \Trilogis\Classes\CustomUserAuthenticationProvider(
$app['security.user_provider.' . $name],
$app['security.user_checker'],
$name,
$app['security.encoder_factory']
);
});
'sds'ファイアウォールのセキュリティ設定を追加してください –