An article on zf-mvc-auth

I think whomever wrote the README for zf-mvc-auth was in code burn out mode. By the end of the article we’re getting a lesson on how delegator factories work but what zf-mvc-auth implements is fantastic! Read on for my custom adapter article:

This is not a useful assertion to make, and denigrates the work done by contributors. More useful would be a pull request with documentation updates, filling in the details you feel are missing.

Considering that most folks will go to the documentation, would you consider re-purposing your article for the documentation?

I do like to keep some light-heartedness in my writings. Sure this is all technically technical writing but I don’t drop a stitch unintentionally.

I think the work of this article would go very well in a larger documentation work for zf-mvc-auth but I feel limited by the single which is already straining my back buffer. I’d like to rewrite this to a series of docs. This approach has been working well for me recently such as but I expect the docs to end up at so I don’t know where new documentation will be best applied. In my recent work I reference my readthedocs documentation directly from the space and dispose of the file contents.

Are you suggesting a editing or can we restructure the docs for this repo?

Ideally, we’ll restructure the docs for the zfcampus repos to work in a similar fashion to what we do for This is a longer term goal, however.

In the short-term, I’d recommend adding them to — this repository contains docs including tutorials, cookbook entries, and any cross-cutting concerns.


Here’s the first pass at the doc most related to the blog I created (new file)

I don’t know how to finish the file because I don’t know PDO. Help is appreciated.

I’m going to move this conversation to the PR.

Hi Tom.

I’m trying to follow this article you made, but I am new on Zend and on Apigility. So I’m struggle to know where I should put this code.

Using PHPStorm I created the SessionAdapter.php and put on vendor/zfcampus/zf-mvc-auth/src/Authentication/ path

This where the location where the use statements are recognize.

But the next code, the Module, I can’t figure out where I should put this code.

Could list to me where to put each file to work?

Thanks in advance


I can not get success following this article. Is this actual documentation?

Accordingly to that docs we should have such config:

'zf-mvc-auth' => [
    'authentication' => [
        'map' => [
            'ZF\\OAuth2' => 'session',

Can somebody tell me when exactly ‘ZF\OAuth2’ is calling when I call apigility rest collection or entity? It seems, it doesn’t call ever.

Yes. I’m following this link:

You shouldn’t put anything inside vendor directory. The content of that directory can be created only by composer commands.

ok. I will not forget that :+1:

But where I change or create this files as instruct on link?

Thanks for help

You should take attention at namespaces of the files. For example:

namespace Application\Identity;
final class UserIdentity extends AbstractRbacRole implements IdentityInterface

will be located at your_project_dir/module/Application/src/Identity/UserIdentity.php . At least, I thought in this way.

Besides, connection between namespaces and files directories is describe with psr-4 within composer.json.

Matthew, I know that I’m annoying and you have a lot of work with laminas, but can somebody responsible check if that article is up to date with current versions of apigility, zf-oauth2, zf-mvc-auth? I have spent more than one week to trying figured out why I have 403 on rest api (apigility) collection and entities protected by oauth2 and using SessionAdapter as was noticed at that article.