2

Is it possible to have this module working with different Drupal versions?
We have some big projects in Drupal 6 and we want to start with a migration plan. Without being able to migrate parts of our sites, the task is much more complex than being able to do small migrations and tests.

I have seen there is the Bakery Single Sign-On System, but I don't know if it can be used when the subdomains use different Drupal versions.

UPDATE: bakery works like a charm for that. You can install it on different Drupal version sites, different fillet on same domain and, of course, different sub domains.

2

With the drupal-6 site override hook_login_validate() and write your own authentication mechanism. Simpler than it sounds, as any function that returns TRUE or FALSE based on success will work. It could directly access the database or connect via a JSON web service to the drupal-7 server. I described how to implement authentication via JSON on stackoverflow.

function mymodule_login_validate($form, &$form_state) {
   $username = $form_state['values']['name'];

   // do if condition to see if your authentication is required.  
   // e.g. you might want to keep the drupal administration users.
   if (_mymodule_use_webservice_login($username)) {
     // We are logging in using service.
     if (_mymodule_validate_password($username, $form_state['values']['pass']) {
       user_external_login_register($username, 'mymodule');
       user_authenticate_finalize($form_state['values'];
    } // else drop through to the end and return nothing - Drupal will handle the rejection for us
   }
} else {
    // Username is not an member number, so use standard Drupal authentication function
    user_login_authenticate_validate($form, &$form_state);
}

_mymodule_validate_password() is where the authentication occurs and the only other function you need to implement. See the stackoverflow site for calling a JSON web service. Try to use SSL as passing passwords over SSL is not great, although your main site may not be SSL anyway.

Implementing the web service is a function return TRUE or FALSE - drupal_json_output. You need to set up a menu, with a function callback. The function callback would call user_authenticate().

You could also try one of the SSO modules. http://groups.drupal.org/node/182004. It is usually good policy to not implement your own security code so that the code gets tried as much as possible.

  • i will take a look during the weekend, thank you for your effort in this elaborated answer Interlated :-) – Alejandro Moreno Mar 15 '13 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.