我有肥皂来验证用户身份没有数据库(SOAP)PHP Symfony2的自定义验证
<?php
$client = new SoapClient('http://mysite/code/soap.wsdl');
$user = $client->login('username','password');
if(isset($user['IdAccount']) && ($user['IdAccount'] > 0))
echo 'Logon OK';
else
echo 'Logon Fail!';
我想在Symfony2中使用无需数据库,只在内存...
我试图执行一个Custom UserProvider,但我没有使它工作所需的所有数据...
class WebserviceUserProvider implements UserProviderInterface
{
public function loadUserByUsername($username)
{
$client = new SoapClient('http://mysite/code/soap.wsdl');
$user = $client->login($username, PASSWORD????);
if (isset($user['IdAccount']) && ($user['IdAccount'] > 0))
return new WebserviceUser($username, PASSWORD????, SALT???, ROLES????);
throw new UsernameNotFoundException(sprintf('Username "%s" does not exist.', $username)
);
}
我不能改变肥皂
抱歉我的英文不好! :(
要做到这一点正确的方式,你需要你自己的自定义身份验证提供程序。http://symfony.com/doc/currentbook/security/custom_authentication_provider.html。不容易的事情来实现。教程后退效果最好。但我强烈建议寻找一个SOAP认证包。我确定有一些好的。 – Cerad 2014-09-06 20:15:36