authpds-nyu 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,15 +53,7 @@ module AuthpdsNyu
53
53
  module InstanceMethods
54
54
  def self.included(klass)
55
55
  klass.class_eval do
56
- pds_attributes :id => "id", :uid => "uid",
57
- :opensso => "opensso", :name => "name", :firstname => "givenname",
58
- :lastname => "sn", :commonname => "cn", :email => "email",
59
- :nyuidn => "nyuidn", :verification => "verification", :institute => "institute",
60
- :bor_status => "bor-status", :bor_type => "bor-type",
61
- :college_code => "college_code", :college_name => "college_name",
62
- :dept_name => "dept_name", :dept_code => "dept_code",
63
- :major_code => "major_code", :major => "major", :ill_permission => "ill-permission",
64
- :newschool_ldap => "newschool_ldap"
56
+ pds_attributes :firstname => "givenname", :lastname => "sn", :email => "email", :primary_institution => "institute"
65
57
  remember_me true
66
58
  remember_me_for 300
67
59
  httponly true
@@ -1,3 +1,3 @@
1
1
  module AuthpdsNyu
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -0,0 +1,35 @@
1
+ scot:
2
+ email: scot.dalton@gmail.com
3
+ password_salt: <%= salt = Authlogic::Random.hex_token %>
4
+ crypted_password: <%= Authlogic::CryptoProviders::Sha512.encrypt("scot" + salt) %>
5
+ persistence_token: <%= Authlogic::Random.hex_token %>
6
+
7
+ ba36:
8
+ id: 1
9
+ password_salt: <%= salt = Authlogic::Random.hex_token %>
10
+ crypted_password: <%= Authlogic::CryptoProviders::Sha512.encrypt("ba36" + salt) %>
11
+ persistence_token: <%= Authlogic::Random.hex_token %>
12
+ username: ba36
13
+ email: barnaby.alter@nyu.edu
14
+ firstname: Barnaby
15
+ lastname: Alter
16
+ user_attributes: <%= {
17
+ :nyuidn => "N18158418",
18
+ :verification => "6EAF453D8B01E5AC27D9",
19
+ :bor_status => "51",
20
+ :aleph_permissions => {} }.to_yaml.inspect %>
21
+
22
+ # std5:
23
+ # id: 2
24
+ # password_salt: <%= salt = Authlogic::Random.hex_token %>
25
+ # crypted_password: <%= Authlogic::CryptoProviders::Sha512.encrypt("std5" + salt) %>
26
+ # persistence_token: <%= Authlogic::Random.hex_token %>
27
+ # username: std5
28
+ # email: scot.dalton@nyu.edu
29
+ # firstname: Scot
30
+ # lastname: Dalton
31
+ # user_attributes: <%#= {
32
+ # :nyuidn => "N12162279",
33
+ # :verification => "d4465aacaa645f2164908cd4184c09f0",
34
+ # :bor_status => "51",
35
+ # :aleph_permissions => {} }.to_yaml.inspect %>
data/test/test_helper.rb CHANGED
@@ -38,13 +38,14 @@ ActiveRecord::Schema.define(:version => 1) do
38
38
  end
39
39
 
40
40
  # Load support files
41
- require File.dirname(__FILE__) + '/../lib/authpds-nyu' unless defined?(AuthpdsNyu)
41
+ require File.dirname(__FILE__) + '/../lib/authpds-nyu'
42
42
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
43
43
 
44
44
  class ActiveSupport::TestCase
45
- VALID_OPENSSO_FOR_NYU = 'AQIC5wM2LY4SfcxDSwCymgKWMu6OksqGN0zuRV5cUdz33Bo.*AAJTSQACMDIAAlNLAAstMTg5NTE2OTAzNQACUzEAAjA2*'
45
+ VALID_OPENSSO_FOR_NYU = 'AQIC5wM2LY4Sfcz9Ft-_J7b9B4WyLvQB3EWxEYXmhzx86ZM.*AAJTSQACMDIAAlNLAAoyMTA2OTg5ODIzAAJTMQACMDE.*'
46
46
  INVALID_OPENSSO = "Invalid"
47
- VALID_PDS_HANDLE_FOR_NYU = '132012112947113134742310506860'
47
+ VALID_PDS_HANDLE_FOR_NEW_NYU = '83201295456116368349190324314'
48
+ VALID_PDS_HANDLE_FOR_EXISTING_NYU = '83201295456116368349190324314'
48
49
  VALID_PDS_HANDLE_FOR_NEWSCHOOL = '272201212284614806184193096120278'
49
50
  VALID_PDS_HANDLE_FOR_COOPER = '272201212284614806184193096120278'
50
51
  INVALID_PDS_HANDLE = "Invalid"
@@ -72,6 +73,10 @@ class Authlogic::TestCase::MockController
72
73
  def root_url
73
74
  end
74
75
 
76
+ def validate_url(options={})
77
+ return "http://railsapp.library.nyu.edu/validate?return_url=#{options[:return_url]}"
78
+ end
79
+
75
80
  def performed?
76
81
  false
77
82
  end
@@ -4,7 +4,7 @@ class AlephBorAuthTest < ActiveSupport::TestCase
4
4
  def setup
5
5
  activate_authlogic
6
6
  controller.session[:session_id] = "FakeSessionID"
7
- # controller.cookies[:PDS_HANDLE] = { :value => VALID_PDS_HANDLE_FOR_NYU }
7
+ # controller.cookies[:PDS_HANDLE] = { :value => VALID_PDS_HANDLE_FOR_NEW_NYU }
8
8
  controller.cookies[:iPlanetDirectoryPro] = { :value => VALID_OPENSSO_FOR_NYU }
9
9
  end
10
10
 
@@ -3,7 +3,7 @@ class OpenssoTest < ActiveSupport::TestCase
3
3
  def setup
4
4
  activate_authlogic
5
5
  controller.session[:session_id] = "FakeSessionID"
6
- # controller.cookies[:PDS_HANDLE] = { :value => VALID_PDS_HANDLE_FOR_NYU }
6
+ # controller.cookies[:PDS_HANDLE] = { :value => VALID_PDS_HANDLE_FOR_NEW_NYU }
7
7
  controller.cookies[:iPlanetDirectoryPro] = { :value => VALID_OPENSSO_FOR_NYU }
8
8
  end
9
9
 
@@ -4,7 +4,6 @@ class UserSessionTest < ActiveSupport::TestCase
4
4
  def setup
5
5
  activate_authlogic
6
6
  controller.session[:session_id] = "FakeSessionID"
7
- # controller.cookies[:PDS_HANDLE] = { :value => VALID_PDS_HANDLE_FOR_NYU }
8
7
  controller.cookies[:iPlanetDirectoryPro] = { :value => VALID_OPENSSO_FOR_NYU }
9
8
  end
10
9
 
@@ -23,4 +22,18 @@ class UserSessionTest < ActiveSupport::TestCase
23
22
  assert_nil(user_session.record)
24
23
  user_session = UserSession.find
25
24
  end
25
+
26
+ test "find_new_user" do
27
+ controller.cookies[:PDS_HANDLE] = { :value => VALID_PDS_HANDLE_FOR_NEW_NYU }
28
+ user_session = UserSession.find
29
+ puts user_session.record.username
30
+ puts user_session.record.id
31
+ end
32
+
33
+ test "find_existing_user" do
34
+ controller.cookies[:PDS_HANDLE] = { :value => VALID_PDS_HANDLE_FOR_EXISTING_NYU }
35
+ user_session = UserSession.find
36
+ puts user_session.record.username
37
+ puts user_session.record.id
38
+ end
26
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authpds-nyu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
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-05 00:00:00.000000000 Z
12
+ date: 2012-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2152630420 !ruby/object:Gem::Requirement
16
+ requirement: &2152186720 !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: *2152630420
24
+ version_requirements: *2152186720
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sqlite3
27
- requirement: &2152629640 !ruby/object:Gem::Requirement
27
+ requirement: &2152185340 !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: :development
34
34
  prerelease: false
35
- version_requirements: *2152629640
35
+ version_requirements: *2152185340
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: authpds
38
- requirement: &2152629000 !ruby/object:Gem::Requirement
38
+ requirement: &2152184840 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2152629000
46
+ version_requirements: *2152184840
47
47
  description: NYU libraries SSO client.
48
48
  email:
49
49
  - scotdalton@gmail.com
@@ -61,6 +61,7 @@ files:
61
61
  - Rakefile
62
62
  - README.rdoc
63
63
  - test/authpds-nyu_test.rb
64
+ - test/fixtures/users.yml
64
65
  - test/support/user.rb
65
66
  - test/support/user_session.rb
66
67
  - test/test_helper.rb
@@ -93,6 +94,7 @@ specification_version: 3
93
94
  summary: NYU libraries SSO client.
94
95
  test_files:
95
96
  - test/authpds-nyu_test.rb
97
+ - test/fixtures/users.yml
96
98
  - test/support/user.rb
97
99
  - test/support/user_session.rb
98
100
  - test/test_helper.rb