phpro/zf-mvc-auth-token

Require clarification

bladeofsteel opened this issue · 2 comments

Could you explain some of the places in the README?

  • How to implement YourModule\Authentication\Listener\TokenListener and why is it needed? It should extends MvcAuthToken\Listener\AuthenticationListener?
  • What kind of "Token Adapter logica" must implement YourModule\Authentication\Adapter\TokenAdapter? This is a place for interaction with the database?

Currently the documentation is not complete yet. I am working on this.

  • The TokenListener is not a custom class. It will be created by the AbstractAuthenticationListener in the ServiceManager. This will result in a new AuthenticationListener which will have access to your custom Adapter.
    So in short: the ServiceManager will generate a listener for you. There is no need for an extra class. This is configuration only. You could also use a custom string like "projectX.token.listener" as the serviceManager key, if this seems more clear to you.
  • The TokenAdapter should implement The Adapter/AdapterInterface. It is used by the TokenServer to validate your token. This is the place where you interact with the database to check user credentials and validate the nounce + timestamp. So basically this module works as an abstraction layer: the validation of the token will happen in your custom class. This way, the module is reusable in multiple projects.

Note: The namespace of the module has changed to Phpro\MvcAuthToken. Make sure the right files are adjusted.

Thanks for clarification.
I implement TokenAdapter and do steps from README - and got as a result worked authentication. Tnx!