1

Is it possible for an application (e.g. a Java Web app) to authenticate against the Drupal users table? I know they use an SHA512 encryption, but I am wondering if there is any way to expose this service outside of Drupal

Perhaps use hook_auth within Drupal, but expose that hook externally somehow?

1 Answer 1

3

hook_auth() has been gone since Drupal 5.

But it sounds like you're looking to implement something with user_authenticate().

General outline of how to accomplish this (note that this will send passwords as plaintext - use SSL if that's a problem):

  1. Create an API page using hook_menu() for your app to hit.
  2. In that pages callback function, accept the username and password as POST requests (or however you want to build your app) and run them through user_authenticate().
  3. Return the results of user_authenticate() (either FALSE: fail or numeric: pass) as a json string (or whatever you want) and act accordingly within your external app.
1
  • 1
    It would also be possible to use a drush command on the command line or replicate the user_authenticate code in Java. Also, be sure that your menu callback performs any level of brute force protection and logging that is necessary. Just because this menu callback is meant for the java app doesn't mean it won't be used by an attacker.
    – greggles
    Commented May 29, 2013 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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