Class: Saml::SsosBaseController

Inherits:
SamlBaseController show all
Defined in:
app/controllers/saml/ssos_base_controller.rb

Direct Known Subclasses

SsosController

Instance Method Summary collapse

Instance Method Details

#consumeObject

POST /saml/sp/consume/:id



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/saml/ssos_base_controller.rb', line 8

def consume
  setting = SpRailsSaml::Settings.instance
   = setting..find_by!(setting. => params[setting.])

  raise SpRailsSaml::SamlSettingNotFound if .saml_setting.blank?
  raise SpRailsSaml::SamlLoginForbidden if .saml_setting.password_only?

  saml_setting = .saml_setting
  saml_response = SpRailsSaml::SamlResponse.new(params[:SAMLResponse], saml_setting)

  raise SpRailsSaml::SamlResponseInvalid, saml_response.errors unless saml_response.valid?

  user = setting.user_class.find_by(setting.saml_response_user_find_key => saml_response.name_id, setting..to_s.downcase => )

  raise SpRailsSaml::LoginUserNotFound if user.blank?

  (user)
end

#metadataObject

GET /saml/sp/metadata/:id



28
29
30
31
32
33
# File 'app/controllers/saml/ssos_base_controller.rb', line 28

def 
  setting = SpRailsSaml::Settings.instance
   = setting..find_by!(setting. => params[setting.])
   = SpRailsSaml::Metadata.new(account: )
  render xml: .generate
end