doctrine / DoctrineModule

Doctrine Module for Laminas
http://www.doctrine-project.org/projects/doctrine-module.html
MIT License
398 stars 270 forks source link

Authentication Error when no credentialCallable is given. #816

Closed Kerion closed 10 months ago

Kerion commented 1 year ago

An credentialCallable is optional in the Authentication-Options

Trying to Auth without credentialCallable results in the following Error (php8.2)

Error: Typed property DoctrineModule\Options\Authentication::$credentialCallable must not be accessed before initialization

Please Change Line 83 in Class DoctrineModule\Options\Authentication

From

protected mixed $credentialCallable = null;

To

protected mixed $credentialCallable = null;

curzio-della-santa commented 11 months ago

Same error here

Please do the suggested change in Class DoctrineModule\Options\Authentication on line 83

from

protected mixed $credentialCallable;

to:

protected mixed $credentialCallable = null;

as temporary bypass I'll set a wrapper function in my configuration

    // Until doctrine/DoctrineModule gets fixed, a wrapper function is needed
    // ref: https://github.com/doctrine/DoctrineModule/issues/816
    'credentialCallable' => static fn(mixed $identity, mixed $credentialValue): mixed => $credentialValue,
TomHAnderson commented 11 months ago

I looked at this with one of the more recent releases and I did not find a use case where $credentialCallable would not be set. Setting this value is good security. Can you please expound on your reasons for not setting it?

curzio-della-santa commented 10 months ago

@TomHAnderson My application integrates Doctrine in Laminas, and in this case is not set.

It is a simple update that:

driehle commented 10 months ago

@curzio-della-santa Please provide a PR with the suggested change and I'll happily review and merge it.

curzio-della-santa commented 10 months ago

@driehle PR is ready, thanks for your attention.