README.rdoc in authpds-0.0.23 vs README.rdoc in authpds-0.1.0
- old
+ new
@@ -1,35 +1,58 @@
= Authpds
This gem provides a mechanism for authenticating via Ex Libris' Patron Directory Services (PDS) and provides hooks for making authorization decisions based on the user information provided by PDS. It leverages the authlogic gem and depends on a User-like model.
== Basics
-=== Generate User-like model:
-rails generate model User username:string email:string firstname:string \
- lastname:string mobile_phone:string crypted_password:string password_salt:string \
- session_id:string persistence_token:string login_count:integer last_request_at:string \
- current_login_at:string last_login_at:string last_login_ip:string current_login_ip:string \
- user_attributes:text refreshed_at:datetime
+=== Generate User-like model
+ $ rails generate model User username:string email:string firstname:string \
+ lastname:string mobile_phone:string crypted_password:string password_salt:string \
+ session_id:string persistence_token:string login_count:integer last_request_at:string \
+ current_login_at:string last_login_at:string last_login_ip:string current_login_ip:string \
+ user_attributes:text refreshed_at:datetime
+=== Configure User-like model
+ class User < ActiveRecord::Base
+ serialize :user_attributes
+
+ acts_as_authentic do |c|
+ c.validations_scope = :username
+ c.validate_password_field = false
+ c.require_password_confirmation = false
+ c.disable_perishable_token_maintenance = true
+ end
+ end
+
=== Generate UserSession model
-rails generate authlogic:session user_session
+ $ rails generate authlogic:session user_session
+=== Configure UserSession with Authpds options
+ class UserSession < Authlogic::Session::Base
+ pds_url "https://login.library.institution.edu"
+ redirect_logout_url "http://library.institution.edu"
+ calling_system "my_system"
+
+ def expiration_date
+ 1.second.ago
+ end
+ end
+
=== Create UserSessions controller
-rails generate controller UserSessions --no-assets --no-helper
+ $ rails generate controller UserSessions --no-assets --no-helper
=== Mixin authpds methods into UserSessionsController
-class UserSessionsController < ApplicationController
- require 'authpds'
- include Authpds::Controllers::AuthpdsSessionsController
-end
+ class UserSessionsController < ApplicationController
+ require 'authpds'
+ include Authpds::Controllers::AuthpdsSessionsController
+ end
=== Mixin authpds methods into ApplicationController
-class ApplicationController < ActionController::Base
- protect_from_forgery
- require 'authpds'
- include Authpds::Controllers::AuthpdsController
-end
+ class ApplicationController < ActionController::Base
+ protect_from_forgery
+ require 'authpds'
+ include Authpds::Controllers::AuthpdsController
+ end
== Overview
The Authpds gem mixes in callbacks to Authlogic for persisting
sessions based on a valid PDS handle.
The module extends Authlogic and should be compatible with Authlogic configuation.
@@ -37,24 +60,24 @@
The documentation below describes the hooks available for overriding, PDS config methods
and further details about the module.
== Config Options Available
:pds_url:: Base pds url
-:calling_system:: Name of the system
-:anonymous:: Does the system allow anonymous access?
+:calling_system:: Name of the system (authpds)
+:anonymous:: Does the system allow anonymous access? (true)
:pds_attributes:: Mapping of PDS attributes to record attributes
:redirect_logout_url:: Custom redirect logout url
-:login_inaccessible_url:: Custom url to redirect to in case of system outage
+:login_inaccessible_url:: Custom url to redirect to in case of PDS system outage
:pds_record_identifier:: PDS user method to call to identify record
:institution_param_key:: Querystring parameter key for the institution value in this system
-:validate_url_name:: URL name for validation action in routes
+:validate_url_name:: URL name for validation action in routes (validate_url)
== Hooks Available for Overriding
-:pds_record_identifier:: Allows for more complex logic in determining what should be used as the record identifier. Defaults to what was set in the pds_record_identifier config.
-:valid_sso_session?:: If there is no PDS handle, can we redirect to PDS to establish a SSO session based on some other information?
-:additional_authorization:: Allows for additions to the authorization decision
-:additional_attributes:: Allows for additional attributes to be stored in the record
-:expiration_date:: Indicates when the record information should be refreshed. Defaults to one week ago.
+:pds_record_identifier:: Allows for more complex logic in determining what should be used as the record identifier. Defaults to what was set in the pds_record_identifier config. Returns a Symbol.
+:valid_sso_session?:: If there is no PDS handle, can we redirect to PDS to establish a SSO session based on some other information? Returns a Boolean.
+:additional_authorization:: Allows for additions to the authorization decision. Returns a Boolean.
+:additional_attributes:: Allows for additional attributes to be stored in the record. Returns a Hash.
+:expiration_date:: Indicates when the record information should be refreshed. Defaults to one week ago. Returns a Date or Time.
== Further Implementation Details
=== Persisting a Session in AuthLogic
When persisting a Session, Authlogic attempts to create the Session based on information available
without having to perform an actual login by calling the :persisting? method. Authologic provides several callbacks from the :persisting?
\ No newline at end of file