devise_saml_authenticatable 1.6.2 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/lib/devise_saml_authenticatable.rb +2 -2
- data/lib/devise_saml_authenticatable/model.rb +9 -1
- data/lib/devise_saml_authenticatable/saml_config.rb +18 -2
- data/lib/devise_saml_authenticatable/version.rb +1 -1
- data/spec/features/saml_authentication_spec.rb +2 -2
- data/spec/support/sp_template.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f648472eaaf23e5e668e51f84fadff2354879045f0ec798a383dd8a2e2ee135a
|
4
|
+
data.tar.gz: 443a5e883595f8baa2297e2ca173e8f97ae0abf3502538ce1d0f4e0e1c84081e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4765fe0a60d2a8ffd97d30d5b0d2fdb55d70a56bd9cb91f760ef7862a0d9ec80570da5d4758a784ac552232e1e5893fdd1accead2ff677893b0eb4a3500dcb9c
|
7
|
+
data.tar.gz: fcd0e6f70b75fdb9b12b3c1954899989e26f8ddb874c6222ab59ca460387a9672ab7767c13855bc4c3cbabd14fdcdb3ddabb2478412dbb452a17194c20ff4c32
|
data/README.md
CHANGED
@@ -89,13 +89,13 @@ In `config/initializers/devise.rb`:
|
|
89
89
|
# If you don't set it then email will be extracted from SAML assertation attributes.
|
90
90
|
config.saml_use_subject = true
|
91
91
|
|
92
|
-
# You can support multiple IdPs by setting this value to a class that implements a
|
93
|
-
# an IdP entity id as an argument and returns a hash of idp settings for the corresponding IdP.
|
94
|
-
config.idp_settings_adapter =
|
92
|
+
# You can support multiple IdPs by setting this value to the name of a class that implements a ::settings method
|
93
|
+
# which takes an IdP entity id as an argument and returns a hash of idp settings for the corresponding IdP.
|
94
|
+
# config.idp_settings_adapter = "MyIdPSettingsAdapter"
|
95
95
|
|
96
96
|
# You provide you own method to find the idp_entity_id in a SAML message in the case of multiple IdPs
|
97
|
-
# by setting this to a custom reader class, or use the default.
|
98
|
-
# config.idp_entity_id_reader = DeviseSamlAuthenticatable::DefaultIdpEntityIdReader
|
97
|
+
# by setting this to the name of a custom reader class, or use the default.
|
98
|
+
# config.idp_entity_id_reader = "DeviseSamlAuthenticatable::DefaultIdpEntityIdReader"
|
99
99
|
|
100
100
|
# You can set a handler object 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.
|
@@ -169,7 +169,7 @@ If you only have one IdP, you can use the config file above, or just return a si
|
|
169
169
|
...
|
170
170
|
# ==> Configuration for :saml_authenticatable
|
171
171
|
|
172
|
-
config.saml_attribute_map_resolver = MyAttributeMapResolver
|
172
|
+
config.saml_attribute_map_resolver = "MyAttributeMapResolver"
|
173
173
|
end
|
174
174
|
```
|
175
175
|
|
@@ -56,7 +56,7 @@ module Devise
|
|
56
56
|
|
57
57
|
# Reader that can parse entity id from a SAMLMessage
|
58
58
|
mattr_accessor :idp_entity_id_reader
|
59
|
-
@@idp_entity_id_reader ||= ::DeviseSamlAuthenticatable::DefaultIdpEntityIdReader
|
59
|
+
@@idp_entity_id_reader ||= "::DeviseSamlAuthenticatable::DefaultIdpEntityIdReader"
|
60
60
|
|
61
61
|
# Implements a #handle method that takes the response and strategy as an argument
|
62
62
|
mattr_accessor :saml_failed_callback
|
@@ -69,7 +69,7 @@ module Devise
|
|
69
69
|
|
70
70
|
# Instead of storing the attribute_map in attribute-map.yml, store it in the database, or set it programatically
|
71
71
|
mattr_accessor :saml_attribute_map_resolver
|
72
|
-
@@saml_attribute_map_resolver ||= ::DeviseSamlAuthenticatable::DefaultAttributeMapResolver
|
72
|
+
@@saml_attribute_map_resolver ||= "::DeviseSamlAuthenticatable::DefaultAttributeMapResolver"
|
73
73
|
|
74
74
|
# Implements a #validate method that takes the retrieved resource and response right after retrieval,
|
75
75
|
# and returns true if it's valid. False will cause authentication to fail.
|
@@ -82,7 +82,15 @@ module Devise
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def attribute_map(saml_response = nil)
|
85
|
-
|
85
|
+
attribute_map_resolver.new(saml_response).attribute_map
|
86
|
+
end
|
87
|
+
|
88
|
+
def attribute_map_resolver
|
89
|
+
if Devise.saml_attribute_map_resolver.respond_to?(:new)
|
90
|
+
Devise.saml_attribute_map_resolver
|
91
|
+
else
|
92
|
+
Devise.saml_attribute_map_resolver.constantize
|
93
|
+
end
|
86
94
|
end
|
87
95
|
end
|
88
96
|
end
|
@@ -22,7 +22,7 @@ module DeviseSamlAuthenticatable
|
|
22
22
|
def adapter_based_config(idp_entity_id)
|
23
23
|
config = Marshal.load(Marshal.dump(Devise.saml_config))
|
24
24
|
|
25
|
-
|
25
|
+
idp_settings_adapter.settings(idp_entity_id).each do |k,v|
|
26
26
|
acc = "#{k.to_s}=".to_sym
|
27
27
|
|
28
28
|
if config.respond_to? acc
|
@@ -33,7 +33,23 @@ module DeviseSamlAuthenticatable
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def get_idp_entity_id(params)
|
36
|
-
|
36
|
+
idp_entity_id_reader.entity_id(params)
|
37
|
+
end
|
38
|
+
|
39
|
+
def idp_entity_id_reader
|
40
|
+
if Devise.idp_entity_id_reader.respond_to?(:entity_id)
|
41
|
+
Devise.idp_entity_id_reader
|
42
|
+
else
|
43
|
+
@idp_entity_id_reader ||= Devise.idp_entity_id_reader.constantize
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def idp_settings_adapter
|
48
|
+
if Devise.idp_settings_adapter.respond_to?(:settings)
|
49
|
+
Devise.idp_settings_adapter
|
50
|
+
else
|
51
|
+
@idp_settings_adapter ||= Devise.idp_settings_adapter.constantize
|
52
|
+
end
|
37
53
|
end
|
38
54
|
end
|
39
55
|
end
|
@@ -141,7 +141,7 @@ describe "SAML Authentication", type: :feature do
|
|
141
141
|
context "when the idp_settings_adapter key is set" do
|
142
142
|
before(:each) do
|
143
143
|
create_app('idp', 'INCLUDE_SUBJECT_IN_ATTRIBUTES' => "false")
|
144
|
-
create_app('sp', 'USE_SUBJECT_TO_AUTHENTICATE' => "true", 'IDP_SETTINGS_ADAPTER' => "IdpSettingsAdapter", 'IDP_ENTITY_ID_READER' => "OurEntityIdReader")
|
144
|
+
create_app('sp', 'USE_SUBJECT_TO_AUTHENTICATE' => "true", 'IDP_SETTINGS_ADAPTER' => '"IdpSettingsAdapter"', 'IDP_ENTITY_ID_READER' => '"OurEntityIdReader"')
|
145
145
|
|
146
146
|
# use a different port for this entity ID; configured in spec/support/idp_settings_adapter.rb.erb
|
147
147
|
@idp_pid = start_app('idp', 8010)
|
@@ -204,7 +204,7 @@ describe "SAML Authentication", type: :feature do
|
|
204
204
|
)
|
205
205
|
create_app(
|
206
206
|
"sp",
|
207
|
-
"ATTRIBUTE_MAP_RESOLVER" => "AttributeMapResolver",
|
207
|
+
"ATTRIBUTE_MAP_RESOLVER" => '"AttributeMapResolver"',
|
208
208
|
"USE_SUBJECT_TO_AUTHENTICATE" => "true",
|
209
209
|
)
|
210
210
|
@idp_pid = start_app("idp", idp_port)
|
data/spec/support/sp_template.rb
CHANGED
@@ -6,7 +6,7 @@ attribute_map_resolver = ENV.fetch("ATTRIBUTE_MAP_RESOLVER", "nil")
|
|
6
6
|
saml_session_index_key = ENV.fetch('SAML_SESSION_INDEX_KEY', ":session_index")
|
7
7
|
use_subject_to_authenticate = ENV.fetch('USE_SUBJECT_TO_AUTHENTICATE')
|
8
8
|
idp_settings_adapter = ENV.fetch('IDP_SETTINGS_ADAPTER', "nil")
|
9
|
-
idp_entity_id_reader = ENV.fetch('IDP_ENTITY_ID_READER', "DeviseSamlAuthenticatable::DefaultIdpEntityIdReader")
|
9
|
+
idp_entity_id_reader = ENV.fetch('IDP_ENTITY_ID_READER', '"DeviseSamlAuthenticatable::DefaultIdpEntityIdReader"')
|
10
10
|
saml_failed_callback = ENV.fetch('SAML_FAILED_CALLBACK', "nil")
|
11
11
|
|
12
12
|
if Rails::VERSION::MAJOR < 5 || (Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR < 2)
|
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.6.
|
4
|
+
version: 1.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josef Sauter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|