diff --git a/Gemfile.lock b/Gemfile.lock index 9c8596c..f8ed412 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - sp-rails-saml (1.0.2) + sp-rails-saml (1.0.3) ruby-saml GEM diff --git a/README.md b/README.md index 5c49fd2..53f005d 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ $ rails g sp_rails_saml:install {reference_table_name} At this point, you need to write your account table name in `reference_table_name`. This will generate the saml templates for controller, view, model, initializer, etc. + If you need only saml sp initiated and idp initiated template ``` diff --git a/app/controllers/saml/sessions_base_controller.rb b/app/controllers/saml/sessions_base_controller.rb index 45b934f..63da8ad 100644 --- a/app/controllers/saml/sessions_base_controller.rb +++ b/app/controllers/saml/sessions_base_controller.rb @@ -11,6 +11,7 @@ def create user = setting.user_class.find_by!(setting.user_find_key => params[:email]) account = user.send(setting.account_class.to_s.downcase.to_sym) + raise SpRailsSaml::SamlSettingNotFound if account.saml_setting.blank? raise SpRailsSaml::SamlLoginForbidden if account.saml_setting.password_only? if user.blank? diff --git a/app/controllers/saml/ssos_base_controller.rb b/app/controllers/saml/ssos_base_controller.rb index 798248f..8cbf5e3 100644 --- a/app/controllers/saml/ssos_base_controller.rb +++ b/app/controllers/saml/ssos_base_controller.rb @@ -9,6 +9,7 @@ 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 diff --git a/lib/sp-rails-saml.rb b/lib/sp-rails-saml.rb index 1812e1e..fec0923 100644 --- a/lib/sp-rails-saml.rb +++ b/lib/sp-rails-saml.rb @@ -20,6 +20,8 @@ class LoginUserNotFound < Error; end class SamlResponseInvalid < Error; end + class SamlSettingNotFound < Error; end + autoload :Authnrequest, File.expand_path('./sp-rails-saml/authnrequest', __dir__) autoload :SamlResponse, File.expand_path('./sp-rails-saml/saml_response', __dir__) autoload :Metadata, File.expand_path('./sp-rails-saml/metadata', __dir__) diff --git a/lib/sp-rails-saml/version.rb b/lib/sp-rails-saml/version.rb index 0cb73ba..3c125f4 100644 --- a/lib/sp-rails-saml/version.rb +++ b/lib/sp-rails-saml/version.rb @@ -1,3 +1,3 @@ module SpRailsSaml - VERSION = '1.0.2'.freeze + VERSION = '1.0.3'.freeze end