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 +4 -4
- data/lib/omniauth/nusso/version.rb +1 -1
- data/lib/omniauth/strategies/nusso.rb +14 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0e9a3d9f0574a6d69a4a8e0ce68f1c47b412ee680f9250eed235eeb185049db
|
4
|
+
data.tar.gz: d6169d53894a784c6a6bf3efde925be474659502912f993052f6409e12bb17e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a6351aaf6f763f43b854c9a156c95c68820beb16a09efd6507a6c4d043c4fc06c1150dac92acf6c6e2965f1ee2a704c2ef754d07767008167f225fb9cbae663
|
7
|
+
data.tar.gz: d272b2e872918b4e3ddf37b974eb60a5b242992d49a6bb6e7a80a99b9c50112704fe9f60ce36cb23209721ec2b989c99f06832356302aa86f634987e8816474f
|
@@ -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
|
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
|