authpds-nyu 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ module AuthpdsNyu
2
2
  module Session
3
3
  module Callbacks
4
4
  def pds_record_identifier
5
- (pds_user.opensso.nil?) ? :id : :uid
5
+ (pds_user.respond_to?(:open_sso) and pds_user.opensso) ? :uid : :id
6
6
  end
7
7
 
8
8
  def valid_sso_session
@@ -1,3 +1,3 @@
1
1
  module AuthpdsNyu
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.8"
3
3
  end
data/test/test_helper.rb CHANGED
@@ -50,9 +50,8 @@ end
50
50
  class ActiveSupport::TestCase
51
51
  VALID_OPENSSO_FOR_NYU = 'AQIC5wM2LY4SfczTdvNBIcB4pWXKQmc-G0dHh5xgWeS0A5I.*AAJTSQACMDIAAlMxAAIwNg..*'
52
52
  INVALID_OPENSSO = "Invalid"
53
- VALID_PDS_HANDLE_FOR_NEW_NYU = '911201215342297526743181020780'
54
- VALID_PDS_HANDLE_FOR_EXISTING_NYU = '83201295456116368349190324314'
55
- VALID_PDS_HANDLE_FOR_NEWSCHOOL = '272201212284614806184193096120278'
53
+ VALID_PDS_HANDLE_FOR_NYU = '1122013121556337967544921442906'
54
+ VALID_PDS_HANDLE_FOR_NEWSCHOOL = '112201312531337895670228663056'
56
55
  VALID_PDS_HANDLE_FOR_COOPER = '272201212284614806184193096120278'
57
56
  INVALID_PDS_HANDLE = "Invalid"
58
57
  SESSION_ID = "qwertyuiopasdfghjkllzxcvbnm1234567890"
@@ -61,17 +61,21 @@ class UserSessionTest < ActiveSupport::TestCase
61
61
  end
62
62
  end
63
63
 
64
- # test "find_new_user" do
65
- # controller.cookies[:PDS_HANDLE] = { :value => VALID_PDS_HANDLE_FOR_NEW_NYU }
66
- # user_session = UserSession.find
67
- # # puts user_session.record.username
68
- # # puts user_session.record.id
69
- # end
70
- #
71
- # test "find_existing_user" do
72
- # controller.cookies[:PDS_HANDLE] = { :value => VALID_PDS_HANDLE_FOR_EXISTING_NYU }
73
- # user_session = UserSession.find
74
- # # puts user_session.record.username
75
- # # puts user_session.record.id
76
- # end
64
+ test "non opensso user" do
65
+ controller.cookies[:PDS_HANDLE] = { :value => VALID_PDS_HANDLE_FOR_NEWSCHOOL }
66
+ VCR.use_cassette('non opensso user') do
67
+ assert_nothing_raised do
68
+ user_session = UserSession.find
69
+ end
70
+ end
71
+ end
72
+
73
+ test "opensso user" do
74
+ controller.cookies[:PDS_HANDLE] = { :value => VALID_PDS_HANDLE_FOR_NYU }
75
+ VCR.use_cassette('opensso user') do
76
+ assert_nothing_raised do
77
+ user_session = UserSession.find
78
+ end
79
+ end
80
+ end
77
81
  end
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://logindev.library.nyu.edu/pds
6
+ body:
7
+ encoding: US-ASCII
8
+ string: func=get-attribute&attribute=bor_info&calling_system=authpds-nyu&pds_handle=112201312531337895670228663056
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Date:
20
+ - Mon, 11 Feb 2013 17:14:24 GMT
21
+ Server:
22
+ - Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8n mod_perl/2.0.4 Perl/v5.8.9
23
+ Transfer-Encoding:
24
+ - chunked
25
+ Content-Type:
26
+ - text/html; charset=UTF-8
27
+ body:
28
+ encoding: US-ASCII
29
+ string: <?xml version = "1.0" encoding = "UTF-8"?><bor-info><id>***</id><expiry-date>20120420</expiry-date><alpha>L</alpha><birth-date>00000000</birth-date><con-lng>ENG</con-lng><delinq-1>00</delinq-1><delinq-1-update-date>00000000</delinq-1-update-date><delinq-2>00</delinq-2><delinq-2-update-date>00000000</delinq-2-update-date><delinq-3>00</delinq-3><delinq-3-update-date>00000000</delinq-3-update-date><home-library>TNSFO</home-library><id>***</id><name>J,
30
+ A</name><name-key></name-key><open-date>20060807</open-date><update-date>20121213</update-date><address-0>J,
31
+ A</address-0><address-1></address-1><address-3>New
32
+ York</address-3><zip>100096998</zip><bor-status>31</bor-status><expiry-date>20130418</expiry-date><college_code></college_code><college_name></college_name><dept_code></dept_code><dept_name></dept_name><major_code></major_code><major></major><email_address>***</email_address><institute>NS</institute><institute>NS</institute><barcode>***</barcode><bor-status>31</bor-status><bor-type>0</bor-type><name>A</name><email>***</email><cn>J,
33
+ A</cn><givenname>A</givenname><sn>J</sn><verification>***</verification><nyuidn>***</nyuidn><ill-permission>Y</ill-permission></bor-info>
34
+ http_version:
35
+ recorded_at: Mon, 11 Feb 2013 17:14:25 GMT
36
+ recorded_with: VCR 2.3.0
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://logindev.library.nyu.edu/pds
6
+ body:
7
+ encoding: US-ASCII
8
+ string: func=get-attribute&attribute=bor_info&calling_system=authpds-nyu&pds_handle=1122013121556337967544921442906
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Date:
20
+ - Mon, 11 Feb 2013 17:16:25 GMT
21
+ Server:
22
+ - Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8n mod_perl/2.0.4 Perl/v5.8.9
23
+ Transfer-Encoding:
24
+ - chunked
25
+ Content-Type:
26
+ - text/html; charset=UTF-8
27
+ body:
28
+ encoding: US-ASCII
29
+ string: <?xml version = "1.0" encoding = "UTF-8"?><bor-info><id>***</id><expiry-date>20121031</expiry-date><bor-status>51</bor-status><barcode>***</barcode><bor-status>51</bor-status><bor-type>CB</bor-type><name>Scot
30
+ Thomas</name><uid>***</uid><email>***</email><cn>S
31
+ D</cn><givenname>S</givenname><sn>D</sn><verification>***</verification><nyuidn>***</nyuidn><opensso>true</opensso><edupersonentitlement><value>urn:mace:nyu.edu:entl:its:wikispriv</value><value>urn:mace:nyu.edu:entl:its:classes</value><value>urn:mace:nyu.edu:entl:its:qualtrics</value><value>urn:mace:nyu.edu:entl:lib:eresources</value><value>urn:mace:nyu.edu:entl:its:wikispub</value><value>urn:mace:nyu.edu:entl:its:webspace</value><value>urn:mace:nyu.edu:entl:lib:ideaexchange</value><value>urn:mace:nyu.edu:entl:its:projmgmt</value><value>urn:mace:nyu.edu:entl:its:files</value><value>urn:mace:incommon:entitlement:common:1</value></edupersonentitlement><objectclass><value>organizationalPerson</value><value>person</value><value>nyuInetOrgPerson</value><value>inetLocalMailRecipient</value><value>inetMailUser</value><value>inetUser</value><value>userPresenceProfile</value><value>nsManagedPerson</value><value>ipUser</value><value>eduPerson</value><value>inetOrgPerson</value><value>homeInetOrgPerson</value><value>top</value></objectclass><ill-permission>Y</ill-permission><college_code>GA</college_code><college_name>Graduate
32
+ School of Arts and Science</college_name><dept_code>CSCI</dept_code><dept_name>DIVISION
33
+ OF LIBRARIES</dept_name><major_code>GAINFOMS</major_code><major>Information
34
+ Systems</major><email_address>***</email_address><institute>NYU</institute></bor-info>
35
+ http_version:
36
+ recorded_at: Mon, 11 Feb 2013 17:16:25 GMT
37
+ recorded_with: VCR 2.3.0
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.2.7
4
+ version: 0.2.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-08 00:00:00.000000000 Z
12
+ date: 2013-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: require_all
@@ -156,6 +156,8 @@ files:
156
156
  - test/vcr_cassettes/invalid_opensso_cookie.yml
157
157
  - test/vcr_cassettes/invalid_opensso_url.yml
158
158
  - test/vcr_cassettes/invalid_sso_session.yml
159
+ - test/vcr_cassettes/non_opensso_user.yml
160
+ - test/vcr_cassettes/opensso_user.yml
159
161
  - test/vcr_cassettes/valid_opensso_cookie.yml
160
162
  - test/vcr_cassettes/valid_sso_session.yml
161
163
  homepage: http://github.com/scotdalton/authpds-nyu
@@ -172,7 +174,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
174
  version: '0'
173
175
  segments:
174
176
  - 0
175
- hash: -852877334584774773
177
+ hash: 1329969243304464894
176
178
  required_rubygems_version: !ruby/object:Gem::Requirement
177
179
  none: false
178
180
  requirements:
@@ -181,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
183
  version: '0'
182
184
  segments:
183
185
  - 0
184
- hash: -852877334584774773
186
+ hash: 1329969243304464894
185
187
  requirements: []
186
188
  rubyforge_project:
187
189
  rubygems_version: 1.8.24
@@ -202,5 +204,7 @@ test_files:
202
204
  - test/vcr_cassettes/invalid_opensso_cookie.yml
203
205
  - test/vcr_cassettes/invalid_opensso_url.yml
204
206
  - test/vcr_cassettes/invalid_sso_session.yml
207
+ - test/vcr_cassettes/non_opensso_user.yml
208
+ - test/vcr_cassettes/opensso_user.yml
205
209
  - test/vcr_cassettes/valid_opensso_cookie.yml
206
210
  - test/vcr_cassettes/valid_sso_session.yml