Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with Zend\Json\Server #662

Open
citrususer4 opened this issue Jan 25, 2017 · 1 comment
Open

Integration with Zend\Json\Server #662

citrususer4 opened this issue Jan 25, 2017 · 1 comment

Comments

@citrususer4
Copy link

citrususer4 commented Jan 25, 2017

$app = Application::init(require 'config/application.config.php');
$service = $app->bootstrap()->getServiceManager();
$auth = $service->get('zfcuser_auth_service');
$auth->hasIdentity();

This work good.
But how to get adapter
$adapter = $auth->getAuthAdapter();
Call to undefined method Zend\Authentication\AuthenticationService::getAuthAdapter():

@citrususer4
Copy link
Author

After many experiments, something happened.
I do not know how much the right decision but it works

$adapter = $service->get('ZfcUser\Authentication\Adapter\AdapterChain');
$request = new \Zend\Http\Request();
$request->setMethod('POST');
$request->getPost()->set('identity', $identity)->set('credential', $credential);
$result = $adapter->prepareForAuthentication($request);
session_id($_SERVER['HTTP_PHPSESSID']);
$result = $auth->authenticate($adapter);
return $result->isValid();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant