Skip to content

[Bug]: API basic auth not working if LDAP is enabled #799

@SirGrady

Description

@SirGrady

Describe the problem

Hiya,

padmin API works with API key but not with basic auth (UN/PW) when LDAP is enabled.
Tested with both, an LDAP user and a none LDAP user. Same results.
LDAP login to web gui is confirmed to work,

Steps to reproduce

  1. enable API
 'api' => [
        'enabled'               => true,
        'basic_auth_enabled'    => true,
        'basic_auth_realm'      => 'DNS Management API',
        'log_requests'          => true,
        'docs_enabled'          => true,
    ],
  1. enable and configure LDAP
'ldap' => [
        'enabled'           => true,
        'debug'             => false,
        'uri'               => 'ldaps://dc01.xxxxxx.xxx',
        'base_dn'           => 'dc=xxxxxx,dc=xxx',
        'bind_dn'           => 'cn=Poweradmin binduser,ou=Services,ou=CN,dc=xxxxxx,dc=xxx',
        'bind_password'     => '*g3xxxxxxxxxx7',
        'user_attribute'    => 'sAMAccountName',
        'protocol_version'  => 3,
        'search_filter'     => '',
    ]

  1. curl -u username:password \ -H "Content-Type: application/json"
    https://dmgmt-test.example.de/api/v1/zones

    -> no response but apache error Logs:

[Mon Oct 06 10:43:02.635325 2025] [php:error] [pid 183907:tid 183907] [client 10.245.16.41:43278] PHP Fatal error:  Uncaught TypeError:
Poweradmin\\Application\\Service\\LdapAuthenticator::__construct(): Argument #4 ($authService) must be of type Poweradmin\\Domain\\Service\\AuthenticationService,
Poweradmin\\Application\\Service\\UserAuthenticationService given, called in /var/www/dmgmt-test.example.de/docs/lib/Infrastructure/Service/BasicAuthenticationMiddleware.php on line 102 and defined in /var/www/dmgmt-test.example.de/docs/lib/Application/Service/LdapAuthenticator.php:48\nStack trace:\n#0
/var/www/dmgmt-test.example.de/docs/lib/Infrastructure/Service/BasicAuthenticationMiddleware.php(102): Poweradmin\\Application\\Service\\LdapAuthenticator->__construct()\n#1
/var/www/dmgmt-test.example.de/docs/lib/Application/Controller/Api/PublicApiController.php(99): Poweradmin\\Infrastructure\\Service\\BasicAuthenticationMiddleware->__construct()\n#2
/var/www/dmgmt-test.example.de/docs/lib/Application/Controller/Api/PublicApiController.php(64): Poweradmin\\Application\\Controller\\Api\\PublicApiController->authenticateApiRequest()\n#3
/var/www/dmgmt-test.example.de/docs/lib/Application/Controller/Api/V1/ZonesController.php(56): Poweradmin\\Application\\Controller\\Api\\PublicApiController->__construct()\n#4
/var/www/dmgmt-test.example.de/docs/lib/Application/Routing/BasicRouter.php(181): Poweradmin\\Application\\Controller\\Api\\V1\\ZonesController->__construct()\n#5
/var/www/dmgmt-test.example.de/docs/index.php(68): Poweradmin\\Application\\Routing\\BasicRouter->process()\n#6 {main}\n  thrown in
/var/www/dmgmt-test.example.de/docs/lib/Application/Service/LdapAuthenticator.php on line 48

Poweradmin version

4.0.2

Database

MySQL

Additional information (optional)

No response

Metadata

Metadata

Assignees

Labels

apiAPI-related features, improvements, and integrations

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions