SocalNick / ScnSocialAuth

Uses the HybridAuth PHP library to Enable authentication via Google, Facebook, Twitter, Yahoo!, etc for the ZfcUser ZF2 module.
BSD 3-Clause "New" or "Revised" License
216 stars 110 forks source link

Add authenticate success event to adapter. #219

Closed mrVrAlex closed 9 years ago

mrVrAlex commented 9 years ago

Hello, I'm use ZfcUser and your module for social login and I have a some task: saving last success logIn. So for it I just use "authenticate.success" event from "ZfcUser\Authentication\Adapter\AdapterChain" and it work for local users. You module don't use ZfcUser AdapterChain (why?) and use ScnSocialAuth\Authentication\Adapter\HybridAuth For catching "auth" event I can listen "register.post" for new users and "scnUpdateUser.post" for exists user amd it will also works, BUT after trigger these events you have checking user state (HybridAuth:152) therefore two event above not guarant succeed authenticate.

I suggest add trigger "authenticate.success" event to the end authenticate method in HybridAuth. I can send pull request for it.

SocalNick commented 9 years ago

ScnSocialAuth does use the "ZfcUser\Authentication\Adapter\AdapterChain". The AuthenticationAdapterChainFactory substitutes the auth adapters in the chain to use HybridAuth Just-in-Time.

https://github.com/SocalNick/ScnSocialAuth/blob/master/src/ScnSocialAuth/Service/AuthenticationAdapterChainFactory.php#L26-L30