diff --git a/lib/devise_saml_authenticatable/model.rb b/lib/devise_saml_authenticatable/model.rb index 2f74139..b22b18b 100644 --- a/lib/devise_saml_authenticatable/model.rb +++ b/lib/devise_saml_authenticatable/model.rb @@ -33,7 +33,7 @@ def authenticate_with_saml(saml_response, relay_state) key = Devise.saml_default_user_key decorated_response = ::SamlAuthenticatable::SamlResponse.new( saml_response, - Devise.saml_attribute_map_resolver.new(saml_response).attribute_map, + attribute_map(saml_response), ) if Devise.saml_use_subject auth_value = saml_response.name_id @@ -85,6 +85,10 @@ def reset_session_key_for(name_id) def find_for_shibb_authentication(conditions) find_for_authentication(conditions) end + + def attribute_map(saml_response = nil) + Devise.saml_attribute_map_resolver.new(saml_response).attribute_map + end end end end diff --git a/spec/devise_saml_authenticatable/model_spec.rb b/spec/devise_saml_authenticatable/model_spec.rb index 6b549cf..f738cc1 100644 --- a/spec/devise_saml_authenticatable/model_spec.rb +++ b/spec/devise_saml_authenticatable/model_spec.rb @@ -385,4 +385,10 @@ def configure_hook(&block) allow(Devise).to receive(:saml_resource_locator).and_return(block) end end + + describe "::attribute_map" do + it "returns the attribute map" do + expect(Model.attribute_map).to eq(attributemap) + end + end end