-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot login to D9 SP #71
Comments
Thanks for reporting this. I will try to replicate that, but it doesn't look like the problem is in this module. Have a look at https://github.com/drupal/core/blob/9.1.5/modules/field_ui/field_ui.module#L74: $entity_types['field_config']->setFormClass('edit', 'Drupal\field_ui\Form\FieldConfigEditForm'); Hm, however it maybe that Drupal haven't booted properly... |
Hello again, you can replicate by creating a second index.php (vendor/simplesamlphp/simplesamlphp/www/index2.php) boot Drupal then try to directly load user User::load(1); this will fail as it needs to be in context of drupal. if you change dir before User::load, it will work. I will try to find a better, proper solution and get back to you if successful. |
I tried to replicate but setting up d9 9.2.x idp and d9 sp . Works as designed.
If you modified any of the files are on your own. |
It was only an example, I never modify lib/core file (unless i intend to propose updates). It is crazy. And we both have the same issue. I will keep digging, as this lib/module is our last hope. |
That was a rude reply, sorry. I tried to reproduce this on the real clean install. The I'm pretty sure that the issue is not in the module, but your particular setup. Are you setting new project or are you adding new functionality to existing project? |
This is a clean install with standard profile. Custom Docker image starting from php7.4-apache-buster-4 + Drupal composer require drupal/simplesamlphp_auth I add the following lines to the end of config.php on IDP $config['secretsalt'] = '53k1ftm1duxts4bi2lmefkuut1fuqksh';
$config['auth.adminpassword'] = 'idp';
$config['store.type'] = 'sql';
$config['store.sql.dsn'] = 'mysql:host=db;dbname=d9_provider';
$config['store.sql.username'] = 'root';
$config['store.sql.password'] = 'mdp';
$config['enable.saml20-idp'] = true;
$config['baseurlpath'] = 'https://'. $_SERVER['HTTP_HOST'] . '/simplesaml/';
$config['session.cookie.secure'] = true; Finally certs, metadata, authsources, idp-hosted, sp-remote as instructed. Similar install for the SP : Custom Docker image starting from php7.4-apache-buster-4 + Drupal composer require drupal/simplesamlphp_auth config.php on SP: $config['secretsalt'] = '2gznxwd8aco0ca6ktegb766pmzk4j9f0';
$config['auth.adminpassword'] = 'client';
$config['store.type'] = 'sql';
$config['store.sql.dsn'] = 'mysql:host=db;dbname=d9_client';
$config['store.sql.username'] = 'root';
$config['store.sql.password'] = 'mdp';
$config['baseurlpath'] = 'https://'. $_SERVER['HTTP_HOST'] . '/simplesaml/';
$config['session.cookie.secure'] = true;
Upong login it fails with the mentioned message. The only thing that works is by modifying in drupalauth module External.php this part: if (!empty($drupaluid)) {
// Load the user object from Drupal.
$originalDir = getcwd();
chdir($this->config->getDrupalroot());
$drupaluser = User::load($uid);
chdir($originalDir);
if ($drupaluser->isBlocked()) {
throw new Error('NOACCESS');
}
$requested_attributes = $this->config->getAttributes();
return $drupalHelper->getAttributes($drupaluser, $requested_attributes);
} This does not work for me as I do not agree with modifying source code. For the moment this is in DEV environement as Proof of Concept. I can provide any details if needed. i am grateful for your help on this issue |
This is really interesting. When you say
what do you mean by that ? How do you manage container connections, volume mounts, etc? Can you please try replicating your issue using Lando and config from https://dev.to/esnaremaussa/single-sign-on-with-simplesamlphp-and-drupal-9-1h1b |
After you last comment I've started analysing "What have I added to my default Drupal installation that could conflict ?" Finally, the answer is : Disabling cache I always disable cache on DEV environment following this guide : https://www.drupal.org/node/2598914 $cache_bins = array('bootstrap','config','data','default','discovery','dynamic_page_cache','entity','menu','migrate','render','rest','static','toolbar');
foreach ($cache_bins as $bin) {
$settings['cache']['bins'][$bin] = 'cache.backend.null';
} The Everything works as expected now. Thank you for your patience and interest. |
That's rough, but I'm glad you found your issue. I would really question suggestions in that guide. Never doing it myself - too many issues in the past when caching wasn't considered during development. Also, have a look https://github.com/drupal/drupal/blob/9.2.x/sites/example.settings.local.php most cache disabling examples have strong warnings about consequences. |
Hi,
First of all Thanks for your work on this module.
I am trying to make an install where a Drupal instance works as IdP with another D9 instance working as SP.
Drupal version : 9.1.5
DrupalAuth version 8.x-1.1
The configuration is OK, but upon login :
The website encountered an unexpected error. Please try again later.
Error: Call to a member function setFormClass() on null in field_ui_entity_type_build() (line 74 of ore/modules/field_ui/field_ui.module).
field_ui_entity_type_build(Array) (Line: 129)
Drupal\Core\Entity\EntityTypeManager->findDefinitions() (Line: 175)
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 83)
Drupal\Core\Entity\EntityTypeRepository->getEntityTypeFromClass('Drupal\user\Entity\User') (Line: 487)
Drupal\Core\Entity\EntityBase::load('2') (Line: 156)
SimpleSAML\Module\drupalauth\Auth\Source\External->getUser() (Line: 176)
SimpleSAML\Module\drupalauth\Auth\Source\External->authenticate(Array) (Line: 210)
SimpleSAML\Auth\Source->initLogin(Array, NULL, Array) (Line: 169)
SimpleSAML\Auth\Simple->login(Array) (Line: 357)
SimpleSAML\IdP->authenticate(Array) (Line: 415)
SimpleSAML\IdP->handleAuthenticationRequest(Array) (Line: 492)
SimpleSAML\Module\saml\IdP\SAML2::receiveAuthnRequest(Object) (Line: 26)
I went through the installation process + config multiple times.
Thank you in advance for your help/guidance.
The text was updated successfully, but these errors were encountered: