Class: OmniAuth::Strategies::CMU

Inherits:
Pubcookie show all
Includes:
Pubcookie::CMULdap
Defined in:
lib/omniauth/strategies/cmu.rb

Constant Summary

Constants included from Pubcookie

Pubcookie::VERSION

Instance Method Summary collapse

Methods included from Pubcookie::CMULdap

#lookup_andrew_id

Instance Method Details

#auth_hash(username) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/omniauth/strategies/cmu.rb', line 17

def auth_hash username
  andrew_id = username.match(/^(.*)@/)[1]

  attrs = lookup_andrew_id(andrew_id)

  OmniAuth::Utils.deep_merge(super, {
    'uid'       => andrew_id,
    'provider'  => 'cmu',
    'user_info' => {
      'name'       => attrs[:cn],
      'email'      => attrs[:mail],
      'nickname'   => attrs[:nickname],
      'first_name' => attrs[:givenname],
      'last_name'  => attrs[:sn],
      'class'      => attrs[:cmustudentclass],
      'department' => attrs[:cmudepartment],
      'location'   => attrs[:cmucampus]
    },
    'extra' => {'user_hash' => attrs}
  })
end

#pubcookie_options=(options) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/omniauth/strategies/cmu.rb', line 9

def pubcookie_options= options
  options[:login_server] ||= 'webiso.andrew.cmu.edu'
  options[:granting_cert] ||=
    File.expand_path('../cmu_granting.cert', __FILE__)

  super
end