From Fedora Project Wiki
No edit summary
No edit summary
 
Line 1: Line 1:
{{admon/note | What's it all about, Alfie? | This page contains notes I'm taking as I work on an AuthFAS plugin for Drupal.  In part this is to make me learn more about Drupal development using their extensive "hooks" system; in part it's to make me more familiar with PHP.}}
== AuthFAS ==
== AuthFAS ==
* hook_form_alter on $form_id == 'user_login' or 'user_login_block' to catch logins
* hook_form_alter on $form_id == 'user_login' or 'user_login_block' to catch logins

Latest revision as of 15:04, 2 July 2010

What's it all about, Alfie?
This page contains notes I'm taking as I work on an AuthFAS plugin for Drupal. In part this is to make me learn more about Drupal development using their extensive "hooks" system; in part it's to make me more familiar with PHP.

AuthFAS

  • hook_form_alter on $form_id == 'user_login' or 'user_login_block' to catch logins
    • Then set up our own functions to authenticate
  • need a settings table that contains mappings FASGroup <=> DrupalGroup
    • loop through memberships to determine groups for Drupal
    • If one exists, turn its membership on for user (or check for !member and then add)
    • If not, turn its membership off for user (or check for member and then remove)
  • Need a SQL table {authfas}
    • Contains a mapping of Drupal group ID (rid) => FAS group name
  • Admin menu should include rows from SQL table

External authentication

From http://www.darrenmothersele.com/content/using-external-data-source-drupal-user-authentication-and-login

The normal login process will call your custom authentication when the built in login process fails.

The process is as follows:

  1. user submits login information
  2. drupal checks if user is blocked, if so message is displayed and login fails
  3. drupal then attempts to load the user locally
    • if this is successful then the user object is loaded and drupal fires the load and login hooks. the user is then directed towards the 'user' page.
    • if user is not found locally then drupal will call external authentication

External authentication involves firing the auth hook, and on success either validating an existing user or creating a new user object. When a user is created this way a record is stored in the authmap table that confirms which module validates this user login.