Skip to content

Integrating Your Campus Authentication System

Ethan Romba edited this page Jan 4, 2014 · 1 revision

BookSwap is designed to be integrated with external user authentication systems (e.g. via LDAP) to allow students to log in using their official school-provided electronic identities.

Since it would be impossible to accommodate all of the different campus authentication systems that are in use today, BookSwap's default User class (application/controllers/user.php) provides a minimal authentication implementation that serves as a starting point for BookSwap integrators. This implementation provides basic log-in / log-out functionality and demonstrates how to create a new BookSwap user account when a user logs in for the first time.

NOTE: The default User class does NO password checking and must be either expanded upon or replaced with a more complete authentication mechanism in production.

You can integrate your own campus's authentication system by fleshing out the login(), logout(), and authenticate() methods as needed.

At minimum, your implementation must do the following when the user is successfully authenticated:

  1. Retrieve the user's email address and first name from the external authentication system.

  2. Assign these retrieved values to the email and first_name variables, respectively, of the user's BookSwap user object.

  3. Persist the user's new (or updated) user object in the database.

  4. Assign the user's user object to the bookswap_user session variable. For example:

    $this->session->set_userdata('bookswap_user', $user_object);