shibboleth-rails 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,9 +8,13 @@ module Shibboleth::Rails
8
8
  end
9
9
 
10
10
  def shibboleth
11
- {:emplid => request.env['employeeNumber'],
12
- :name_n => request.env['REMOTE_USER'].chomp("@osu.edu"),
13
- :affiliations => request.env['affiliation']}
11
+ {
12
+ :emplid => request.env['employeeNumber'],
13
+ :name_n => request.env['REMOTE_USER'].chomp("@osu.edu"),
14
+ :affiliations => request.env['affiliation'],
15
+ :first_name => request.env['FIRST-NAME'] || request.env['givenName'],
16
+ :last_name => request.env['LAST-NAME'] || request.env['sn'],
17
+ }
14
18
  end
15
19
 
16
20
  def current_user
@@ -8,13 +8,18 @@ module Shibboleth::Rails
8
8
 
9
9
  module ClassMethods
10
10
  def find_or_create_from_shibboleth(identity)
11
- affiliations = identity.delete(:affiliations)
11
+ affiliations = identity.delete(:affiliations)
12
+ first_name = identity.delete(:first_name)
13
+ last_name = identity.delete(:last_name)
12
14
 
13
15
  user = find_or_create_by_emplid(identity)
14
16
 
15
17
  # names change due to marriage, etc.
16
18
  # update_attribute is a NOOP if not different
17
19
  user.update_attribute(:name_n, identity[:name_n])
20
+ user.update_attribute(:first_name, identity[:first_name]) if user.respond_to?(:first_name) && identity[:first_name].present?
21
+ user.update_attribute(:last_name, identity[:last_name]) if user.respond_to?(:last_name) && identity[:last_name].present?
22
+
18
23
  user.update_role(affiliations) if user.respond_to?(:update_role)
19
24
  user
20
25
  end
@@ -1,5 +1,5 @@
1
1
  module Shibboleth
2
2
  module Rails
3
- VERSION = "0.6.0"
3
+ VERSION = "0.7.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shibboleth-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
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-01-02 00:00:00.000000000 Z
12
+ date: 2013-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails