devise_saml_authenticatable 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23fdb33308c8d98c67e3fe7d5654bfcdc7afe40c2276822a3936785ed29e15ea
4
- data.tar.gz: 11569096a198fb51b129d82eaab03a870c3c8983b7dfe88aa0bcc53f1f4fa2ce
3
+ metadata.gz: c2b6dd7d4f718cf0df20aff218f90f1eac720279e4ff5afe6aedef20f84a14fd
4
+ data.tar.gz: 5efc5fa9d89ee10eb6328261b6b870ce580dbe7cd48cedbe8dd609786c5c9f84
5
5
  SHA512:
6
- metadata.gz: 605f76c64fa08cb1ec9f26224af74ccec6c8d85b507899e6f61f1c65e8ada6b7672b6b9398d78fcfbd075d8c7754e824e0a8ed822001b124a6658e862b72203c
7
- data.tar.gz: 0f8bb1f715288790cffb1b20214d6c0da71c546aaa09e626183b86d1274c5d6e3aae90dea8af6c4d572c6f2131360c948203a9a14706ed7414c685833eac173d
6
+ metadata.gz: 70c0b6c4e5f6ec2b7f4a421c898c493cb34aef837c119e126d1b557640f685c1c35ad7cddaf94de3598601fe691563fa2984297010b4ac96f539609c8fa55f95
7
+ data.tar.gz: ca3d854ab1bd6b84d3a7d2225feb926f9fbc2d6df5c546c975d5773e8bdd8254d5ce544dd08f6c32a0db29e15f9f4aa3bbc38bee1dbdf491d9e92826b00c760b
@@ -12,57 +12,33 @@ jobs:
12
12
  fail-fast: false
13
13
  matrix:
14
14
  ruby:
15
+ - "3.1"
16
+ - "3.0"
15
17
  - "2.7"
16
18
  - "2.6"
17
- - "2.5"
18
- - "2.4"
19
- - "2.3"
20
19
  gemfile:
21
20
  - Gemfile
21
+ - spec/support/Gemfile.rails6.1
22
22
  - spec/support/Gemfile.rails6
23
23
  - spec/support/Gemfile.rails5.2
24
- - spec/support/Gemfile.rails5.1
25
- - spec/support/Gemfile.rails5
26
24
  bundler:
27
25
  - "2"
28
26
  exclude:
29
- - ruby: "2.3"
27
+ - ruby: "2.6"
30
28
  gemfile: Gemfile
31
29
  bundler: "2"
32
- - ruby: "2.3"
30
+ - ruby: "3.0"
31
+ gemfile: spec/support/Gemfile.rails5.2
32
+ bundler: "2"
33
+ - ruby: "3.0"
33
34
  gemfile: spec/support/Gemfile.rails6
34
35
  bundler: "2"
35
- - ruby: "2.4"
36
- gemfile: Gemfile
36
+ - ruby: "3.1"
37
+ gemfile: spec/support/Gemfile.rails5.2
37
38
  bundler: "2"
38
- - ruby: "2.4"
39
+ - ruby: "3.1"
39
40
  gemfile: spec/support/Gemfile.rails6
40
41
  bundler: "2"
41
- include:
42
- - ruby: "2.5"
43
- gemfile: spec/support/Gemfile.rails4
44
- bundler: "1"
45
- - ruby: "2.4"
46
- gemfile: spec/support/Gemfile.rails4
47
- bundler: "1"
48
- - ruby: "2.3"
49
- gemfile: spec/support/Gemfile.rails4
50
- bundler: "1"
51
- - ruby: "2.2"
52
- gemfile: spec/support/Gemfile.rails5.1
53
- bundler: "1"
54
- - ruby: "2.2"
55
- gemfile: spec/support/Gemfile.rails5
56
- bundler: "1"
57
- - ruby: "2.2"
58
- gemfile: spec/support/Gemfile.rails4
59
- bundler: "1"
60
- - ruby: "2.1"
61
- gemfile: spec/support/Gemfile.rails4
62
- bundler: "1"
63
- - ruby: "2.0"
64
- gemfile: spec/support/Gemfile.rails4
65
- bundler: "1"
66
42
  runs-on: ubuntu-latest
67
43
  env:
68
44
  BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
data/.gitignore CHANGED
@@ -13,4 +13,5 @@ lib/bundler/man
13
13
  pkg
14
14
  rdoc
15
15
  spec/reports
16
+ spec/support/bin/*
16
17
  tmp
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.1.0
data/Gemfile CHANGED
@@ -6,9 +6,19 @@ gemspec
6
6
  group :test do
7
7
  gem 'rake'
8
8
  gem 'rspec', '~> 3.0'
9
- gem 'rails', '~> 6.0'
9
+ gem 'rails', '~> 7.0.0'
10
10
  gem 'rspec-rails'
11
11
  gem 'sqlite3', '~> 1.4.0'
12
12
  gem 'capybara'
13
- gem 'poltergeist'
13
+ gem 'selenium-webdriver'
14
+
15
+ if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new("3.0")
16
+ gem 'webrick'
17
+ end
18
+
19
+ if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new("3.1")
20
+ gem 'net-smtp', require: false
21
+ gem 'net-imap', require: false
22
+ gem 'net-pop', require: false
23
+ end
14
24
  end
data/README.md CHANGED
@@ -85,8 +85,8 @@ In `config/initializers/devise.rb`:
85
85
  # for the user's session to facilitate an IDP initiated logout request.
86
86
  config.saml_session_index_key = :session_index
87
87
 
88
- # You can set this value to use Subject or SAML assertation as info to which email will be compared.
89
- # If you don't set it then email will be extracted from SAML assertation attributes.
88
+ # You can set this value to use Subject or SAML assertion as info to which email will be compared.
89
+ # If you don't set it then email will be extracted from SAML assertion attributes.
90
90
  config.saml_use_subject = true
91
91
 
92
92
  # You can support multiple IdPs by setting this value to the name of a class that implements a ::settings method
@@ -97,9 +97,9 @@ In `config/initializers/devise.rb`:
97
97
  # by setting this to the name of a custom reader class, or use the default.
98
98
  # config.idp_entity_id_reader = "DeviseSamlAuthenticatable::DefaultIdpEntityIdReader"
99
99
 
100
- # You can set a handler object that takes the response for a failed SAML request and the strategy,
100
+ # You can set the name of a class that takes the response for a failed SAML request and the strategy,
101
101
  # and implements a #handle method. This method can then redirect the user, return error messages, etc.
102
- # config.saml_failed_callback = nil
102
+ # config.saml_failed_callback = "MySamlFailedCallbacksHandler"
103
103
 
104
104
  # You can customize the named routes generated in case of named route collisions with
105
105
  # other Devise modules or libraries. Set the saml_route_helper_prefix to a string that will
@@ -117,7 +117,6 @@ In `config/initializers/devise.rb`:
117
117
 
118
118
  # Configure with your SAML settings (see ruby-saml's README for more information: https://github.com/onelogin/ruby-saml).
119
119
  config.saml_configure do |settings|
120
- # assertion_consumer_service_url is required starting with ruby-saml 1.4.3: https://github.com/onelogin/ruby-saml#updating-from-142-to-143
121
120
  settings.assertion_consumer_service_url = "http://localhost:3000/users/saml/auth"
122
121
  settings.assertion_consumer_service_binding = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
123
122
  settings.name_identifier_format = "urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
@@ -1,31 +1,24 @@
1
- require "ruby-saml"
1
+ require 'ruby-saml'
2
2
 
3
3
  class Devise::SamlSessionsController < Devise::SessionsController
4
4
  include DeviseSamlAuthenticatable::SamlConfig
5
- unloadable if Rails::VERSION::MAJOR < 4
6
- if Rails::VERSION::MAJOR < 5
7
- skip_before_filter :verify_authenticity_token
8
- prepend_before_filter :verify_signed_out_user, :store_info_for_sp_initiated_logout, only: :destroy
9
- else
10
- skip_before_action :verify_authenticity_token, raise: false
11
- prepend_before_action :verify_signed_out_user, :store_info_for_sp_initiated_logout, only: :destroy
12
- end
5
+
6
+ skip_before_action :verify_authenticity_token, raise: false
7
+ prepend_before_action :verify_signed_out_user, :store_info_for_sp_initiated_logout, only: :destroy
13
8
 
14
9
  def new
15
10
  idp_entity_id = get_idp_entity_id(params)
16
11
  request = OneLogin::RubySaml::Authrequest.new
17
12
  auth_params = { RelayState: relay_state } if relay_state
18
13
  action = request.create(saml_config(idp_entity_id), auth_params || {})
19
- if request.respond_to?(:request_id)
20
- session[:saml_transaction_id] = request.request_id
21
- end
22
- redirect_to action
14
+ session[:saml_transaction_id] = request.request_id if request.respond_to?(:request_id)
15
+ redirect_to action, allow_other_host: true
23
16
  end
24
17
 
25
18
  def metadata
26
19
  idp_entity_id = params[:idp_entity_id]
27
20
  meta = OneLogin::RubySaml::Metadata.new
28
- render :xml => meta.generate(saml_config(idp_entity_id))
21
+ render xml: meta.generate(saml_config(idp_entity_id))
29
22
  end
30
23
 
31
24
  def idp_sign_out
@@ -34,7 +27,7 @@ class Devise::SamlSessionsController < Devise::SessionsController
34
27
  logout_request = OneLogin::RubySaml::SloLogoutrequest.new(params[:SAMLRequest], settings: saml_config)
35
28
  resource_class.reset_session_key_for(logout_request.name_id)
36
29
 
37
- redirect_to generate_idp_logout_response(saml_config, logout_request.id)
30
+ redirect_to generate_idp_logout_response(saml_config, logout_request.id), allow_other_host: true
38
31
  elsif params[:SAMLResponse]
39
32
  # Currently Devise handles the session invalidation when the request is made.
40
33
  # To support a true SP initiated logout response, the request ID would have to be tracked and session invalidated
@@ -52,18 +45,19 @@ class Devise::SamlSessionsController < Devise::SessionsController
52
45
  protected
53
46
 
54
47
  def relay_state
55
- @relay_state ||= if Devise.saml_relay_state.present?
56
- Devise.saml_relay_state.call(request)
57
- end
48
+ @relay_state ||= (Devise.saml_relay_state.call(request) if Devise.saml_relay_state.present?)
58
49
  end
59
50
 
60
51
  # For non transient name ID, save info to identify user for logout purpose
61
52
  # before that user's session got destroyed. These info are used in the
62
53
  # `after_sign_out_path_for` method below.
63
54
  def store_info_for_sp_initiated_logout
64
- return if Devise.saml_config.name_identifier_format == "urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
55
+ return if Devise.saml_config.name_identifier_format == 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'
56
+
65
57
  @name_identifier_value_for_sp_initiated_logout = Devise.saml_name_identifier_retriever.call(current_user)
66
- @sessionindex_for_sp_initiated_logout = current_user.public_send(Devise.saml_session_index_key) if Devise.saml_session_index_key
58
+ if Devise.saml_session_index_key
59
+ @sessionindex_for_sp_initiated_logout = current_user.public_send(Devise.saml_session_index_key)
60
+ end
67
61
  end
68
62
 
69
63
  # Override devise to send user to IdP logout for SLO
@@ -89,17 +83,14 @@ class Devise::SamlSessionsController < Devise::SessionsController
89
83
  if all_signed_out?
90
84
  set_flash_message! :notice, :already_signed_out
91
85
 
92
- redirect_to Devise.saml_sign_out_success_url.presence ||
93
- Devise::SessionsController.new.after_sign_out_path_for(resource_name)
86
+ redirect_to (Devise.saml_sign_out_success_url.presence ||
87
+ Devise::SessionsController.new.after_sign_out_path_for(resource_name)), allow_other_host: true
94
88
  end
95
89
  end
96
90
 
97
91
  def generate_idp_logout_response(saml_config, logout_request_id)
98
-
99
92
  params = {}
100
- if relay_state
101
- params[:RelayState] = relay_state
102
- end
93
+ params[:RelayState] = relay_state if relay_state
103
94
 
104
95
  OneLogin::RubySaml::SloLogoutresponse.new.create(saml_config, logout_request_id, nil, params)
105
96
  end
@@ -1,9 +1,9 @@
1
1
  module DeviseSamlAuthenticatable
2
2
 
3
3
  class Logger
4
- def self.send(message, logger = Rails.logger)
4
+ def self.send(message, log_level = ::Logger::INFO, logger = Rails.logger)
5
5
  if ::Devise.saml_logger
6
- logger.add 0, " \e[36msaml:\e[0m #{message}"
6
+ logger.add log_level, " \e[36msaml:\e[0m #{message}"
7
7
  end
8
8
  end
9
9
  end
@@ -52,7 +52,15 @@ module Devise
52
52
  def failed_auth(msg)
53
53
  DeviseSamlAuthenticatable::Logger.send(msg)
54
54
  fail!(:invalid)
55
- Devise.saml_failed_callback.new.handle(@response, self) if Devise.saml_failed_callback
55
+ failed_callback.new.handle(@response, self) if Devise.saml_failed_callback
56
+ end
57
+
58
+ def failed_callback
59
+ if Devise.saml_failed_callback.respond_to?(:new)
60
+ Devise.saml_failed_callback
61
+ else
62
+ Devise.saml_failed_callback.constantize
63
+ end
56
64
  end
57
65
 
58
66
  def response_options
@@ -1,3 +1,3 @@
1
1
  module DeviseSamlAuthenticatable
2
- VERSION = "1.7.0"
2
+ VERSION = "1.8.0"
3
3
  end
@@ -10,13 +10,12 @@ class DeviseController < ApplicationController
10
10
  end
11
11
 
12
12
  def resource_name
13
- "users"
13
+ 'users'
14
14
  end
15
15
 
16
- def require_no_authentication
17
- end
16
+ def require_no_authentication; end
18
17
 
19
- def set_flash_message!(key, kind, options = {})
18
+ def set_flash_message!(key, kind, _options = {})
20
19
  flash[key] = I18n.t("devise.sessions.#{kind}")
21
20
  end
22
21
  end
@@ -24,7 +23,7 @@ end
24
23
  class Devise::SessionsController < DeviseController
25
24
  def destroy
26
25
  sign_out
27
- redirect_to after_sign_out_path_for(:user)
26
+ redirect_to after_sign_out_path_for(:user), allow_other_host: true
28
27
  end
29
28
  end
30
29
 
@@ -33,65 +32,49 @@ require_relative '../../../app/controllers/devise/saml_sessions_controller'
33
32
  describe Devise::SamlSessionsController, type: :controller do
34
33
  include RubySamlSupport
35
34
 
36
- let(:idp_providers_adapter) { spy("Stub IDPSettings Adaptor") }
35
+ let(:idp_providers_adapter) { spy('Stub IDPSettings Adaptor') }
37
36
 
38
37
  before do
39
- @request.env["devise.mapping"] = Devise.mappings[:user]
38
+ @request.env['devise.mapping'] = Devise.mappings[:user]
40
39
  settings = {
41
- assertion_consumer_service_url: "acs_url",
42
- assertion_consumer_service_binding: "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST",
43
- name_identifier_format: "urn:oasis:names:tc:SAML:2.0:nameid-format:transient",
44
- issuer: "sp_issuer",
45
- idp_entity_id: "http://www.example.com",
46
- authn_context: "",
47
- idp_cert: "idp_cert"
40
+ assertion_consumer_service_url: 'acs_url',
41
+ assertion_consumer_service_binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
42
+ name_identifier_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
43
+ issuer: 'sp_issuer',
44
+ idp_entity_id: 'http://www.example.com',
45
+ authn_context: '',
46
+ idp_cert: 'idp_cert'
48
47
  }
49
48
  with_ruby_saml_1_12_or_greater(proc {
50
49
  settings.merge!(
51
- idp_slo_service_url: "http://idp_slo_url",
52
- idp_sso_service_url: "http://idp_sso_url",
50
+ idp_slo_service_url: 'http://idp_slo_url',
51
+ idp_sso_service_url: 'http://idp_sso_url'
53
52
  )
54
53
  }, else_do: proc {
55
54
  settings.merge!(
56
- idp_slo_target_url: "http://idp_slo_url",
57
- idp_sso_target_url: "http://idp_sso_url",
55
+ idp_slo_target_url: 'http://idp_slo_url',
56
+ idp_sso_target_url: 'http://idp_sso_url'
58
57
  )
59
58
  })
60
59
  allow(idp_providers_adapter).to receive(:settings).and_return(settings)
61
60
  end
62
61
 
63
- before do
64
- if Rails::VERSION::MAJOR < 5 && Gem::Version.new(RUBY_VERSION) > Gem::Version.new("2.6")
65
- # we still want to support Rails 4
66
- # patch tests using snippet from https://github.com/rails/rails/issues/34790#issuecomment-483607370
67
- class ActionController::TestResponse < ActionDispatch::TestResponse
68
- def recycle!
69
- @mon_mutex_owner_object_id = nil
70
- @mon_mutex = nil
71
- initialize
72
- end
73
- end
74
- end
75
- end
76
-
77
62
  describe '#new' do
78
- let(:saml_response) { File.read(File.join(File.dirname(__FILE__), '../../support', 'response_encrypted_nameid.xml.base64')) }
63
+ let(:saml_response) do
64
+ File.read(File.join(File.dirname(__FILE__), '../../support', 'response_encrypted_nameid.xml.base64'))
65
+ end
79
66
 
80
- subject(:do_get) {
81
- if Rails::VERSION::MAJOR > 4
82
- get :new, params: {"SAMLResponse" => saml_response}
83
- else
84
- get :new, "SAMLResponse" => saml_response
85
- end
86
- }
67
+ subject(:do_get) do
68
+ get :new, params: { 'SAMLResponse' => saml_response }
69
+ end
87
70
 
88
- context "when using the default saml config" do
89
- it "redirects to the IdP SSO target url" do
71
+ context 'when using the default saml config' do
72
+ it 'redirects to the IdP SSO target url' do
90
73
  do_get
91
- expect(response).to redirect_to(%r(\Ahttp://localhost:8009/saml/auth\?SAMLRequest=))
74
+ expect(response).to redirect_to(%r{\Ahttp://localhost:8009/saml/auth\?SAMLRequest=})
92
75
  end
93
76
 
94
- it "stores saml_transaction_id in the session" do
77
+ it 'stores saml_transaction_id in the session' do
95
78
  do_get
96
79
  if OneLogin::RubySaml::Authrequest.public_instance_methods.include?(:request_id)
97
80
  expect(session[:saml_transaction_id]).to be_present
@@ -99,53 +82,49 @@ describe Devise::SamlSessionsController, type: :controller do
99
82
  end
100
83
  end
101
84
 
102
- context "with a specified idp" do
85
+ context 'with a specified idp' do
103
86
  before do
104
87
  Devise.idp_settings_adapter = idp_providers_adapter
105
88
  end
106
89
 
107
- it "redirects to the associated IdP SSO target url" do
90
+ it 'redirects to the associated IdP SSO target url' do
108
91
  do_get
109
- expect(response).to redirect_to(%r(\Ahttp://idp_sso_url\?SAMLRequest=))
92
+ expect(response).to redirect_to(%r{\Ahttp://idp_sso_url\?SAMLRequest=})
110
93
  end
111
94
 
112
- it "stores saml_transaction_id in the session" do
95
+ it 'stores saml_transaction_id in the session' do
113
96
  do_get
114
97
  if OneLogin::RubySaml::Authrequest.public_instance_methods.include?(:request_id)
115
98
  expect(session[:saml_transaction_id]).to be_present
116
99
  end
117
100
  end
118
101
 
119
- it "uses the DefaultIdpEntityIdReader" do
102
+ it 'uses the DefaultIdpEntityIdReader' do
120
103
  expect(DeviseSamlAuthenticatable::DefaultIdpEntityIdReader).to receive(:entity_id)
121
104
  do_get
122
105
  expect(idp_providers_adapter).to have_received(:settings).with(nil)
123
106
  end
124
107
 
125
- context "with a relay_state lambda defined" do
126
- let(:relay_state) { ->(request) { "123" } }
108
+ context 'with a relay_state lambda defined' do
109
+ let(:relay_state) { ->(_request) { '123' } }
127
110
 
128
- it "includes the RelayState param in the request to the IdP" do
111
+ it 'includes the RelayState param in the request to the IdP' do
129
112
  expect(Devise).to receive(:saml_relay_state).at_least(:once).and_return(relay_state)
130
113
  do_get
131
- expect(response).to redirect_to(%r(\Ahttp://idp_sso_url\?SAMLRequest=.*&RelayState=123))
114
+ expect(response).to redirect_to(%r{\Ahttp://idp_sso_url\?SAMLRequest=.*&RelayState=123})
132
115
  end
133
116
  end
134
117
 
135
- context "with a specified idp entity id reader" do
118
+ context 'with a specified idp entity id reader' do
136
119
  class OurIdpEntityIdReader
137
120
  def self.entity_id(params)
138
121
  params[:entity_id]
139
122
  end
140
123
  end
141
124
 
142
- subject(:do_get) {
143
- if Rails::VERSION::MAJOR > 4
144
- get :new, params: {entity_id: "http://www.example.com"}
145
- else
146
- get :new, entity_id: "http://www.example.com"
147
- end
148
- }
125
+ subject(:do_get) do
126
+ get :new, params: { entity_id: 'http://www.example.com' }
127
+ end
149
128
 
150
129
  before do
151
130
  @default_reader = Devise.idp_entity_id_reader
@@ -156,10 +135,10 @@ describe Devise::SamlSessionsController, type: :controller do
156
135
  Devise.idp_entity_id_reader = @default_reader
157
136
  end
158
137
 
159
- it "redirects to the associated IdP SSO target url" do
138
+ it 'redirects to the associated IdP SSO target url' do
160
139
  do_get
161
- expect(idp_providers_adapter).to have_received(:settings).with("http://www.example.com")
162
- expect(response).to redirect_to(%r(\Ahttp://idp_sso_url\?SAMLRequest=))
140
+ expect(idp_providers_adapter).to have_received(:settings).with('http://www.example.com')
141
+ expect(response).to redirect_to(%r{\Ahttp://idp_sso_url\?SAMLRequest=})
163
142
  end
164
143
  end
165
144
  end
@@ -168,7 +147,7 @@ describe Devise::SamlSessionsController, type: :controller do
168
147
  describe '#metadata' do
169
148
  let(:saml_config) { Devise.saml_config.dup }
170
149
 
171
- context "with the default configuration" do
150
+ context 'with the default configuration' do
172
151
  it 'generates metadata' do
173
152
  get :metadata
174
153
 
@@ -179,20 +158,20 @@ describe Devise::SamlSessionsController, type: :controller do
179
158
  end
180
159
  end
181
160
 
182
- context "with a specified IDP" do
183
- let(:saml_config) { controller.saml_config("anything") }
161
+ context 'with a specified IDP' do
162
+ let(:saml_config) { controller.saml_config('anything') }
184
163
 
185
164
  before do
186
165
  Devise.idp_settings_adapter = idp_providers_adapter
187
166
  Devise.saml_configure do |settings|
188
- settings.assertion_consumer_service_url = "http://localhost:3000/users/saml/auth"
189
- settings.assertion_consumer_service_binding = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
190
- settings.name_identifier_format = "urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
191
- settings.issuer = "http://localhost:3000"
167
+ settings.assertion_consumer_service_url = 'http://localhost:3000/users/saml/auth'
168
+ settings.assertion_consumer_service_binding = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'
169
+ settings.name_identifier_format = 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'
170
+ settings.issuer = 'http://localhost:3000'
192
171
  end
193
172
  end
194
173
 
195
- it "generates the same service metadata" do
174
+ it 'generates the same service metadata' do
196
175
  get :metadata
197
176
 
198
177
  # Remove ID that can vary across requests
@@ -206,7 +185,7 @@ describe Devise::SamlSessionsController, type: :controller do
206
185
  describe '#destroy' do
207
186
  subject { delete :destroy }
208
187
 
209
- context "when user is signed out" do
188
+ context 'when user is signed out' do
210
189
  before do
211
190
  class Devise::SessionsController < DeviseController
212
191
  def all_signed_out?
@@ -215,45 +194,45 @@ describe Devise::SamlSessionsController, type: :controller do
215
194
  end
216
195
  end
217
196
 
218
- shared_examples "not create SP initiated logout request" do
197
+ shared_examples 'not create SP initiated logout request' do
219
198
  it do
220
199
  expect(OneLogin::RubySaml::Logoutrequest).not_to receive(:new)
221
200
  subject
222
201
  end
223
202
  end
224
203
 
225
- context "when Devise.saml_sign_out_success_url is set" do
204
+ context 'when Devise.saml_sign_out_success_url is set' do
226
205
  before do
227
- allow(Devise).to receive(:saml_sign_out_success_url).and_return("http://localhost:8009/logged_out")
206
+ allow(Devise).to receive(:saml_sign_out_success_url).and_return('http://localhost:8009/logged_out')
228
207
  end
229
208
 
230
- it "redirect to saml_sign_out_success_url" do
231
- is_expected.to redirect_to "http://localhost:8009/logged_out"
232
- expect(flash[:notice]).to eq I18n.t("devise.sessions.already_signed_out")
209
+ it 'redirect to saml_sign_out_success_url' do
210
+ is_expected.to redirect_to 'http://localhost:8009/logged_out'
211
+ expect(flash[:notice]).to eq I18n.t('devise.sessions.already_signed_out')
233
212
  end
234
213
 
235
- it_behaves_like "not create SP initiated logout request"
214
+ it_behaves_like 'not create SP initiated logout request'
236
215
  end
237
216
 
238
- context "when Devise.saml_sign_out_success_url is not set" do
217
+ context 'when Devise.saml_sign_out_success_url is not set' do
239
218
  before do
240
219
  class Devise::SessionsController < DeviseController
241
220
  def after_sign_out_path_for(_)
242
- "http://localhost:8009/logged_out"
221
+ 'http://localhost:8009/logged_out'
243
222
  end
244
223
  end
245
224
  end
246
225
 
247
226
  it "redirect to devise's after sign out path" do
248
- is_expected.to redirect_to "http://localhost:8009/logged_out"
249
- expect(flash[:notice]).to eq I18n.t("devise.sessions.already_signed_out")
227
+ is_expected.to redirect_to 'http://localhost:8009/logged_out'
228
+ expect(flash[:notice]).to eq I18n.t('devise.sessions.already_signed_out')
250
229
  end
251
230
 
252
- it_behaves_like "not create SP initiated logout request"
231
+ it_behaves_like 'not create SP initiated logout request'
253
232
  end
254
233
  end
255
234
 
256
- context "when user is not signed out" do
235
+ context 'when user is not signed out' do
257
236
  before do
258
237
  class Devise::SessionsController < DeviseController
259
238
  def all_signed_out?
@@ -263,60 +242,56 @@ describe Devise::SamlSessionsController, type: :controller do
263
242
  allow(controller).to receive(:sign_out)
264
243
  end
265
244
 
266
- context "when using the default saml config" do
267
- it "signs out and redirects to the IdP" do
245
+ context 'when using the default saml config' do
246
+ it 'signs out and redirects to the IdP' do
268
247
  delete :destroy
269
248
  expect(controller).to have_received(:sign_out)
270
- expect(response).to redirect_to(%r(\Ahttp://localhost:8009/saml/logout\?SAMLRequest=))
249
+ expect(response).to redirect_to(%r{\Ahttp://localhost:8009/saml/logout\?SAMLRequest=})
271
250
  end
272
251
  end
273
252
 
274
- context "when configured to use a non-transient name identifier" do
253
+ context 'when configured to use a non-transient name identifier' do
275
254
  before do
276
- allow(Devise.saml_config).to receive(:name_identifier_format).and_return("urn:oasis:names:tc:SAML:2.0:nameid-format:persistent")
255
+ allow(Devise.saml_config).to receive(:name_identifier_format).and_return('urn:oasis:names:tc:SAML:2.0:nameid-format:persistent')
277
256
  end
278
257
 
279
- it "includes a LogoutRequest with the name identifier and session index", :aggregate_failures do
280
- controller.current_user = Struct.new(:email, :session_index).new("user@example.com", "sessionindex")
258
+ it 'includes a LogoutRequest with the name identifier and session index', :aggregate_failures do
259
+ controller.current_user = Struct.new(:email, :session_index).new('user@example.com', 'sessionindex')
281
260
 
282
261
  actual_settings = nil
283
262
  expect_any_instance_of(OneLogin::RubySaml::Logoutrequest).to receive(:create) do |_, settings|
284
263
  actual_settings = settings
285
- "http://localhost:8009/saml/logout"
264
+ 'http://localhost:8009/saml/logout'
286
265
  end
287
266
 
288
267
  delete :destroy
289
- expect(actual_settings.name_identifier_value).to eq("user@example.com")
290
- expect(actual_settings.sessionindex).to eq("sessionindex")
268
+ expect(actual_settings.name_identifier_value).to eq('user@example.com')
269
+ expect(actual_settings.sessionindex).to eq('sessionindex')
291
270
  end
292
271
  end
293
272
 
294
- context "with a specified idp" do
273
+ context 'with a specified idp' do
295
274
  before do
296
275
  Devise.idp_settings_adapter = idp_providers_adapter
297
276
  end
298
277
 
299
- it "redirects to the associated IdP SSO target url" do
278
+ it 'redirects to the associated IdP SSO target url' do
300
279
  expect(DeviseSamlAuthenticatable::DefaultIdpEntityIdReader).to receive(:entity_id)
301
280
  delete :destroy
302
281
  expect(controller).to have_received(:sign_out)
303
- expect(response).to redirect_to(%r(\Ahttp://idp_slo_url\?SAMLRequest=))
282
+ expect(response).to redirect_to(%r{\Ahttp://idp_slo_url\?SAMLRequest=})
304
283
  end
305
284
 
306
- context "with a specified idp entity id reader" do
285
+ context 'with a specified idp entity id reader' do
307
286
  class OurIdpEntityIdReader
308
287
  def self.entity_id(params)
309
288
  params[:entity_id]
310
289
  end
311
290
  end
312
291
 
313
- subject(:do_delete) {
314
- if Rails::VERSION::MAJOR > 4
315
- delete :destroy, params: {entity_id: "http://www.example.com"}
316
- else
317
- delete :destroy, entity_id: "http://www.example.com"
318
- end
319
- }
292
+ subject(:do_delete) do
293
+ delete :destroy, params: { entity_id: 'http://www.example.com' }
294
+ end
320
295
 
321
296
  before do
322
297
  @default_reader = Devise.idp_entity_id_reader
@@ -327,11 +302,11 @@ describe Devise::SamlSessionsController, type: :controller do
327
302
  Devise.idp_entity_id_reader = @default_reader
328
303
  end
329
304
 
330
- it "redirects to the associated IdP SLO target url" do
305
+ it 'redirects to the associated IdP SLO target url' do
331
306
  do_delete
332
307
  expect(controller).to have_received(:sign_out)
333
- expect(idp_providers_adapter).to have_received(:settings).with("http://www.example.com")
334
- expect(response).to redirect_to(%r(\Ahttp://idp_slo_url\?SAMLRequest=))
308
+ expect(idp_providers_adapter).to have_received(:settings).with('http://www.example.com')
309
+ expect(response).to redirect_to(%r{\Ahttp://idp_slo_url\?SAMLRequest=})
335
310
  end
336
311
  end
337
312
  end
@@ -352,14 +327,10 @@ describe Devise::SamlSessionsController, type: :controller do
352
327
  expect(response.status).to eq 500
353
328
  end
354
329
 
355
- context "when receiving a logout response from the IdP after redirecting an SP logout request" do
356
- subject(:do_post) {
357
- if Rails::VERSION::MAJOR > 4
358
- post :idp_sign_out, params: {SAMLResponse: "stubbed_response"}
359
- else
360
- post :idp_sign_out, SAMLResponse: "stubbed_response"
361
- end
362
- }
330
+ context 'when receiving a logout response from the IdP after redirecting an SP logout request' do
331
+ subject(:do_post) do
332
+ post :idp_sign_out, params: { SAMLResponse: 'stubbed_response' }
333
+ end
363
334
 
364
335
  it 'accepts a LogoutResponse and redirects sign_in' do
365
336
  do_post
@@ -381,20 +352,18 @@ describe Devise::SamlSessionsController, type: :controller do
381
352
  end
382
353
  end
383
354
 
384
- context "when receiving an IdP logout request" do
385
- subject(:do_post) {
386
- if Rails::VERSION::MAJOR > 4
387
- post :idp_sign_out, params: {SAMLRequest: "stubbed_logout_request"}
388
- else
389
- post :idp_sign_out, SAMLRequest: "stubbed_logout_request"
390
- end
391
- }
355
+ context 'when receiving an IdP logout request' do
356
+ subject(:do_post) do
357
+ post :idp_sign_out, params: { SAMLRequest: 'stubbed_logout_request' }
358
+ end
392
359
 
393
- let(:saml_request) { double(:slo_logoutrequest, {
394
- id: 42,
395
- name_id: name_id,
396
- issuer: "http://www.example.com"
397
- }) }
360
+ let(:saml_request) do
361
+ double(:slo_logoutrequest, {
362
+ id: 42,
363
+ name_id: name_id,
364
+ issuer: 'http://www.example.com'
365
+ })
366
+ end
398
367
  let(:name_id) { '12312312' }
399
368
  before do
400
369
  allow(OneLogin::RubySaml::SloLogoutrequest).to receive(:new).and_return(saml_request)
@@ -407,27 +376,28 @@ describe Devise::SamlSessionsController, type: :controller do
407
376
  expect(User).to have_received(:reset_session_key_for).with(name_id)
408
377
  end
409
378
 
410
- context "with a specified idp" do
411
- let(:idp_entity_id) { "http://www.example.com" }
379
+ context 'with a specified idp' do
380
+ let(:idp_entity_id) { 'http://www.example.com' }
412
381
  before do
413
382
  Devise.idp_settings_adapter = idp_providers_adapter
414
383
  end
415
384
 
416
- it "accepts a LogoutResponse for the associated slo_target_url and redirects to sign_in" do
385
+ it 'accepts a LogoutResponse for the associated slo_target_url and redirects to sign_in' do
417
386
  do_post
418
387
  expect(response.status).to eq 302
419
388
  expect(idp_providers_adapter).to have_received(:settings).with(idp_entity_id)
420
- expect(response).to redirect_to "http://localhost/logout_response"
389
+ expect(response).to redirect_to 'http://localhost/logout_response'
421
390
  end
422
391
  end
423
392
 
424
- context "with a relay_state lambda defined" do
425
- let(:relay_state) { ->(request) { "123" } }
393
+ context 'with a relay_state lambda defined' do
394
+ let(:relay_state) { ->(_request) { '123' } }
426
395
 
427
- it "includes the RelayState param in the request to the IdP" do
396
+ it 'includes the RelayState param in the request to the IdP' do
428
397
  expect(Devise).to receive(:saml_relay_state).at_least(:once).and_return(relay_state)
429
398
  do_post
430
- expect(saml_response).to have_received(:create).with(Devise.saml_config, saml_request.id, nil, {RelayState: "123"})
399
+ expect(saml_response).to have_received(:create).with(Devise.saml_config, saml_request.id, nil,
400
+ { RelayState: '123' })
431
401
  end
432
402
  end
433
403
 
@@ -3,8 +3,21 @@ require 'net/http'
3
3
  require 'timeout'
4
4
  require 'uri'
5
5
  require 'capybara/rspec'
6
- require 'capybara/poltergeist'
7
- Capybara.default_driver = :poltergeist
6
+ require 'selenium-webdriver'
7
+
8
+ Capybara.register_driver :chrome do |app|
9
+ options = Selenium::WebDriver::Chrome::Options.new
10
+ options.add_argument('--headless')
11
+ options.add_argument('--allow-insecure-localhost')
12
+ options.add_argument('--ignore-certificate-errors')
13
+
14
+ Capybara::Selenium::Driver.new(
15
+ app,
16
+ browser: :chrome,
17
+ capabilities: [options]
18
+ )
19
+ end
20
+ Capybara.default_driver = :chrome
8
21
  Capybara.server = :webrick
9
22
 
10
23
  describe "SAML Authentication", type: :feature do
@@ -165,7 +178,7 @@ describe "SAML Authentication", type: :feature do
165
178
  let(:valid_destination) { "true" }
166
179
  before(:each) do
167
180
  create_app('idp', 'INCLUDE_SUBJECT_IN_ATTRIBUTES' => "false", 'VALID_DESTINATION' => valid_destination)
168
- create_app('sp', 'USE_SUBJECT_TO_AUTHENTICATE' => "true", 'SAML_FAILED_CALLBACK' => "OurSamlFailedCallbackHandler")
181
+ create_app('sp', 'USE_SUBJECT_TO_AUTHENTICATE' => "true", 'SAML_FAILED_CALLBACK' => '"OurSamlFailedCallbackHandler"')
169
182
 
170
183
  @idp_pid = start_app('idp', idp_port)
171
184
  @sp_pid = start_app('sp', sp_port)
@@ -224,7 +237,7 @@ describe "SAML Authentication", type: :feature do
224
237
  end
225
238
 
226
239
  def sign_in(entity_id: "")
227
- visit "http://localhost:8020/users/saml/sign_in/?entity_id=#{URI.escape(entity_id)}"
240
+ visit "http://localhost:8020/users/saml/sign_in/?entity_id=#{URI.encode_www_form_component(entity_id)}"
228
241
  fill_in "Email", with: "you@example.com"
229
242
  fill_in "Password", with: "asdf"
230
243
  click_on "Sign in"
@@ -10,16 +10,5 @@ group :test do
10
10
  gem 'rspec-rails', '~> 3.9'
11
11
  gem 'sqlite3', '~> 1.3.6'
12
12
  gem 'capybara'
13
- gem 'poltergeist'
14
-
15
- # Lock down versions of gems for older versions of Ruby
16
- if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.4")
17
- gem 'responders', '~> 2.4'
18
- end
19
-
20
- if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.3")
21
- gem 'byebug', '~> 10.0'
22
- elsif Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.4")
23
- gem 'byebug', '~> 11.0.0'
24
- end
13
+ gem 'selenium-webdriver'
25
14
  end
@@ -10,5 +10,9 @@ group :test do
10
10
  gem 'rspec-rails', '~> 5.0'
11
11
  gem 'sqlite3', '~> 1.4.0'
12
12
  gem 'capybara'
13
- gem 'poltergeist'
13
+ gem 'selenium-webdriver'
14
+
15
+ if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new("3.0")
16
+ gem 'webrick'
17
+ end
14
18
  end
@@ -0,0 +1,24 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in devise_saml_authenticatable.gemspec
4
+ gemspec path: '../..'
5
+
6
+ group :test do
7
+ gem 'rake'
8
+ gem 'rspec', '~> 3.0'
9
+ gem 'rails', '~> 6.1.0'
10
+ gem 'rspec-rails', '~> 5.0'
11
+ gem 'sqlite3', '~> 1.4.0'
12
+ gem 'capybara'
13
+ gem 'selenium-webdriver'
14
+
15
+ if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new("3.0")
16
+ gem 'webrick'
17
+ end
18
+
19
+ if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new("3.1")
20
+ gem 'net-smtp', require: false
21
+ gem 'net-imap', require: false
22
+ gem 'net-pop', require: false
23
+ end
24
+ end
@@ -5,22 +5,14 @@
5
5
  @include_subject_in_attributes = ENV.fetch('INCLUDE_SUBJECT_IN_ATTRIBUTES')
6
6
  @valid_destination = ENV.fetch('VALID_DESTINATION', "true")
7
7
 
8
- if Rails::VERSION::MAJOR < 5 || (Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR < 2)
9
- gsub_file 'config/secrets.yml', /secret_key_base:.*$/, 'secret_key_base: "34814fd41f91c493b89aa01ac73c44d241a31245b5bc5542fa4b7317525e1dcfa60ba947b3d085e4e229456fdee0d8af6aac6a63cf750d807ea6fe5d853dff4a"'
10
- end
11
-
12
- gem 'ruby-saml-idp', '~> 0.3.3'
8
+ gem 'stub_saml_idp'
13
9
  gem 'thin'
14
10
 
15
- insert_into_file('Gemfile', after: /\z/) {
16
- <<-GEMFILE
17
- # Lock down versions of gems for older versions of Ruby
18
- if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.1")
19
- gem 'devise', '~> 3.5'
20
- gem 'nokogiri', '~> 1.6.8'
11
+ if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new("3.1")
12
+ gem 'net-smtp', require: false
13
+ gem 'net-imap', require: false
14
+ gem 'net-pop', require: false
21
15
  end
22
- GEMFILE
23
- }
24
16
 
25
17
  route "get '/saml/auth' => 'saml_idp#new'"
26
18
  route "post '/saml/auth' => 'saml_idp#create'"
@@ -19,7 +19,7 @@ end
19
19
 
20
20
  def create_app(name, env = {})
21
21
  puts "[#{name}] Creating Rails app"
22
- rails_new_options = %w[-T -J -S --skip-spring --skip-listen --skip-bootsnap]
22
+ rails_new_options = %w[-A -G -C -T -J -S --skip-spring --skip-listen --skip-bootsnap --skip-action-mailbox --skip-jbuilder --skip-active-storage]
23
23
  rails_new_options << "-O" if name == "idp"
24
24
  env.merge!("RUBY_SAML_VERSION" => OneLogin::RubySaml::VERSION)
25
25
  Dir.chdir(working_directory) do
@@ -1,4 +1,4 @@
1
- class SamlIdpController < SamlIdp::IdpController
1
+ class SamlIdpController < StubSamlIdp::IdpController
2
2
  def new
3
3
  if session[:user_id]
4
4
  @saml_response = idp_make_saml_response(session[:user_id])
@@ -79,13 +79,8 @@ class SamlIdpController < SamlIdp::IdpController
79
79
  end
80
80
 
81
81
  # == SLO functionality, see https://github.com/lawrencepit/ruby-saml-idp/pull/10
82
- <% if Rails::VERSION::MAJOR < 5 %>
83
- skip_before_filter :validate_saml_request, :only => [:logout, :sp_sign_out]
84
- before_filter :validate_saml_slo_request, :only => [:logout]
85
- <% else %>
86
82
  skip_before_action :validate_saml_request, :only => [:logout, :sp_sign_out]
87
83
  before_action :validate_saml_slo_request, :only => [:logout]
88
- <% end %>
89
84
 
90
85
  public
91
86
 
@@ -10,25 +10,16 @@ idp_entity_id_reader = ENV.fetch('IDP_ENTITY_ID_READER', '"DeviseSamlAuthenticat
10
10
  saml_failed_callback = ENV.fetch('SAML_FAILED_CALLBACK', "nil")
11
11
  ruby_saml_version = ENV.fetch("RUBY_SAML_VERSION")
12
12
 
13
- if Rails::VERSION::MAJOR < 5 || (Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR < 2)
14
- gsub_file 'config/secrets.yml', /secret_key_base:.*$/, 'secret_key_base: "8b5889df1fcf03f76c7d66da02d8776bcc85b06bed7d9c592f076d9c8a5455ee6d4beae45986c3c030b40208db5e612f2a6ef8283036a352e3fae83c5eda36be"'
15
- end
16
-
17
13
  gem 'devise_saml_authenticatable', path: File.expand_path("../../..", __FILE__)
18
14
  gem 'ruby-saml', ruby_saml_version
19
15
  gem 'thin'
20
16
 
21
- insert_into_file('Gemfile', after: /\z/) {
22
- <<-GEMFILE
23
- # Lock down versions of gems for older versions of Ruby
24
- if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.1")
25
- gem 'devise', '~> 3.5'
26
- gem 'nokogiri', '~> 1.6.8'
27
- elsif Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.4")
28
- gem 'responders', '~> 2.4'
17
+ if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new("3.1")
18
+ gem 'net-smtp', require: false
19
+ gem 'net-imap', require: false
20
+ gem 'net-pop', require: false
29
21
  end
30
- GEMFILE
31
- }
22
+
32
23
  if Rails::VERSION::MAJOR < 6
33
24
  # sqlite3 is hard-coded in Rails < 6 to v1.3.x
34
25
  gsub_file 'Gemfile', /^gem 'sqlite3'.*$/, "gem 'sqlite3', '~> 1.3.6'"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_saml_authenticatable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josef Sauter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-03 00:00:00.000000000 Z
11
+ date: 2022-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: devise
@@ -48,6 +48,7 @@ files:
48
48
  - ".github/workflows/ci.yml"
49
49
  - ".gitignore"
50
50
  - ".rspec"
51
+ - ".ruby-version"
51
52
  - Gemfile
52
53
  - LICENSE
53
54
  - README.md
@@ -78,11 +79,9 @@ files:
78
79
  - spec/rails_helper.rb
79
80
  - spec/routes/routes_spec.rb
80
81
  - spec/spec_helper.rb
81
- - spec/support/Gemfile.rails4
82
- - spec/support/Gemfile.rails5
83
- - spec/support/Gemfile.rails5.1
84
82
  - spec/support/Gemfile.rails5.2
85
83
  - spec/support/Gemfile.rails6
84
+ - spec/support/Gemfile.rails6.1
86
85
  - spec/support/attribute-map.yml
87
86
  - spec/support/attribute_map_resolver.rb.erb
88
87
  - spec/support/idp_settings_adapter.rb.erb
@@ -112,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
111
  - !ruby/object:Gem::Version
113
112
  version: '0'
114
113
  requirements: []
115
- rubygems_version: 3.1.4
114
+ rubygems_version: 3.3.3
116
115
  signing_key:
117
116
  specification_version: 4
118
117
  summary: SAML Authentication for devise
@@ -128,11 +127,9 @@ test_files:
128
127
  - spec/rails_helper.rb
129
128
  - spec/routes/routes_spec.rb
130
129
  - spec/spec_helper.rb
131
- - spec/support/Gemfile.rails4
132
- - spec/support/Gemfile.rails5
133
- - spec/support/Gemfile.rails5.1
134
130
  - spec/support/Gemfile.rails5.2
135
131
  - spec/support/Gemfile.rails6
132
+ - spec/support/Gemfile.rails6.1
136
133
  - spec/support/attribute-map.yml
137
134
  - spec/support/attribute_map_resolver.rb.erb
138
135
  - spec/support/idp_settings_adapter.rb.erb
@@ -1,41 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in devise_saml_authenticatable.gemspec
4
- gemspec path: '../..'
5
-
6
- group :test do
7
- gem 'rspec', '~> 3.0'
8
- gem 'rails', '~> 4.0'
9
- gem 'rspec-rails', '~> 3.9'
10
- gem 'sqlite3', '~> 1.3.6'
11
- gem 'capybara'
12
- gem 'poltergeist'
13
-
14
- # Lock down versions of gems for older versions of Ruby
15
- if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.1")
16
- gem 'rake', '~> 12.2'
17
- else
18
- gem 'rake'
19
- end
20
-
21
- if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.1")
22
- gem 'devise', '~> 3.5'
23
- gem 'minitest', '~> 5.11.0'
24
- gem 'nokogiri', '~> 1.6.8'
25
- gem 'public_suffix', '~> 2.0.5'
26
- end
27
-
28
- if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.1")
29
- gem 'responders', '~> 1.0'
30
- elsif Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.4")
31
- gem 'responders', '~> 2.0'
32
- end
33
-
34
- if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.2")
35
- gem 'byebug', '~> 9.0'
36
- elsif Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.3")
37
- gem 'byebug', '~> 10.0'
38
- elsif Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.4")
39
- gem 'byebug', '~> 11.0.0'
40
- end
41
- end
@@ -1,25 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in devise_saml_authenticatable.gemspec
4
- gemspec path: '../..'
5
-
6
- group :test do
7
- gem 'rake'
8
- gem 'rspec', '~> 3.0'
9
- gem 'rails', '~> 5.0.0'
10
- gem 'rspec-rails', '~> 3.9'
11
- gem 'sqlite3', '~> 1.3.6'
12
- gem 'capybara'
13
- gem 'poltergeist'
14
-
15
- # Lock down versions of gems for older versions of Ruby
16
- if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.4")
17
- gem 'responders', '~> 2.4'
18
- end
19
-
20
- if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.3")
21
- gem 'byebug', '~> 10.0'
22
- elsif Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.4")
23
- gem 'byebug', '~> 11.0.0'
24
- end
25
- end
@@ -1,25 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in devise_saml_authenticatable.gemspec
4
- gemspec path: '../..'
5
-
6
- group :test do
7
- gem 'rake'
8
- gem 'rspec', '~> 3.0'
9
- gem 'rails', '~> 5.1.0'
10
- gem 'rspec-rails', '~> 3.9'
11
- gem 'sqlite3', '~> 1.3.6'
12
- gem 'capybara'
13
- gem 'poltergeist'
14
-
15
- # Lock down versions of gems for older versions of Ruby
16
- if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.4")
17
- gem 'responders', '~> 2.4'
18
- end
19
-
20
- if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.3")
21
- gem 'byebug', '~> 10.0'
22
- elsif Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.4")
23
- gem 'byebug', '~> 11.0.0'
24
- end
25
- end