authpds 0.0.23 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,31 +3,54 @@
3
3
  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.
4
4
 
5
5
  == Basics
6
- === Generate User-like model:
7
- rails generate model User username:string email:string firstname:string \
8
- lastname:string mobile_phone:string crypted_password:string password_salt:string \
9
- session_id:string persistence_token:string login_count:integer last_request_at:string \
10
- current_login_at:string last_login_at:string last_login_ip:string current_login_ip:string \
11
- user_attributes:text refreshed_at:datetime
6
+ === Generate User-like model
7
+ $ rails generate model User username:string email:string firstname:string \
8
+ lastname:string mobile_phone:string crypted_password:string password_salt:string \
9
+ session_id:string persistence_token:string login_count:integer last_request_at:string \
10
+ current_login_at:string last_login_at:string last_login_ip:string current_login_ip:string \
11
+ user_attributes:text refreshed_at:datetime
12
+
13
+ === Configure User-like model
14
+ class User < ActiveRecord::Base
15
+ serialize :user_attributes
16
+
17
+ acts_as_authentic do |c|
18
+ c.validations_scope = :username
19
+ c.validate_password_field = false
20
+ c.require_password_confirmation = false
21
+ c.disable_perishable_token_maintenance = true
22
+ end
23
+ end
12
24
 
13
25
  === Generate UserSession model
14
- rails generate authlogic:session user_session
26
+ $ rails generate authlogic:session user_session
27
+
28
+ === Configure UserSession with Authpds options
29
+ class UserSession < Authlogic::Session::Base
30
+ pds_url "https://login.library.institution.edu"
31
+ redirect_logout_url "http://library.institution.edu"
32
+ calling_system "my_system"
33
+
34
+ def expiration_date
35
+ 1.second.ago
36
+ end
37
+ end
15
38
 
16
39
  === Create UserSessions controller
17
- rails generate controller UserSessions --no-assets --no-helper
40
+ $ rails generate controller UserSessions --no-assets --no-helper
18
41
 
19
42
  === Mixin authpds methods into UserSessionsController
20
- class UserSessionsController < ApplicationController
21
- require 'authpds'
22
- include Authpds::Controllers::AuthpdsSessionsController
23
- end
43
+ class UserSessionsController < ApplicationController
44
+ require 'authpds'
45
+ include Authpds::Controllers::AuthpdsSessionsController
46
+ end
24
47
 
25
48
  === Mixin authpds methods into ApplicationController
26
- class ApplicationController < ActionController::Base
27
- protect_from_forgery
28
- require 'authpds'
29
- include Authpds::Controllers::AuthpdsController
30
- end
49
+ class ApplicationController < ActionController::Base
50
+ protect_from_forgery
51
+ require 'authpds'
52
+ include Authpds::Controllers::AuthpdsController
53
+ end
31
54
 
32
55
  == Overview
33
56
  The Authpds gem mixes in callbacks to Authlogic for persisting
@@ -39,21 +62,21 @@ and further details about the module.
39
62
 
40
63
  == Config Options Available
41
64
  :pds_url:: Base pds url
42
- :calling_system:: Name of the system
43
- :anonymous:: Does the system allow anonymous access?
65
+ :calling_system:: Name of the system (authpds)
66
+ :anonymous:: Does the system allow anonymous access? (true)
44
67
  :pds_attributes:: Mapping of PDS attributes to record attributes
45
68
  :redirect_logout_url:: Custom redirect logout url
46
- :login_inaccessible_url:: Custom url to redirect to in case of system outage
69
+ :login_inaccessible_url:: Custom url to redirect to in case of PDS system outage
47
70
  :pds_record_identifier:: PDS user method to call to identify record
48
71
  :institution_param_key:: Querystring parameter key for the institution value in this system
49
- :validate_url_name:: URL name for validation action in routes
72
+ :validate_url_name:: URL name for validation action in routes (validate_url)
50
73
 
51
74
  == Hooks Available for Overriding
52
- :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.
53
- :valid_sso_session?:: If there is no PDS handle, can we redirect to PDS to establish a SSO session based on some other information?
54
- :additional_authorization:: Allows for additions to the authorization decision
55
- :additional_attributes:: Allows for additional attributes to be stored in the record
56
- :expiration_date:: Indicates when the record information should be refreshed. Defaults to one week ago.
75
+ :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.
76
+ :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.
77
+ :additional_authorization:: Allows for additions to the authorization decision. Returns a Boolean.
78
+ :additional_attributes:: Allows for additional attributes to be stored in the record. Returns a Hash.
79
+ :expiration_date:: Indicates when the record information should be refreshed. Defaults to one week ago. Returns a Date or Time.
57
80
 
58
81
  == Further Implementation Details
59
82
  === Persisting a Session in AuthLogic
@@ -4,26 +4,26 @@ module Authpds
4
4
  # sessions based on a valid PDS handle.
5
5
  # The module extends Authlogic and should be compatible with Authlogic configuation.
6
6
  # It also provides hooks for custom functionality.
7
- # The documentation below describes the hooks available for overriding, PDS config methods
7
+ # The documentation below describes the hooks available, PDS config methods
8
8
  # and further details about the module.
9
9
  #
10
10
  # == Config Options Available
11
11
  # :pds_url:: Base pds url
12
- # :calling_system:: Name of the system
13
- # :anonymous:: Does the system allow anonymous access?
12
+ # :calling_system:: Name of the system (authpds)
13
+ # :anonymous:: Does the system allow anonymous access? (true)
14
14
  # :pds_attributes:: Mapping of PDS attributes to record attributes
15
15
  # :redirect_logout_url:: Custom redirect logout url
16
- # :login_inaccessible_url:: Custom url to redirect to in case of system outage
16
+ # :login_inaccessible_url:: Custom url to redirect to in case of PDS system outage
17
17
  # :pds_record_identifier:: PDS user method to call to identify record
18
18
  # :institution_param_key:: Querystring parameter key for the institution value in this system
19
- # :validate_url_name:: URL name for validation action in routes
19
+ # :validate_url_name:: URL name for validation action in routes (validate_url)
20
20
  #
21
- # == Hooks Available for Overriding
22
- # :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.
23
- # :valid_sso_session?:: If there is no PDS handle, can we redirect to PDS to establish a SSO session based on some other information?
24
- # :additional_authorization:: Allows for additions to the authorization decision
25
- # :additional_attributes:: Allows for additional attributes to be stored in the record
26
- # :expiration_date:: Indicates when the record information should be refreshed. Defaults to one week ago.
21
+ # == Hooks Available
22
+ # :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.
23
+ # :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.
24
+ # :additional_authorization:: Allows for additions to the authorization decision. Returns a Boolean.
25
+ # :additional_attributes:: Allows for additional attributes to be stored in the record. Returns a Hash.
26
+ # :expiration_date:: Indicates when the record information should be refreshed. Defaults to one week ago. Returns a Date or Time.
27
27
  #
28
28
  # == Further Implementation Details
29
29
  # === Persisting a Session in AuthLogic
@@ -1,3 +1,3 @@
1
1
  module Authpds
2
- VERSION = "0.0.23"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authpds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.23
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-29 00:00:00.000000000 Z
12
+ date: 2012-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2151877380 !ruby/object:Gem::Requirement
16
+ requirement: &2151877140 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2151877380
24
+ version_requirements: *2151877140
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: authlogic
27
- requirement: &2151874980 !ruby/object:Gem::Requirement
27
+ requirement: &2151873620 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2151874980
35
+ version_requirements: *2151873620
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: nokogiri
38
- requirement: &2151868120 !ruby/object:Gem::Requirement
38
+ requirement: &2151867920 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2151868120
46
+ version_requirements: *2151867920
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sqlite3
49
- requirement: &2151864560 !ruby/object:Gem::Requirement
49
+ requirement: &2151864160 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2151864560
57
+ version_requirements: *2151864160
58
58
  description: Libraries that use Ex Libris products, can integrate Rails application
59
59
  with PDS to provide single sign-on across systems.
60
60
  email: