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
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | sc error log.png | 332.9 KB | plingamn |
| #9 | Screen Shot 2017-01-20 at 12.26.25 AM.png | 412.47 KB | plingamn |
| #9 | Screen Shot 2017-01-20 at 12.26.02 AM.png | 272.96 KB | plingamn |
| #9 | Screen Shot 2017-01-20 at 12.25.37 AM.png | 543.85 KB | plingamn |
| #9 | Screen Shot 2017-01-20 at 12.24.06 AM.png | 632.42 KB | plingamn |
Comments
Comment #2
plingamn commentedComment #4
grahlPlease retest with the current dev version, there was a typo in alpha2.
Comment #5
plingamn commentedHello 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.
Comment #6
plingamn commentedComment #7
grahlHi
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!
Comment #8
plingamn commentedHello 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
Comment #9
plingamn commentedHello 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
Comment #10
plingamn commentedComment #11
grahlFYI: Cannot follow up with this in the next two weeks though your issue might also be resolved with current dev, see #2829768
Comment #12
plingamn commentedHello 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
Comment #13
grahlHi Prashanth
Are you still experiencing this issue or could the other issue clear things up?
Comment #14
grahlComment #15
plingamn commentedThanks a lot grahl,
it is working fine now.
--
Best
Prashanth
Comment #16
plingamn commented