Changes

Auth Module

718 bytes added, 17:39, 20 January 2011
Updating for most recent version.
== Umlaut Auth Module (Developer Notes) ==
The Auth module extends functionality available from the [Authlogic|http://github.com/binarylogic/authlogic] (version 2.1.0) gem and included in the lib directory based on the [Authlogic OpenID add-on|http://github.com/binarylogic/authlogic_openid].
Several core Umlaut files were updated in order to develop the Auth module.
==== app/controller/application.rb ====
The application controller was updated to filter '''ApplicationController''' filters passwords and provide provides two methods for accessing the current user session and the current user. The method # '''current_user_session ''' (aliased as has_logged_in_user) - returns nil if no user session has been established. The method # '''current_user ''' (aliased as logged_in_user) return - returns either nil or the current logged in userThe application calls '''current_user_session''' as a before filter on every request.
==== app/controllers/user_sessions_controller.rb ====
The user sessions controller '''UserSessionsController''' manages the routing of user session requestsand provides three methods. Three methods are available:# '''new ''' - renders the login screen or redirects to external login screen# '''validate ''' - validates the user upon login# '''destroy ''' - processes logout
==== app/controllers/users_controller.rb ====
The users controller '''UsersController''' manages the routing of user related requests. Two and provides two methods are available:.# '''edit ''' (also called from show) - renders the user preferences screen.# '''update ''' - processes updates to user preferences.(not yet implemented)
app/models/user_sessions
Extends '''UserSessions''' extends Authlogic::Session::Base
==== app/models/user ====
Serializes '''User''' serializes user_attributes and adds acts_as_authentic functionality to leverage the Authlogic gem. Also sets to_param to username rather than id for prettier urls.
==== app/views/user_sessions/new ====
The default login screen, doesn't currently do anything.
==== app/views/users/edit ====
The default user preferences screen. Users can update mobile phone numbers and the like.(not yet implemented)
==== config/environment.rb ====
Added authlogic gem:
</pre>
==== db/schema.rb ====
Modified the user table to use with authlogic. Included column for mobile phone and , user attributesand a refreshed_at date to track age of a particular record for better performance.==== lib/service.rb ====Make the user accessible from a particular user via the session_user method.<pre> # Returns the currently logged in user, if available, based on the user_credentials_id in the # session from AuthLogic. May want to make this more sophisticated and check user_credentials # against db. def session_user return User.find(session["user_credentials_id"]) unless session["user_credentials_id"].nil? end</pre>
=== UmlautAuth Plugin Auth Module ===The following files makeup the UmlautAuth Auth module to extend the functionality of Authlogic for our purposes. They could probably be moved into the UserSession module, but may be useful as a template for further localization.
==== vendor/plugins/umlaut_auth/lib/acts_as_authentic.rb ====
Extends the authlogic user model to ignore passwords, reset_persistence_token when the username changes, manage stale data (via expiration date), and handle user attributes hash.
58
edits