mhubig / docker-partkeepr

mhubig/partkeepr docker image repository
63 stars 64 forks source link

LDAP support #12

Closed dbiner closed 4 years ago

dbiner commented 6 years ago

Hi, is it planned to add support for LDAP authentication (using HTTP Basic)?

mhubig commented 6 years ago

Using LDAP authentication (using HTTP Basic) seems to be just a matter of setting the right parameters within app/config/parameters.php:

$container->setParameter('authentication_provider', 'PartKeepr.Auth.HTTPBasicAuthenticationProvider');
...
$container->setParameter('fr3d_ldap.driver.accountCanonicalForm', NULL);
$container->setParameter('fr3d_ldap.driver.accountDomainName', NULL);
$container->setParameter('fr3d_ldap.driver.accountDomainNameShort', NULL);
$container->setParameter('fr3d_ldap.driver.accountFilterFormat', NULL);
$container->setParameter('fr3d_ldap.driver.baseDn', '');
$container->setParameter('fr3d_ldap.driver.bindRequiresDn', false);
$container->setParameter('fr3d_ldap.driver.host', '127.0.0.1');
$container->setParameter('fr3d_ldap.driver.optReferrals', NULL);
$container->setParameter('fr3d_ldap.driver.password', NULL);
$container->setParameter('fr3d_ldap.driver.port', 389);
$container->setParameter('fr3d_ldap.driver.useSsl', NULL);
$container->setParameter('fr3d_ldap.driver.useStartTls', NULL);
$container->setParameter('fr3d_ldap.driver.username', NULL);
$container->setParameter('fr3d_ldap.user.attribute.email', 'email');
$container->setParameter('fr3d_ldap.user.attribute.username', 'samaccountname');
$container->setParameter('fr3d_ldap.user.baseDn', 'dc=example,dc=com');
$container->setParameter('fr3d_ldap.user.enabled', false);
$container->setParameter('fr3d_ldap.user.filter', NULL);

Du you have a working setup which you can share as an example? It seems I could just extend the same method I use to set the octopart apikey:

$container->setParameter('partkeepr.octopart.apikey', '{{ PARTKEEPR_OKTOPART_APIKEY }}');
cagdasbas commented 5 years ago

Hi. I'm having with a problem with the same issue. The thing is, your mkparameter script overwrites this config file and mkparameters doesn't read these values from env and parameters.template doesn't contain these attributes. I copied docker-php-entrypoint script on the docker-compose folder, commented out mkparameter and chmod lines and mounted a readonly parameters.php just in case and issue is solved.