Commit 1e59700730bd97fd6abda078f3744d13b56bd203

Authored by Aníbal Pacheco
1 parent 00b43f5b7f
Exists in master

Document type mappings in user id received from SSO request

Showing 1 changed file with 4 additions and 1 deletions Side-by-side Diff

app/controllers/saml_controller.rb View file @ 1e59700
... ... @@ -18,7 +18,10 @@
18 18 response = OneLogin::RubySaml::Response.new(params[:SAMLResponse])
19 19 response.settings = Account.get_saml_settings
20 20  
21   - if response.is_valid? && user = User.find_by_login(response.name_id)
  21 + name_id_tokens = response.name_id.split('-')
  22 + name_id_map = {'68909' => 'CI', '68912' => 'PSP', 'DO' => 'DO'}
  23 + if response.is_valid? && user = User.find_by_login([name_id_tokens[0],
  24 + name_id_map[name_id_tokens[1]], name_id_tokens[2]].join('-'))
22 25  
23 26 self.logged_user = user
24 27 # generate a key and set cookie if autologin