Comparing changes
v1.0.27
→
v1.0.28
8 commits
6 files changed
Commits
Changed files (6)
lib
saml
spec
saml
kit
builders
lib/saml/kit/attribute_statement.rb
@@ -15,8 +15,8 @@ module Saml
def attributes
@attributes ||= search('./saml:Attribute').inject({}) do |memo, item|
namespace = Saml::Kit::Document::NAMESPACES
- attribute = item.at_xpath('./saml:AttributeValue', namespace)
- memo[item.attribute('Name').value] = attribute.try(:text)
+ values = item.search('./saml:AttributeValue', namespace)
+ memo[item.attribute('Name').value] = values.length == 1 ? values[0].try(:text) : values.map { |x| x.try(:text) }
memo
end.with_indifferent_access
end
lib/saml/kit/version.rb
@@ -2,6 +2,6 @@
module Saml
module Kit
- VERSION = '1.0.27'.freeze
+ VERSION = '1.0.28'.freeze
end
end
spec/saml/kit/builders/metadata_spec.rb
@@ -74,4 +74,21 @@ RSpec.describe Saml::Kit::Builders::Metadata do
expect(metadata).to be_valid
end
end
+
+ specify do
+ configuration = Saml::Kit::Configuration.new do |config|
+ config.entity_id = 'https://www.example.org/metadata'
+ config.generate_key_pair_for(use: :signing)
+ config.generate_key_pair_for(use: :encryption)
+ end
+ metadata = Saml::Kit::Metadata.build(configuration: configuration) do |x|
+ x.organization_name = 'Acme'
+ x.contact_email = 'acme@example.org'
+ x.organization_url = 'https://www.example.org'
+ x.build_service_provider do |xxx|
+ xxx.add_assertion_consumer_service('https://www.example.org/assertions', binding: :http_post)
+ end
+ end
+ expect(metadata.to_xml(pretty: true)).to be_present
+ end
end
spec/saml/kit/response_spec.rb
@@ -567,6 +567,12 @@ RSpec.describe Saml::Kit::Response do
expect(subject.status_code).to eql(Saml::Kit::Namespaces::REQUESTER_ERROR)
expect(subject.status_message).to eql(message)
end
+
+ it 'parses an array of attributes' do
+ attributes[:roles] = %i[admin user]
+ subject = described_class.build(user, request)
+ expect(subject.attributes[:roles]).to match_array(%w[admin user])
+ end
end
describe '#build' do
.travis.yml
@@ -1,10 +1,18 @@
sudo: false
+env:
+ - CC_TEST_REPORTER_ID=256cf27053220ac6b8962d6aef566e28753bc58633348ffef9274d3e1a48b31c
language: ruby
rvm:
- 2.2.10
- 2.3.8
- 2.4.5
- 2.5.3
+before_script:
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
+ - chmod +x ./cc-test-reporter
+ - ./cc-test-reporter before-build
script:
- bin/cibuild
- bin/lint
+after_script:
+ - ./cc-test-reporter after-build -t simplecov --exit-code $TRAVIS_TEST_RESULT
README.md
@@ -2,10 +2,11 @@
*Logo courtesy of [@speasley](https://github.com/speasley)*
-[](https://rubygems.org/gems/saml-kit)
+[](https://travis-ci.org/saml-kit/saml-kit)
[](https://codeclimate.com/github/saml-kit/saml-kit)
-[](https://travis-ci.org/saml-kit/saml-kit)
+[](https://rubygems.org/gems/saml-kit)
[](https://hakiri.io/github/saml-kit/saml-kit/master)
+[](https://codeclimate.com/github/saml-kit/saml-kit/test_coverage)
Saml::Kit is a library with the purpose of creating and consuming SAML
documents. It supports the HTTP Post and HTTP Redirect bindings. It can