Skip to content

Commit

Permalink
User info when SAML respons lacks SNIN or person name
Browse files Browse the repository at this point in the history
  • Loading branch information
martent committed Jun 11, 2018
1 parent df49559 commit b5ca71b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/controllers/seller_auth_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ def consume
redirect_to(root_path, alert: 'Inloggning misslyckades') && return
end

seller = update_seller(response.attributes['Subject_SerialNumber'], response.attributes['Subject_CommonName'])
serial_number = response.attributes['Subject_SerialNumber']
subject_commonname = response.attributes['Subject_CommonName']

unless serial_number && subject_commonname
logger.error '[SAML_AUTH] Response has no Subject_SerialNumber (SNIN) or Subject_CommonName'
redirect_to(root_path, alert: 'Inloggningen misslyckades. Personnummer och/eller personnamn saknas i responsen från inloggningstjänsten.') && return
end

seller = update_seller(serial_number, subject_commonname)

unless seller
logger.warn '[SAML_AUTH] User not registered in the system.'
Expand Down

0 comments on commit b5ca71b

Please sign in to comment.