Class: Saml::SsosBaseController
- Inherits:
-
SamlBaseController
- Object
- ApplicationController
- SamlBaseController
- Saml::SsosBaseController
- Defined in:
- app/controllers/saml/ssos_base_controller.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#consume ⇒ Object
POST /saml/sp/consume/:id.
-
#metadata ⇒ Object
GET /saml/sp/metadata/:id.
Instance Method Details
#consume ⇒ Object
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 account = setting.account_class.find_by!(setting.account_find_key => params[setting.account_find_key]) raise SpRailsSaml::SamlSettingNotFound if account.saml_setting.blank? raise SpRailsSaml::SamlLoginForbidden if account.saml_setting.password_only? saml_setting = account.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.account_class.to_s.downcase => account) raise SpRailsSaml::LoginUserNotFound if user.blank? sign_in_with_saml(user) end |
#metadata ⇒ Object
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 account = setting.account_class.find_by!(setting.account_find_key => params[setting.account_find_key]) = SpRailsSaml::Metadata.new(account: account) render xml: .generate end |