Hello,

I am trying to sync users from windows server 2012 LDS with Drupal 8 site.

I have followed the following steps to setup the LDAP module in Drupal8.
https://www.drupal.org/node/1023900
https://www.drupal.org/node/1302032
https://www.drupal.org/node/1053748

I have also added the following changes:
Added function getUserDataFromServerByAccounterDataFromServerByAccount($drupal_user, $sid = NULL, $ldap_context = NULL) {}
in ldap_servers/ldap_servers.module b/ldap_servers/ldap_servers.module

public function getUserDataFromServerByAccount($account, $id, $ldap_context = NULL) {
- $identifier = LdapUserConf::getUserIdentifierFromMap($account->id());
+ $identifier = LdapUserConf::getUserIdentifierFromMap($id);
in ldap_servers/src/ServerFactory.php b/ldap_servers/src/ServerFactory.php

In ldap_authetication.module on line no : 695
I have done the following changes
From --> $drupal_account = $auth_conf->ldapUser->provisionDrupalAccount(NULL, $user_values, NULL, TRUE);
To --> $drupal_account = $auth_conf->ldapUser->provisionDrupalAccount(NULL, $user_edit, $ldap_user, TRUE);

After all the configuration changes,
I am trying to login with a user in the LDS account but I am getting the following error.

The website encountered an unexpected error. Please try again later.
Recoverable fatal error: Argument 1 passed to Drupal\Core\Entity\EntityStorageBase::create() must be of the type array, null given, called in /var/www/authenticator/docroot/modules/contrib/ldap/ldap_user/src/LdapUserConf.php on line 947 and defined in Drupal\Core\Entity\EntityStorageBase->create() (line 175 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).
Drupal\Core\Entity\EntityStorageBase->create(NULL) (Line: 947)
Drupal\ldap_user\LdapUserConf->provisionDrupalAccount(NULL, NULL, Array, 1) (Line: 691)
_ldap_authentication_user_login_authenticate_validate(Object, , ) (Line: 327)
ldap_authentication_user_login_authenticate_validate(Array, Object)
call_user_func_array('ldap_authentication_user_login_authenticate_validate', Array) (Line: 83)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 270)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'user_login_form') (Line: 119)
Drupal\Core\Form\FormValidator->validateForm('user_login_form', Array, Object) (Line: 571)
Drupal\Core\Form\FormBuilder->processForm('user_login_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Please let me know if anybody have faced the same issue.

Same kind of issue happened in D7 and they have a solution in this link https://www.drupal.org/node/1910354 but this solution did not help me.
--
Thanks
Prashanth

Comments

plingamn created an issue. See original summary.

plingamn’s picture

Issue summary: View changes

  • grahl committed f7ad532 on 8.x-3.x
    Issue #2841687: Login page error for AD user (typo)
    
grahl’s picture

Status: Active » Fixed

Please retest with the current dev version, there was a typo in alpha2.

plingamn’s picture

Status: Fixed » Needs work

Hello grahl,

Thanks a lot for the update. I think I was not clear enough.

I am using 8.x-3.x-dev version of ldap module. I am trying to login as one of the user from the LDS.
Lets say I have a user john.doe@company.com in LDS, I am using this john.doe@company.com to login to the site assuming this will create an account in Drupal site.
But this is giving me this message on the login page
Server Error: Failed to create Drupal user account for john.doe
and following messages are registered in Drupal logs:
1. Message Failed to find or create john.doe on logon.
2. Message Login attempt failed from 10.2.1.1 --> IP of the drupal site
3. Message Invalid selection passed to syncToDrupalAccount.

plingamn’s picture

Issue summary: View changes
grahl’s picture

Hi

Thanks for that update, I have an idea where that is coming from but the updates to the dev branch from the weekend might come into conflict here. Could you please try to:
- Use alpha2 with this change http://cgit.drupalcode.org/ldap/commit/?id=f7ad532
- Enabled ldap_help and detailed error reporting on the LDAP overview page
- Try again and report the log messages here?

Thanks!

plingamn’s picture

Status: Needs work » Fixed

Hello grahl

Thank you very much ..

After the above change, Accounts are being created in Drupal website if the login credentials I used is present in the LDS.

I will keep posting in case of any more issues ..

I really appreciate all your help :)

--
Best
Prashanth

plingamn’s picture

Version: 8.x-3.x-dev » 8.x-2.x-dev
Status: Fixed » Needs work
StatusFileSize
new228.18 KB
new632.42 KB
new543.85 KB
new272.96 KB
new412.47 KB

Hello grahl,

As I said everything was working fine for me when I was using LDAP Alpha2 version.
I wanted to check if Alpha3 version is working better so I did the upgrade, unfortunately Alpha3 did not work for me.
So I downgraded my LDAP module to Alpha2 version, I did all the configuration changes that I had when I installed LDAP Alpha2 version. I am getting the following error in the error log.

1. Derived drupal username from attribute userPrincipalName returned no username for authname john.doe@company.com
2. Login attempt failed from 10.2.1.1.

I am attaching the screenshots of my settings. Can you please take a look and let me know where have I gone wrong.

--
Thanks
Prashanth

plingamn’s picture

StatusFileSize
new332.9 KB
grahl’s picture

FYI: Cannot follow up with this in the next two weeks though your issue might also be resolved with current dev, see #2829768

plingamn’s picture

Hello Grahl,

Thanks for letting me know in advance..
I tried the recent DEV. No luck. I will try to check #2829768. Hope that will solve the problem.

I will keep you posted ..

--
Thanks
Prashanth

grahl’s picture

Status: Needs work » Postponed (maintainer needs more info)

Hi Prashanth

Are you still experiencing this issue or could the other issue clear things up?

grahl’s picture

Version: 8.x-2.x-dev » 8.x-3.x-dev
plingamn’s picture

Thanks a lot grahl,

it is working fine now.

--
Best
Prashanth

plingamn’s picture

Status: Postponed (maintainer needs more info) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.