Skip to content

Commit

Permalink
Replace Model::attribute_map method (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamstegman authored Sep 14, 2020
1 parent 2d47b4f commit 7b85a13
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/devise_saml_authenticatable/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions spec/devise_saml_authenticatable/model_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7b85a13

Please sign in to comment.