omniauth-nusso 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 372fca1755b7d777832e456d32d9d7dab95536c03233f40b455bd9b74ff8ee62
4
- data.tar.gz: 5ba79e279f4659e2d36b4c850cbbf14cf5993ae47617c3b244454a8eff15ed3c
3
+ metadata.gz: e0e9a3d9f0574a6d69a4a8e0ce68f1c47b412ee680f9250eed235eeb185049db
4
+ data.tar.gz: d6169d53894a784c6a6bf3efde925be474659502912f993052f6409e12bb17e3
5
5
  SHA512:
6
- metadata.gz: c4164359e4e306012663329fd253c6a42dcd810c78cc261646feacbc257328d2f1c8af6f8e22a64f91f00114c44b6a4fecaf3b747acc926b36a6f1bd27763c55
7
- data.tar.gz: 4eefac39a22768fc388f1908212dff3bdb0cc90b97c6c9aa725a0690d9720ff92002c1b382347d9f684ce4e08fcfbfd57c6ea71942145893690a21a5a9ca872e
6
+ metadata.gz: 7a6351aaf6f763f43b854c9a156c95c68820beb16a09efd6507a6c4d043c4fc06c1150dac92acf6c6e2965f1ee2a704c2ef754d07767008167f225fb9cbae663
7
+ data.tar.gz: d272b2e872918b4e3ddf37b974eb60a5b242992d49a6bb6e7a80a99b9c50112704fe9f60ce36cb23209721ec2b989c99f06832356302aa86f634987e8816474f
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Nusso
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
@@ -17,6 +17,7 @@ module OmniAuth
17
17
  option :consumer_key, nil
18
18
  option :sso_cookie, 'nusso'
19
19
  option :include_attributes, true
20
+ option :netid_email_domain, 'e.northwestern.edu'
20
21
 
21
22
  ATTRIBUTE_MAP = {
22
23
  name: 'displayName',
@@ -43,7 +44,7 @@ module OmniAuth
43
44
  response = get('validateWebSSOToken', webssotoken: token)
44
45
  @user_info = { 'uid' => response['netid'] }
45
46
  if options.include_attributes
46
- @user_info.merge!(get_directory_attributes(token))
47
+ @user_info.merge!(get_directory_attributes(token, response['netid']))
47
48
  end
48
49
  super
49
50
  rescue AuthException => err
@@ -77,7 +78,16 @@ module OmniAuth
77
78
  end
78
79
  end
79
80
 
80
- def get_directory_attributes(token)
81
+ def netid_user(net_id)
82
+ {
83
+ 'displayName' => net_id,
84
+ 'givenName' => net_id,
85
+ 'sn' => '(NetID)',
86
+ 'mail' => "#{net_id}@#{options.netid_email_domain}"
87
+ }
88
+ end
89
+
90
+ def get_directory_attributes(token, net_id)
81
91
  response = get("validate-with-directory-search-response", webssotoken: token)
82
92
  Hash[
83
93
  response['results'].first.map do |k, v|
@@ -89,6 +99,8 @@ module OmniAuth
89
99
  end
90
100
  end.compact
91
101
  ]
102
+ rescue AuthException
103
+ netid_user(net_id)
92
104
  end
93
105
  end
94
106
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-nusso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brendan Quinn