sp-rails-saml 0.1.0 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +136 -18
  3. data/app/controllers/saml/saml_settings_base_controller.rb +39 -0
  4. data/app/controllers/saml/saml_settings_controller.rb +19 -0
  5. data/app/controllers/saml/sessions_base_controller.rb +26 -0
  6. data/app/controllers/saml/sessions_controller.rb +15 -0
  7. data/app/controllers/saml/ssos_base_controller.rb +35 -0
  8. data/app/controllers/saml/ssos_controller.rb +15 -0
  9. data/app/controllers/saml_base_controller.rb +2 -0
  10. data/lib/generators/sp-rails-saml/config_generator.rb +29 -0
  11. data/lib/generators/sp-rails-saml/controllers_generator.rb +20 -0
  12. data/lib/generators/sp-rails-saml/install_generator.rb +37 -0
  13. data/lib/generators/sp-rails-saml/model_generator.rb +24 -0
  14. data/lib/generators/sp-rails-saml/templates/controllers/saml_settings_controller.rb +19 -0
  15. data/lib/generators/sp-rails-saml/templates/controllers/sessions_controller.rb +15 -0
  16. data/lib/generators/sp-rails-saml/templates/controllers/ssos_controller.rb +15 -0
  17. data/lib/generators/sp-rails-saml/templates/migrations/create_saml_settings.rb +12 -0
  18. data/lib/generators/sp-rails-saml/templates/views/saml/edit.html.erb +11 -0
  19. data/lib/generators/sp-rails-saml/templates/views/saml/show.html.erb +19 -0
  20. data/lib/generators/sp-rails-saml/templates/views/sessions/new.html.erb +8 -0
  21. data/lib/generators/sp-rails-saml/views_generator.rb +22 -0
  22. data/lib/sp-rails-saml/authnrequest.rb +44 -0
  23. data/lib/sp-rails-saml/draw_routes.rb +14 -0
  24. data/lib/sp-rails-saml/metadata.rb +41 -0
  25. data/lib/sp-rails-saml/routes/routes_template.rb +16 -0
  26. data/lib/sp-rails-saml/saml_response.rb +74 -0
  27. data/lib/sp-rails-saml/settings.rb +56 -0
  28. data/lib/sp-rails-saml/version.rb +3 -0
  29. data/lib/sp-rails-saml.rb +37 -0
  30. metadata +46 -18
  31. data/.gitignore +0 -11
  32. data/.rspec +0 -3
  33. data/.travis.yml +0 -6
  34. data/CODE_OF_CONDUCT.md +0 -74
  35. data/Gemfile +0 -7
  36. data/Gemfile.lock +0 -34
  37. data/LICENSE.txt +0 -21
  38. data/Rakefile +0 -6
  39. data/bin/console +0 -14
  40. data/bin/setup +0 -8
  41. data/lib/sp/rails/saml/hello.rb +0 -11
  42. data/lib/sp/rails/saml/version.rb +0 -7
  43. data/lib/sp/rails/saml.rb +0 -11
  44. data/sp-rails-saml.gemspec +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e4ac1206ca21c3f430c9c533f5217fa6d373bc341ee12fcebc88391fc14cfd6
4
- data.tar.gz: f9a593578a7330945ad6e5e32b11b4355d4bf8e772cc9e547d0531bb8345958d
3
+ metadata.gz: 66c550813a06d4b4b058be271d3de67cd638114426c6f431318e8586027fdff2
4
+ data.tar.gz: 12d72ac3aaf78cd347493e959b84b3fe9271dfe43d598b9076f937fd0689797c
5
5
  SHA512:
6
- metadata.gz: a9b2c5c50d0fd2f03551589f1419f6f22efc3cb94b5ce12273c4555bd80d920825354e8a050e863874d283ed8aef007ac3a8a6ce418cb6a7ab163411cd4461b6
7
- data.tar.gz: f83ff70cf56b474cb5ea1198ab53024e6236f2ae0f085d2b4d64ed9185e6e34e2314ecfee36555ea53d9e7a901c71490728ae7edf672a73476e8e2534507db36
6
+ metadata.gz: 4bf53b8a37d1fcead475cfe9c840f5b2572dab7f0a4c19841ffc4b069d20dcb83073532e8d50a36530f57f685bde08b6242a005e7c90c034463f27fa2e02d55a
7
+ data.tar.gz: da3c88943cdafb67bf2c444838e5b4d134dbfddfcce96fbae18050d3e4d101c48d8a12b4e003d8e8f1cbae3205ce5ba3bee0b0fee5ca030e7e6bb73cb02ad84c
data/README.md CHANGED
@@ -1,12 +1,24 @@
1
- # Sp::Rails::Saml
1
+ <h1 align="center">
2
+ <br>
3
+ <img width=60% src="https://github.com/metaps/sp-rails-saml/blob/feature/Update_readme/media/logo.png"></p>
4
+ </h1>
2
5
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sp/rails/saml`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+ <p align="center">
7
+ <br>
8
+ <img alt="Gem version" src="https://img.shields.io/gem/v/sp-rails-saml">
9
+ <img alt="Dependencies" src="https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen.svg">
10
+ <img alt="Contributions welcome" src="https://img.shields.io/badge/contributions-welcome-orange.svg">
11
+ <img alt="License" src="https://img.shields.io/badge/license-MIT-blue.svg">
12
+ </p>
4
13
 
5
- TODO: Delete this and the text above, and describe your gem
14
+ ## :bulb: Introduction
6
15
 
7
- ## Installation
16
+ sp-rails-saml is to be make onelogin ruby-saml easier to use in Ruby on Rails.
8
17
 
9
- Add this line to your application's Gemfile:
18
+ ## :arrow_down: Installation
19
+
20
+ sp-rails-saml works with Rails 6.1 onwards.
21
+ Add the following line to your Gemfile:
10
22
 
11
23
  ```ruby
12
24
  gem 'sp-rails-saml'
@@ -14,31 +26,137 @@ gem 'sp-rails-saml'
14
26
 
15
27
  And then execute:
16
28
 
17
- $ bundle install
29
+ ```
30
+ $ bundle install
31
+ ```
18
32
 
19
33
  Or install it yourself as:
20
34
 
21
- $ gem install sp-rails-saml
35
+ ```
36
+ $ gem install sp-rails-saml
37
+ ```
38
+
39
+ ## :wrench: Getting started
40
+
22
41
 
23
- ## Usage
42
+ ### 1. Generate saml templates
24
43
 
25
- TODO: Write usage instructions here
44
+ You need to run the generator:
26
45
 
27
- ## Development
46
+ ```
47
+ $ rails g sp_rails_saml:install {reference_table_name}
48
+ ```
28
49
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
50
+ At this point, you need to write your account table name in `reference_table_name`.
51
+ This will generate the saml templates for controller, view, model, initializer, etc.
30
52
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
53
 
33
- ## Contributing
54
+ If you need only saml sp initiated and idp initiated template
34
55
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/sp-rails-saml. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/sp-rails-saml/blob/master/CODE_OF_CONDUCT.md).
56
+ ```
57
+ $ rails g sp_rails_saml:install {reference_table_name} --settings false
58
+ ```
36
59
 
60
+ **Controller**
61
+ - [app/controllers/saml/sessions_controller.rb](https://github.com/metaps/sp-rails-saml/blob/develop/lib/generators/sp-rails-saml/templates/controllers/sessions_controller.rb)
62
+ - [app/controllers/saml/ssos_controller.rb](https://github.com/metaps/sp-rails-saml/blob/develop/lib/generators/sp-rails-saml/templates/controllers/sessions_controller.rb)
63
+ - [app/controllers/saml/saml_settings_controller.rb](https://github.com/metaps/sp-rails-saml/blob/develop/lib/generators/sp-rails-saml/templates/controllers/saml_settings_controller.rb)
37
64
 
38
- ## License
65
+ **View**
66
+ - [app/views/saml/sessions/new.html.erb](https://github.com/metaps/sp-rails-saml/blob/develop/lib/generators/sp-rails-saml/templates/views/sessions/new.html.erb)
67
+ - [app/views/saml/saml_settings/show.html.erb](https://github.com/metaps/sp-rails-saml/blob/develop/lib/generators/sp-rails-saml/templates/views/saml/show.html.erb)
68
+ - [app/views/saml/saml_settings/edit.html.erb](https://github.com/metaps/sp-rails-saml/blob/develop/lib/generators/sp-rails-saml/templates/views/saml/edit.html.erb)
39
69
 
40
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
70
+ **Model**
71
+ - [app/models/saml_setting.rb](https://github.com/metaps/sp-rails-saml/blob/develop/spec/fixtures/models/saml_setting.rb)
72
+
73
+ **Migration**
74
+ - [db/migrate/create_saml_settings](https://github.com/metaps/sp-rails-saml/blob/develop/lib/generators/sp-rails-saml/templates/migrations/create_saml_settings.rb)
75
+
76
+ ### 2. Add routing
77
+
78
+ To configure routings for above templates, just add the following line to your `config/routes.rb`:
79
+
80
+ ```ruby
81
+ sp_rails_saml_routes
82
+
83
+ # if you need only saml sp initiated and idp initiated routing
84
+ sp_rails_saml_routes(sso_only: true)
85
+ ```
86
+
87
+ This routing method encompasses the following endpoints:
88
+
89
+ ```
90
+ # metadata url
91
+ GET /saml/sp/metadata/:id
92
+
93
+ # acs url
94
+ POST /saml/sp/consume/:id
95
+
96
+ # saml login page
97
+ GET /saml/sign_in
98
+
99
+ # start saml sp initiated
100
+ POST /saml/sign_in
101
+
102
+ GET /saml/saml_settings
103
+ GET /saml/saml_settings/edit
104
+ PATCH /saml/saml_settings
105
+ ```
41
106
 
42
- ## Code of Conduct
107
+ ### 3. Setting model associations
108
+
109
+ If you associate the reference table and the saml model, you need to add the follwing line to your reference model file:
110
+
111
+ ```ruby
112
+ has_one :saml_setting, dependent: :destroy
113
+ ```
114
+
115
+ ### 4. Migrate
116
+
117
+ You need to run migration command.
118
+
119
+ ```
120
+ $ rails db:migrate
121
+ ```
122
+
123
+ ### 5. Add before action
124
+ You need to add the following line to your `SsosController` and `SessionController`:
125
+
126
+ ```ruby
127
+ skip_before_action :authenticate_user!
128
+ ```
129
+
130
+ ### 6. Add SSO method to ApplicationController
131
+
132
+ You need to add the follwing line to your `ApplicationController`:
133
+
134
+ ```ruby
135
+ def sign_in_with_saml(user)
136
+ # add create session logic
137
+ end
138
+
139
+ # using devise example
140
+ def sign_in_with_saml(user)
141
+ sign_in(:user, user)
142
+ redirect_to root_path
143
+ end
144
+ ```
145
+
146
+ ### 7. Edit your saml credentials
147
+
148
+ Once the above process is complete, you can edit your saml credentials in `/saml/saml_settings/edit`.
149
+
150
+
151
+ ## Check Saml Value
152
+
153
+ sp-rails-saml only validate below list value
154
+
155
+ - SAML Response AudienceRestriction
156
+ - SAML Response Signature
157
+ - SAML Response Destination
158
+
159
+ ## :page_facing_up: License
160
+
161
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
43
162
 
44
- Everyone interacting in the Sp::Rails::Saml project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/sp-rails-saml/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,39 @@
1
+ module Saml
2
+ # Controller to register saml by SP
3
+ class SamlSettingsBaseController < SamlBaseController
4
+ # GET /saml/account_class/:#{account_class}_#{account_find_key}/saml_settings
5
+ def show
6
+ setting = SpRailsSaml::Settings.instance
7
+ account = setting.account_class.find_by!(setting.account_find_key => params["#{setting.account_class.to_s.downcase}_#{setting.account_find_key}"])
8
+ @saml_setting = account.saml_setting.present? ? account.saml_setting : account.build_smal_setting
9
+ end
10
+
11
+ # GET /saml/account_class/:#{account_class}_#{account_find_key}/saml_settings/edit
12
+ def edit
13
+ setting = SpRailsSaml::Settings.instance
14
+ account = setting.account_class.find_by!(setting.account_find_key => params["#{setting.account_class.to_s.downcase}_#{setting.account_find_key}"])
15
+ @saml_setting = account.saml_setting.present? ? account.saml_setting : account.build_smal_setting
16
+ end
17
+
18
+ # PATCH /saml/account_class/:#{account_class}_#{account_find_key}/saml_settings
19
+ def update
20
+ setting = SpRailsSaml::Settings.instance
21
+ account = setting.account_class.find_by!(setting.account_find_key => params["#{setting.account_class.to_s.downcase}_#{setting.account_find_key}"])
22
+ @saml_setting = account.saml_setting.present? ? account.saml_setting : account.build_smal_setting
23
+
24
+ @saml_setting.assign_attributes(saml_setting_params)
25
+
26
+ if @saml_setting.save
27
+ redirect_to action: :show
28
+ else
29
+ render :edit
30
+ end
31
+ end
32
+
33
+ private
34
+
35
+ def saml_setting_params
36
+ params.require(:saml_setting).permit(:idp_entity_id, :idp_sso_url, :idp_cert, :login_type)
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,19 @@
1
+ module Saml
2
+ # Controller to register saml by SP
3
+ class SamlSettingsController < SamlSettingsBaseController
4
+ # GET /saml/account_class/:#{account_class}_#{account_find_key}/saml_settings
5
+ # def show
6
+ # super
7
+ # end
8
+
9
+ # GET /saml/account_class/:#{account_class}_#{account_find_key}/saml_settings/edit
10
+ # def edit
11
+ # super
12
+ # end
13
+
14
+ # PATCH /saml/account_class/:#{account_class}_#{account_find_key}/saml_settings
15
+ # def update
16
+ # super
17
+ # end
18
+ end
19
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Saml
4
+ class SessionsBaseController < SamlBaseController
5
+ # GET /saml/sign_in
6
+ def new; end
7
+
8
+ # POST /saml/sign_in
9
+ def create
10
+ setting = SpRailsSaml::Settings.instance
11
+ user = setting.user_class.find_by!(setting.user_find_key => params[:email])
12
+ account = user.send(setting.account_class.to_s.downcase.to_sym)
13
+
14
+ raise SpRailsSaml::SamlSettingNotFound if account.saml_setting.blank?
15
+ raise SpRailsSaml::SamlLoginForbidden if account.saml_setting.password_only?
16
+
17
+ if user.blank?
18
+ redirect_to saml_sign_in_path, alert: 'failed to login'
19
+ return
20
+ end
21
+
22
+ authnrequest = SpRailsSaml::Authnrequest.new(account.saml_setting).to_url
23
+ redirect_to(authnrequest)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Saml
4
+ class SessionsController < SessionsBaseController
5
+ # GET /saml/sign_in
6
+ # def new
7
+ # super
8
+ # end
9
+
10
+ # POST /saml/sign_in
11
+ # def create
12
+ # super
13
+ # end
14
+ end
15
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Saml
4
+ class SsosBaseController < SamlBaseController
5
+ skip_forgery_protection only: %w[consume]
6
+
7
+ # POST /saml/sp/consume/:id
8
+ def consume
9
+ setting = SpRailsSaml::Settings.instance
10
+ account = setting.account_class.find_by!(setting.account_find_key => params[setting.account_find_key])
11
+
12
+ raise SpRailsSaml::SamlSettingNotFound if account.saml_setting.blank?
13
+ raise SpRailsSaml::SamlLoginForbidden if account.saml_setting.password_only?
14
+
15
+ saml_setting = account.saml_setting
16
+ saml_response = SpRailsSaml::SamlResponse.new(params[:SAMLResponse], saml_setting)
17
+
18
+ raise SpRailsSaml::SamlResponseInvalid, saml_response.errors unless saml_response.valid?
19
+
20
+ user = setting.user_class.find_by(setting.saml_response_user_find_key => saml_response.name_id, setting.account_class.to_s.downcase => account)
21
+
22
+ raise SpRailsSaml::LoginUserNotFound if user.blank?
23
+
24
+ sign_in_with_saml(user)
25
+ end
26
+
27
+ # GET /saml/sp/metadata/:id
28
+ def metadata
29
+ setting = SpRailsSaml::Settings.instance
30
+ account = setting.account_class.find_by!(setting.account_find_key => params[setting.account_find_key])
31
+ metadata = SpRailsSaml::Metadata.new(account: account)
32
+ render xml: metadata.generate
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Saml
4
+ class SsosController < SsosBaseController
5
+ # POST /saml/sp/consume/:id
6
+ # def consume
7
+ # super
8
+ # end
9
+
10
+ # GET /saml/sp/metadata/:id
11
+ # def metadata
12
+ # super
13
+ # end
14
+ end
15
+ end
@@ -0,0 +1,2 @@
1
+ class SamlBaseController < ApplicationController
2
+ end
@@ -0,0 +1,29 @@
1
+ require 'rails/generators'
2
+
3
+ module SpRailsSaml
4
+ # Initializer file Generator.
5
+ #
6
+ class ConfigGenerator < Rails::Generators::Base
7
+ desc 'Generate sp-rails-saml.rb to config/initializers'
8
+
9
+ def create_initializer_file
10
+ create_file 'config/initializers/sp-rails-saml.rb', default_initializer
11
+ end
12
+
13
+ private
14
+
15
+ def default_initializer
16
+ <<~RUBY
17
+ Rails.configuration.to_prepare do
18
+ SpRailsSaml::Settings.setup do |config|
19
+ config.name_identifier_format = 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'
20
+ config.authn_context = 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport'
21
+ config.authn_context_comparison = 'exact'
22
+ config.user_class = User
23
+ config.account_class = Account
24
+ end
25
+ end
26
+ RUBY
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,20 @@
1
+ require 'rails/generators'
2
+
3
+ module SpRailsSaml
4
+ class ControllersGenerator < Rails::Generators::Base
5
+ source_root File.expand_path('templates', __dir__)
6
+
7
+ desc 'Generate controller files.'
8
+
9
+ class_option :settings, type: 'boolean', default: true
10
+
11
+ def create_session_controller
12
+ copy_file 'controllers/sessions_controller.rb', 'app/controllers/saml/sessions_controller.rb'
13
+ copy_file 'controllers/ssos_controller.rb', 'app/controllers/saml/ssos_controller.rb'
14
+ end
15
+
16
+ def create_saml_setting_controller
17
+ copy_file 'controllers/saml_settings_controller.rb', 'app/controllers/saml/saml_settings_controller.rb' if options['settings']
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,37 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/active_record'
3
+
4
+ module SpRailsSaml
5
+ class InstallGenerator < ActiveRecord::Generators::Base
6
+ include Rails::Generators::Migration
7
+
8
+ source_root File.expand_path('templates', __dir__)
9
+
10
+ desc 'Generate sp-rails-saml files.'
11
+
12
+ class_option :settings, type: 'boolean', default: true
13
+
14
+ def install_all
15
+ generate "sp_rails_saml:views --settings #{options['settings']}"
16
+ generate "sp_rails_saml:controllers --settings #{options['settings']}"
17
+ generate "sp_rails_saml:model #{table_name}"
18
+ generate 'sp_rails_saml:config'
19
+ end
20
+
21
+ private
22
+
23
+ def default_initializer
24
+ <<~RUBY
25
+ Rails.configuration.to_prepare do
26
+ SpRailsSaml::Settings.setup do |config|
27
+ config.name_identifier_format = 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'
28
+ config.authn_context = 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport'
29
+ config.authn_context_comparison = 'exact'
30
+ config.user_class = User
31
+ config.account_class = Account
32
+ end
33
+ end
34
+ RUBY
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,24 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/active_record'
3
+
4
+ module SpRailsSaml
5
+ class ModelGenerator < ActiveRecord::Generators::Base
6
+ include Rails::Generators::Migration
7
+
8
+ source_root File.expand_path('templates', __dir__)
9
+
10
+ def create_initializer_file
11
+ migration_template 'migrations/create_saml_settings.rb', 'db/migrate/create_saml_settings.rb'
12
+ end
13
+
14
+ def copy_model
15
+ create_file 'app/models/saml_setting.rb', <<~FILE
16
+ class SamlSetting < ApplicationRecord
17
+ belongs_to :#{table_name.singularize}
18
+
19
+ enum login_type: { password_only: 0, saml_only: 1, saml_and_password: 2 }
20
+ end
21
+ FILE
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,19 @@
1
+ module Saml
2
+ # Controller to register saml by SP
3
+ class SamlSettingsController < SamlSettingsBaseController
4
+ # GET /saml/account_class/:#{account_class}_#{account_find_key}/saml_settings
5
+ # def show
6
+ # super
7
+ # end
8
+
9
+ # GET /saml/account_class/:#{account_class}_#{account_find_key}/saml_settings/edit
10
+ # def edit
11
+ # super
12
+ # end
13
+
14
+ # PATCH /saml/account_class/:#{account_class}_#{account_find_key}/saml_settings
15
+ # def update
16
+ # super
17
+ # end
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Saml
4
+ class SessionsController < SessionsBaseController
5
+ # GET /saml/sign_in
6
+ # def new
7
+ # super
8
+ # end
9
+
10
+ # POST /saml/sign_in
11
+ # def create
12
+ # super
13
+ # end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Saml
4
+ class SsosController < SsosBaseController
5
+ # POST /saml/sso/:id
6
+ # def consume
7
+ # super
8
+ # end
9
+
10
+ # GET /saml/metadata/:id
11
+ # def metadata
12
+ # super
13
+ # end
14
+ end
15
+ end
@@ -0,0 +1,12 @@
1
+ class CreateSamlSettings < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :saml_settings, comment: 'Saml settings table for sp' do |t|
4
+ t.references :<%= table_name.singularize %>, foreign_key: true, null: false, comment: 'For company account model'
5
+ t.string :idp_sso_url, comment: 'URL for Idp SSO'
6
+ t.text :idp_cert, comment: 'X.509 Certification of Idp'
7
+ t.string :idp_entity_id, comment: 'Entity ID of Idp'
8
+ t.integer :login_type, limit: 1, default: 0, null: false, comment: 'login_type(0: password_only, 1: saml_only, 2: password_and_saml)'
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ <%= form_with model: @saml_setting, url: saml_account_saml_settings_path, method: :patch, local: true do |f| %>
2
+ <%= f.label :idp_sso_url %>
3
+ <%= f.text_field :idp_sso_url %>
4
+ <%= f.label :idp_entity_id %>
5
+ <%= f.text_field :idp_entity_id %>
6
+ <%= f.label :idp_cert %>
7
+ <%= f.text_field :idp_cert %>
8
+ <%= f.label :login_type %>
9
+ <%= f.select :login_type, SamlSetting.login_types.keys.to_a %>
10
+ <%= f.submit %>
11
+ <% end %>
@@ -0,0 +1,19 @@
1
+ <p>
2
+ <strong>IdP Entity ID:</strong>
3
+ <%= @saml_setting.idp_entity_id %>
4
+ </p>
5
+
6
+ <p>
7
+ <strong>IdP SSO URL:</strong>
8
+ <%= @saml_setting.idp_sso_url %>
9
+ </p>
10
+
11
+ <p>
12
+ <strong>IdP x509 Certificate:</strong>
13
+ <%= @saml_setting.idp_cert %>
14
+ </p>
15
+
16
+ <p>
17
+ <strong>Login Type</strong>
18
+ <%= @saml_setting.login_type %>
19
+ </p>
@@ -0,0 +1,8 @@
1
+ <strong style='color: red;'><%= flash[:alert] %></strong>
2
+
3
+ <%= form_with url: saml_sign_in_path, local: true do |f| %>
4
+ <%= f.label :email %>
5
+ <%= f.text_field :email %>
6
+
7
+ <%= f.submit %>
8
+ <% end %>
@@ -0,0 +1,22 @@
1
+ require 'rails/generators'
2
+
3
+ module SpRailsSaml
4
+ class ViewsGenerator < Rails::Generators::Base
5
+ source_root File.expand_path('templates', __dir__)
6
+
7
+ desc 'Generate view files.'
8
+
9
+ class_option :settings, type: 'boolean', default: true
10
+
11
+ def create_session_view
12
+ copy_file 'views/sessions/new.html.erb', 'app/views/saml/sessions/new.html.erb'
13
+ end
14
+
15
+ def create_saml_setting_view
16
+ return unless options['settings']
17
+
18
+ copy_file 'views/saml/edit.html.erb', 'app/views/saml/saml_settings/edit.html.erb'
19
+ copy_file 'views/saml/show.html.erb', 'app/views/saml/saml_settings/show.html.erb'
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,44 @@
1
+ module SpRailsSaml
2
+ # SAML2 Authentication.
3
+ #
4
+ class Authnrequest
5
+ # url_forを使用するためにincludeしている
6
+ # テスト時にエラーが発生するので定義されてない場合はスキップしたくdefined?(ActionView::Helpers)の場合のみinclude
7
+ if defined?(ActionView::Helpers)
8
+ include ActionView::Helpers
9
+ include ActionDispatch::Routing
10
+ include Rails.application.routes.url_helpers
11
+ end
12
+
13
+ def initialize(saml_setting)
14
+ @saml_setting = saml_setting
15
+ end
16
+
17
+ def to_url
18
+ request = OneLogin::RubySaml::Authrequest.new
19
+ request.create(ruby_saml_settings)
20
+ end
21
+
22
+ private
23
+
24
+ def ruby_saml_settings
25
+ settings = OneLogin::RubySaml::Settings.new
26
+
27
+ sp_rails_saml_setting = SpRailsSaml::Settings.instance
28
+
29
+ settings.assertion_consumer_service_url = saml_sp_consume_url(
30
+ @saml_setting.send(sp_rails_saml_setting.account_class.to_s.downcase.to_sym).send(sp_rails_saml_setting.account_find_key)
31
+ )
32
+ settings.sp_entity_id = saml_sp_metadata_url(
33
+ @saml_setting.send(sp_rails_saml_setting.account_class.to_s.downcase.to_sym).send(sp_rails_saml_setting.account_find_key)
34
+ )
35
+ settings.name_identifier_format = sp_rails_saml_setting.name_identifier_format
36
+ settings.authn_context = sp_rails_saml_setting.authn_context
37
+ settings.authn_context_comparison = sp_rails_saml_setting.authn_context_comparison
38
+ settings.idp_entity_id = @saml_setting.idp_entity_id
39
+ settings.idp_sso_service_url = @saml_setting.idp_sso_url
40
+ settings.compress_request = SpRailsSaml::Settings::RUBY_SAML_DEFAULT_SETTINGS[:compress_request]
41
+ settings
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,14 @@
1
+ require 'action_dispatch'
2
+
3
+ module DrawRoute
4
+ RoutesNotFound = Class.new(StandardError)
5
+
6
+ def sp_rails_saml_routes(sso_only: false)
7
+ @sso_only = sso_only
8
+ path = File.expand_path('routes/routes_template.rb', __dir__)
9
+ instance_eval(File.read(path))
10
+ true
11
+ end
12
+ end
13
+
14
+ ActionDispatch::Routing::Mapper.prepend DrawRoute
@@ -0,0 +1,41 @@
1
+ module SpRailsSaml
2
+ class Metadata
3
+ # url_forを使用するためにincludeしている
4
+ # テスト時にエラーが発生するので定義されてない場合はスキップしたくdefined?(ActionView::Helpers)の場合のみinclude
5
+ if defined?(ActionView::Helpers)
6
+ include ActionView::Helpers
7
+ include ActionDispatch::Routing
8
+ include Rails.application.routes.url_helpers
9
+ end
10
+
11
+ def initialize(account:)
12
+ @account = account
13
+ end
14
+
15
+ def generate
16
+ metadata = OneLogin::RubySaml::Metadata.new
17
+ metadata.generate(ruby_saml_settings)
18
+ end
19
+
20
+ private
21
+
22
+ def required_value_is_set?
23
+ SpRailsSaml::Settings.name_identifier_format
24
+ end
25
+
26
+ def ruby_saml_settings
27
+ raise SettingValidationError, 'lack of required setting value' unless required_value_is_set?
28
+
29
+ settings = OneLogin::RubySaml::Settings.new
30
+
31
+ sp_rails_saml_setting = SpRailsSaml::Settings.instance
32
+
33
+ settings.assertion_consumer_service_url = saml_sp_consume_url(@account.send(sp_rails_saml_setting.account_find_key))
34
+ settings.sp_entity_id = saml_sp_metadata_url(@account.send(sp_rails_saml_setting.account_find_key))
35
+ settings.name_identifier_format = sp_rails_saml_setting.name_identifier_format
36
+ settings.security[:want_assertions_signed] =
37
+ SpRailsSaml::Settings::RUBY_SAML_DEFAULT_SETTINGS[:want_assertions_signed]
38
+ settings
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,16 @@
1
+ namespace :saml do
2
+ # Session
3
+ get 'sign_in', to: 'sessions#new'
4
+ post 'sign_in', to: 'sessions#create'
5
+
6
+ unless @sso_only
7
+ # Saml settings for SP
8
+ resources SpRailsSaml::Settings.instance.account_class.to_s.downcase.to_sym, only: [], param: SpRailsSaml::Settings.instance.account_find_key do
9
+ resource :saml_settings, only: %i[show edit update]
10
+ end
11
+ end
12
+
13
+ # SSO
14
+ post "sp/consume/:#{SpRailsSaml::Settings.instance.account_find_key}", to: 'ssos#consume', as: :sp_consume
15
+ get "sp/metadata/:#{SpRailsSaml::Settings.instance.account_find_key}", to: 'ssos#metadata', as: :sp_metadata
16
+ end
@@ -0,0 +1,74 @@
1
+ module SpRailsSaml
2
+ # SAML2 Authentication Response.
3
+ #
4
+ class SamlResponse
5
+ # url_forを使用するためにincludeしている
6
+ # テスト時にエラーが発生するので定義されてない場合はスキップしたくdefined?(ActionView::Helpers)の場合のみinclude
7
+ if defined?(ActionView::Helpers)
8
+ include ActionView::Helpers
9
+ include ActionDispatch::Routing
10
+ include Rails.application.routes.url_helpers
11
+ end
12
+
13
+ def initialize(saml_response, saml_setting)
14
+ @saml_setting = saml_setting
15
+ @saml_response = saml_response
16
+ end
17
+
18
+ def response
19
+ return @response if @response.present?
20
+
21
+ @response = OneLogin::RubySaml::Response.new(
22
+ @saml_response,
23
+ settings: ruby_saml_settings,
24
+ skip_subject_confirmation: SpRailsSaml::Settings::RUBY_SAML_DEFAULT_SETTINGS[:skip_subject_confirmation],
25
+ skip_conditions: SpRailsSaml::Settings::RUBY_SAML_DEFAULT_SETTINGS[:skip_conditions],
26
+ skip_destination: SpRailsSaml::Settings::RUBY_SAML_DEFAULT_SETTINGS[:skip_destination]
27
+ )
28
+ end
29
+
30
+ def valid?
31
+ response.is_valid?
32
+ end
33
+
34
+ def name_id
35
+ response.name_id
36
+ end
37
+
38
+ def name_id_format
39
+ response.name_id_format
40
+ end
41
+
42
+ def errors
43
+ response.errors
44
+ end
45
+
46
+ private
47
+
48
+ def required_value_is_set?
49
+ # ruby-samlの仕様上、idp_entity_idが空だとissuer = idp_entity_idの検証が行われないため、idp_entity_idがblankの検証は必須
50
+ @saml_setting.idp_cert.present? && @saml_setting.idp_entity_id.present?
51
+ end
52
+
53
+ def ruby_saml_settings
54
+ raise SettingValidationError, 'lack of required setting value' unless required_value_is_set?
55
+
56
+ settings = OneLogin::RubySaml::Settings.new
57
+
58
+ sp_rails_saml_setting = SpRailsSaml::Settings.instance
59
+
60
+ settings.assertion_consumer_service_url = saml_sp_consume_url(
61
+ @saml_setting.send(sp_rails_saml_setting.account_class.to_s.downcase.to_sym).send(sp_rails_saml_setting.account_find_key)
62
+ )
63
+ settings.sp_entity_id = saml_sp_metadata_url(
64
+ @saml_setting.send(sp_rails_saml_setting.account_class.to_s.downcase.to_sym).send(sp_rails_saml_setting.account_find_key)
65
+ )
66
+ settings.idp_cert = @saml_setting.idp_cert
67
+ settings.idp_entity_id = @saml_setting.idp_entity_id
68
+ settings.security[:want_assertions_signed] =
69
+ SpRailsSaml::Settings::RUBY_SAML_DEFAULT_SETTINGS[:want_assertions_signed]
70
+
71
+ settings
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,56 @@
1
+ require 'singleton'
2
+
3
+ module SpRailsSaml
4
+ # SAML2 settings for initializer.
5
+ #
6
+ class Settings
7
+ include Singleton
8
+
9
+ RUBY_SAML_DEFAULT_SETTINGS = {
10
+ compress_request: true,
11
+ skip_subject_confirmation: true,
12
+ skip_conditions: true,
13
+ skip_destination: false,
14
+ want_assertions_signed: true,
15
+ account_find_key: :id,
16
+ user_find_key: :email,
17
+ saml_response_user_find_key: :email
18
+ }.freeze
19
+
20
+ attr_reader :name_identifier_format,
21
+ :authn_context,
22
+ :authn_context_comparison,
23
+ :user_class,
24
+ :account_class,
25
+ :user_find_key,
26
+ :account_find_key,
27
+ :saml_response_user_find_key
28
+
29
+ class << self
30
+ attr_accessor :name_identifier_format,
31
+ :authn_context,
32
+ :authn_context_comparison,
33
+ :user_class,
34
+ :account_class,
35
+ :user_find_key,
36
+ :account_find_key,
37
+ :saml_response_user_find_key
38
+
39
+ def setup
40
+ yield self
41
+
42
+ setting = SpRailsSaml::Settings.instance
43
+
44
+ setting.instance_variable_set(:@name_identifier_format, SpRailsSaml::Settings.name_identifier_format)
45
+ setting.instance_variable_set(:@authn_context, SpRailsSaml::Settings.authn_context)
46
+ setting.instance_variable_set(:@authn_context_comparison, SpRailsSaml::Settings.authn_context_comparison)
47
+ setting.instance_variable_set(:@user_class, SpRailsSaml::Settings.user_class)
48
+ setting.instance_variable_set(:@account_class, SpRailsSaml::Settings.account_class)
49
+ setting.instance_variable_set(:@user_find_key, SpRailsSaml::Settings.user_find_key || RUBY_SAML_DEFAULT_SETTINGS[:user_find_key])
50
+ setting.instance_variable_set(:@account_find_key, SpRailsSaml::Settings.account_find_key || RUBY_SAML_DEFAULT_SETTINGS[:account_find_key])
51
+ setting.instance_variable_set(:@saml_response_user_find_key,
52
+ SpRailsSaml::Settings.saml_response_user_find_key || RUBY_SAML_DEFAULT_SETTINGS[:saml_response_user_find_key])
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,3 @@
1
+ module SpRailsSaml
2
+ VERSION = '1.0.3'.freeze
3
+ end
@@ -0,0 +1,37 @@
1
+ require 'ruby-saml'
2
+ require 'sp-rails-saml/settings'
3
+ require 'sp-rails-saml/draw_routes'
4
+ require 'generators/sp-rails-saml/config_generator'
5
+ require 'generators/sp-rails-saml/controllers_generator'
6
+ require 'generators/sp-rails-saml/views_generator'
7
+ require 'generators/sp-rails-saml/model_generator'
8
+ require 'generators/sp-rails-saml/install_generator'
9
+
10
+ autoload :SamlBaseController, File.expand_path('../app/controllers/saml_base_controller', __dir__)
11
+
12
+ module SpRailsSaml
13
+ class Error < StandardError; end
14
+
15
+ class SettingValidationError < Error; end
16
+
17
+ class SamlLoginForbidden < Error; end
18
+
19
+ class LoginUserNotFound < Error; end
20
+
21
+ class SamlResponseInvalid < Error; end
22
+
23
+ class SamlSettingNotFound < Error; end
24
+
25
+ autoload :Authnrequest, File.expand_path('./sp-rails-saml/authnrequest', __dir__)
26
+ autoload :SamlResponse, File.expand_path('./sp-rails-saml/saml_response', __dir__)
27
+ autoload :Metadata, File.expand_path('./sp-rails-saml/metadata', __dir__)
28
+ end
29
+
30
+ module Saml
31
+ autoload :SessionsController, File.expand_path('../app/controllers/saml/sessions_controller', __dir__)
32
+ autoload :SessionsBaseController, File.expand_path('../app/controllers/saml/sessions_base_controller', __dir__)
33
+ autoload :SamlSettingsBaseController, File.expand_path('../app/controllers/saml/saml_settings_base_controller', __dir__)
34
+ autoload :SamlSettingsController, File.expand_path('../app/controllers/saml/saml_settings_controller', __dir__)
35
+ autoload :SsosController, File.expand_path('../app/controllers/saml/ssos_controller', __dir__)
36
+ autoload :SsosBaseController, File.expand_path('../app/controllers/saml/ssos_base_controller', __dir__)
37
+ end
metadata CHANGED
@@ -1,15 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sp-rails-saml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - psyashes
8
+ - sibakeny
8
9
  autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
- date: 2021-04-30 00:00:00.000000000 Z
12
- dependencies: []
12
+ date: 2021-11-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: ruby-saml
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
13
28
  description: This gem is to be make onelogin ruby-saml easier to use in Ruby on Rails.
14
29
  email:
15
30
  - 43512814+psyashes@users.noreply.github.com
@@ -17,21 +32,34 @@ executables: []
17
32
  extensions: []
18
33
  extra_rdoc_files: []
19
34
  files:
20
- - ".gitignore"
21
- - ".rspec"
22
- - ".travis.yml"
23
- - CODE_OF_CONDUCT.md
24
- - Gemfile
25
- - Gemfile.lock
26
- - LICENSE.txt
27
35
  - README.md
28
- - Rakefile
29
- - bin/console
30
- - bin/setup
31
- - lib/sp/rails/saml.rb
32
- - lib/sp/rails/saml/hello.rb
33
- - lib/sp/rails/saml/version.rb
34
- - sp-rails-saml.gemspec
36
+ - app/controllers/saml/saml_settings_base_controller.rb
37
+ - app/controllers/saml/saml_settings_controller.rb
38
+ - app/controllers/saml/sessions_base_controller.rb
39
+ - app/controllers/saml/sessions_controller.rb
40
+ - app/controllers/saml/ssos_base_controller.rb
41
+ - app/controllers/saml/ssos_controller.rb
42
+ - app/controllers/saml_base_controller.rb
43
+ - lib/generators/sp-rails-saml/config_generator.rb
44
+ - lib/generators/sp-rails-saml/controllers_generator.rb
45
+ - lib/generators/sp-rails-saml/install_generator.rb
46
+ - lib/generators/sp-rails-saml/model_generator.rb
47
+ - lib/generators/sp-rails-saml/templates/controllers/saml_settings_controller.rb
48
+ - lib/generators/sp-rails-saml/templates/controllers/sessions_controller.rb
49
+ - lib/generators/sp-rails-saml/templates/controllers/ssos_controller.rb
50
+ - lib/generators/sp-rails-saml/templates/migrations/create_saml_settings.rb
51
+ - lib/generators/sp-rails-saml/templates/views/saml/edit.html.erb
52
+ - lib/generators/sp-rails-saml/templates/views/saml/show.html.erb
53
+ - lib/generators/sp-rails-saml/templates/views/sessions/new.html.erb
54
+ - lib/generators/sp-rails-saml/views_generator.rb
55
+ - lib/sp-rails-saml.rb
56
+ - lib/sp-rails-saml/authnrequest.rb
57
+ - lib/sp-rails-saml/draw_routes.rb
58
+ - lib/sp-rails-saml/metadata.rb
59
+ - lib/sp-rails-saml/routes/routes_template.rb
60
+ - lib/sp-rails-saml/saml_response.rb
61
+ - lib/sp-rails-saml/settings.rb
62
+ - lib/sp-rails-saml/version.rb
35
63
  homepage: https://github.com/metaps/sp-rails-saml
36
64
  licenses:
37
65
  - MIT
@@ -48,7 +76,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
48
76
  requirements:
49
77
  - - ">="
50
78
  - !ruby/object:Gem::Version
51
- version: 2.3.0
79
+ version: 2.5.0
52
80
  required_rubygems_version: !ruby/object:Gem::Requirement
53
81
  requirements:
54
82
  - - ">="
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.6.5
6
- before_install: gem install bundler -v 2.1.4
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at 43512814+psyashes@users.noreply.github.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [https://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: https://contributor-covenant.org
74
- [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,7 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in sp-rails-saml.gemspec
4
- gemspec
5
-
6
- gem "rake", "~> 12.0"
7
- gem "rspec", "~> 3.0"
data/Gemfile.lock DELETED
@@ -1,34 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- sp-rails-saml (0.1.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- diff-lcs (1.4.4)
10
- rake (12.3.3)
11
- rspec (3.10.0)
12
- rspec-core (~> 3.10.0)
13
- rspec-expectations (~> 3.10.0)
14
- rspec-mocks (~> 3.10.0)
15
- rspec-core (3.10.1)
16
- rspec-support (~> 3.10.0)
17
- rspec-expectations (3.10.1)
18
- diff-lcs (>= 1.2.0, < 2.0)
19
- rspec-support (~> 3.10.0)
20
- rspec-mocks (3.10.2)
21
- diff-lcs (>= 1.2.0, < 2.0)
22
- rspec-support (~> 3.10.0)
23
- rspec-support (3.10.2)
24
-
25
- PLATFORMS
26
- ruby
27
-
28
- DEPENDENCIES
29
- rake (~> 12.0)
30
- rspec (~> 3.0)
31
- sp-rails-saml!
32
-
33
- BUNDLED WITH
34
- 2.1.4
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2021 psyashes
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "sp/rails/saml"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,11 +0,0 @@
1
- module Sp
2
- module Rails
3
- module Saml
4
- class Greet
5
- def self.say(word)
6
- word + ', hello.'
7
- end
8
- end
9
- end
10
- end
11
- end
@@ -1,7 +0,0 @@
1
- module Sp
2
- module Rails
3
- module Saml
4
- VERSION = "0.1.0"
5
- end
6
- end
7
- end
data/lib/sp/rails/saml.rb DELETED
@@ -1,11 +0,0 @@
1
- require "sp/rails/saml/version"
2
- require "sp/rails/saml/hello"
3
-
4
- module Sp
5
- module Rails
6
- module Saml
7
- class Error < StandardError; end
8
- # Your code goes here...
9
- end
10
- end
11
- end
@@ -1,29 +0,0 @@
1
- require_relative 'lib/sp/rails/saml/version'
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = "sp-rails-saml"
5
- spec.version = Sp::Rails::Saml::VERSION
6
- spec.authors = ["psyashes"]
7
- spec.email = ["43512814+psyashes@users.noreply.github.com"]
8
-
9
- spec.summary = %q{Simple sp saml for rails.}
10
- spec.description = %q{This gem is to be make onelogin ruby-saml easier to use in Ruby on Rails.}
11
- spec.homepage = "https://github.com/metaps/sp-rails-saml"
12
- spec.license = "MIT"
13
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
-
15
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
16
-
17
- spec.metadata["homepage_uri"] = spec.homepage
18
- spec.metadata["source_code_uri"] = "https://github.com/metaps/sp-rails-saml"
19
- spec.metadata["changelog_uri"] = "https://github.com/metaps/sp-rails-saml"
20
-
21
- # Specify which files should be added to the gem when it is released.
22
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
24
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
- end
26
- spec.bindir = "exe"
27
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
- spec.require_paths = ["lib"]
29
- end