From daaed6a7ea30240628e2902f857f49d74facb57a Mon Sep 17 00:00:00 2001 From: Hiroto Yonetani <35982148+Sibakeny@users.noreply.github.com> Date: Fri, 5 Nov 2021 16:38:37 +0900 Subject: [PATCH] =?UTF-8?q?SAML=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=81=8C?= =?UTF-8?q?=E8=A1=8C=E3=82=8F=E3=82=8C=E3=81=A6=E3=81=84=E3=81=AA=E3=81=84?= =?UTF-8?q?=E5=A0=B4=E5=90=88=E3=81=ABSamlSettingNotFound=E3=81=AE?= =?UTF-8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E3=82=92=E7=99=BA=E7=94=9F=E3=81=95?= =?UTF-8?q?=E3=81=9B=E3=82=8B=20(#48)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * release 1.0.1 (#37) * add authors * Change title * Add generator descriptions * Add routing descripiton * Add controller templates info * Add view templates info * Add model and migration templates info * Fix Style/WordArray * Add logo * Add h1 * Add br * center * Tweak * Add gem ber * Fix shields * Add other sheilds * Add license * Remove pre sheilds * Add br * tweak * Add setting relation * tweak * Add migrate description * Fix path * Add emoji * Change headers * Bump rails from 6.1.3.2 to 6.1.4 Bumps [rails](https://github.com/rails/rails) from 6.1.3.2 to 6.1.4. - [Release notes](https://github.com/rails/rails/releases) - [Commits](https://github.com/rails/rails/compare/v6.1.3.2...v6.1.4) --- updated-dependencies: - dependency-name: rails dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * tweak * Update readme * アプリ導入の際に必要になった機能の追加 (#36) * アプリ導入の際に必要になった機能の追加 * setupメソッドを複数回呼び出せる様にする * 修正もれの対応 * saml_responseとsign_in時のユーザー検索で別カラムを別々に設定できる様に修正 * バグ修正 Co-authored-by: yonetani * Fix typo Co-authored-by: yonetani Co-authored-by: psyashes <43512814+psyashes@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * gem version up (#47) * saml_settingがない場合にエラーを発生させる様に修正 * version up Co-authored-by: psyashes <43512814+psyashes@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- README.md | 1 + app/controllers/saml/sessions_base_controller.rb | 1 + app/controllers/saml/ssos_base_controller.rb | 1 + lib/sp-rails-saml.rb | 2 ++ lib/sp-rails-saml/version.rb | 2 +- 6 files changed, 7 insertions(+), 2 deletions(-) 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