Saeven / zf3-circlical-user

Turnkey Authentication, Identity, and RBAC for Laminas and Zend Framework 3. Supports Doctrine and Middleware.
Mozilla Public License 2.0
36 stars 15 forks source link

Disable for module #25

Closed drchav closed 7 years ago

drchav commented 7 years ago

There is anyway that I can Disable the guard for a entire module?

Saeven commented 7 years ago

Hi! Because it's so quick to configure, and so important to configure just the same - I recommend via implementation, foregoing any special exception mechanisms that could lead to trouble down the road. This is the stuff of breaches, in my opinion, but I am a paranoid fellow! :)

It also ensures a single way of doing things - which is important.

In this module, the full controller name is truly the key that controls guards.

drchav commented 7 years ago

The problem is as I'm using some apigility things in this project, I only need the APIs to be totally exposed and I'm having some difficulties to implement the guards with apigility routes.

Saeven commented 7 years ago

I've admittedly never tried using them in concert. Defining the rules for the Apigility controller that handles the request, doesn't work?

drchav commented 7 years ago

No I got always the same error: Fatal error: Uncaught TypeError: Argument 2 passed to CirclicalUser\Service\AccessService::requiresAuthentication() must be of the type string, null given, called in /Users/danielchaves/Rocket/TagRocket/System/vendor/saeven/zf3-circlical-user/src/CirclicalUser/Listener/AccessListener.php on line 52 and defined in /Users/danielchaves/Rocket/TagRocket/System/vendor/saeven/zf3-circlical-user/src/CirclicalUser/Service/AccessService.php on line

and I have this on the module config:

'circlical' => [ 'user' => [ 'guards' => [ 'ModuleName' => [ "controllers" => [ \TagRocketAPI\V1\Rest\Beacons\BeaconsResource::class => [ 'default' => [''], ], ],

            ],
        ],
    ],
Saeven commented 7 years ago

Those are drawn from the route's controller and action names.

https://github.com/Saeven/zf3-circlical-user/blob/master/src/CirclicalUser/Listener/AccessListener.php#L52

Possible that Apigility does not pass these? I understood they were required for dispatch.

drchav commented 7 years ago

Apigility do not pass a action just the controller, I will adapt this module to my needs thanks for your help.

Saeven commented 7 years ago

I could easily rig something that relies on a "Controller" default rather than Module default.

Saeven commented 7 years ago

@drchav with zend-mvc's recent support for middleware definitions, I'd like to add this in. Were you using this with Expressive?