saml-kit 1.0.10 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/saml/kit/version.rb +1 -1
- data/lib/saml/kit/xml_templatable.rb +6 -3
- data/saml-kit.gemspec +6 -1
- data/spec/examples/authentication_request_spec.rb +27 -0
- data/spec/examples/identity_provider_metadata_spec.rb +20 -0
- data/spec/examples/logout_request_spec.rb +30 -0
- data/spec/examples/logout_response_spec.rb +39 -0
- data/spec/examples/metadata_spec.rb +44 -0
- data/spec/examples/principal.rb +16 -0
- data/spec/examples/response_spec.rb +86 -0
- data/spec/examples/saml-kit.gif +0 -0
- data/spec/examples/service_provider_metadata_spec.rb +32 -0
- metadata +25 -13
- data/.gitignore +0 -12
- data/.gitlab-ci.yml +0 -15
- data/.rspec +0 -2
- data/.rubocop.yml +0 -95
- data/.rubocop_todo.yml +0 -45
- data/.travis.yml +0 -10
- data/bin/cibuild +0 -21
- data/bin/console +0 -15
- data/bin/lint +0 -11
- data/bin/setup +0 -6
- data/bin/test +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cdef4d4affc0a46b4d12269cea2293339145ce6e4207b1bb61cefed17a7cace
|
4
|
+
data.tar.gz: e6ed597e3e98e725b30d9904c50b1a91999ff948e5dec320b1585f731554e9d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff1620e3d48598653095303f3f33f5234192eea6fcbc7ffc7662a701799ae26c3e01050b741c71be2a824f005e9e3019175b1347ff2e9863ca02cf9184145457
|
7
|
+
data.tar.gz: 34665a677b65c2e205e9c57a8a86ab67e5b8156dfe798bb0bdbce3f7a1eab4912b08038984d81c1c1885d1c22a0a3528bfb8cf87d173c2ae4c15c86550e8a484
|
data/lib/saml/kit/version.rb
CHANGED
@@ -3,12 +3,15 @@
|
|
3
3
|
module Saml
|
4
4
|
module Kit
|
5
5
|
module XmlTemplatable
|
6
|
+
TEMPLATES_DIR = Pathname.new(File.join(__dir__, 'builders/templates/'))
|
6
7
|
include ::Xml::Kit::Templatable
|
7
8
|
|
8
9
|
def template_path
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
@template_path ||= TEMPLATES_DIR.join(template_name)
|
11
|
+
end
|
12
|
+
|
13
|
+
def template_name
|
14
|
+
"#{self.class.name.split('::').last.underscore}.builder"
|
12
15
|
end
|
13
16
|
|
14
17
|
# Returns true if an embedded signature is requested and at least one signing certificate is available via the configuration.
|
data/saml-kit.gemspec
CHANGED
@@ -18,7 +18,11 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.required_ruby_version = '>= 2.2.0'
|
19
19
|
|
20
20
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
21
|
-
|
21
|
+
(
|
22
|
+
f.match(%r{^(test|spec|features)/}) ||
|
23
|
+
f.match(/^\..*/) ||
|
24
|
+
f.match(%r{^bin/.*})
|
25
|
+
) && !f.match(%r{^spec/examples.*/})
|
22
26
|
end
|
23
27
|
spec.metadata['yard.run'] = 'yri'
|
24
28
|
spec.bindir = 'exe'
|
@@ -34,6 +38,7 @@ Gem::Specification.new do |spec|
|
|
34
38
|
spec.add_development_dependency 'rspec-benchmark', '~> 0.3'
|
35
39
|
spec.add_development_dependency 'rubocop', '~> 0.52'
|
36
40
|
spec.add_development_dependency 'rubocop-rspec', '~> 1.22'
|
41
|
+
spec.add_development_dependency 'ruby-prof'
|
37
42
|
spec.add_development_dependency 'simplecov', '~> 0.15'
|
38
43
|
spec.add_development_dependency 'webmock', '~> 3.1'
|
39
44
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
RSpec.describe "Authentication Request" do
|
2
|
+
it 'produces an authentication request' do
|
3
|
+
xml = Saml::Kit::Metadata.build_xml do |builder|
|
4
|
+
builder.contact_email = 'hi@example.com'
|
5
|
+
builder.organization_name = "Acme, Inc"
|
6
|
+
builder.organization_url = 'https://www.example.com'
|
7
|
+
builder.build_identity_provider do |x|
|
8
|
+
x.add_single_sign_on_service('https://www.example.com/login', binding: :http_post)
|
9
|
+
x.add_single_sign_on_service('https://www.example.com/login', binding: :http_redirect)
|
10
|
+
x.add_single_logout_service('https://www.example.com/logout', binding: :http_post)
|
11
|
+
x.name_id_formats = [ Saml::Kit::Namespaces::EMAIL_ADDRESS ]
|
12
|
+
x.attributes << :id
|
13
|
+
x.attributes << :email
|
14
|
+
end
|
15
|
+
builder.build_service_provider do |x|
|
16
|
+
x.add_assertion_consumer_service('https://www.example.com/consume', binding: :http_post)
|
17
|
+
x.add_single_logout_service('https://www.example.com/logout', binding: :http_post)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
idp = Saml::Kit::IdentityProviderMetadata.new(xml)
|
22
|
+
url, saml_params = idp.login_request_for(binding: :http_post)
|
23
|
+
|
24
|
+
expect(url).to eql("https://www.example.com/login")
|
25
|
+
expect(saml_params['SAMLRequest']).to be_present
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
RSpec.describe "Identity Provider Metadata" do
|
2
|
+
it 'produces identity provider metadata' do
|
3
|
+
xml = Saml::Kit::Metadata.build_xml do |builder|
|
4
|
+
builder.contact_email = 'hi@example.com'
|
5
|
+
builder.organization_name = "Acme, Inc"
|
6
|
+
builder.organization_url = 'https://www.example.com'
|
7
|
+
builder.build_identity_provider do |x|
|
8
|
+
x.add_single_sign_on_service('https://www.example.com/login', binding: :http_post)
|
9
|
+
x.add_single_sign_on_service('https://www.example.com/login', binding: :http_redirect)
|
10
|
+
x.add_single_logout_service('https://www.example.com/logout', binding: :http_post)
|
11
|
+
x.name_id_formats = [ Saml::Kit::Namespaces::EMAIL_ADDRESS ]
|
12
|
+
x.attributes << :id
|
13
|
+
x.attributes << :email
|
14
|
+
end
|
15
|
+
end
|
16
|
+
expect(xml).to be_present
|
17
|
+
expect(xml).to have_xpath("//md:EntityDescriptor//md:IDPSSODescriptor")
|
18
|
+
expect(xml).to_not have_xpath("//md:EntityDescriptor//md:SPSSODescriptor")
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative './principal'
|
2
|
+
|
3
|
+
RSpec.describe "Logout Request" do
|
4
|
+
let(:user) { Principal.new(id: SecureRandom.uuid, email: "hello@example.com") }
|
5
|
+
|
6
|
+
it 'produces a SAMLRequest' do
|
7
|
+
xml = Saml::Kit::Metadata.build_xml do |builder|
|
8
|
+
builder.contact_email = 'hi@example.com'
|
9
|
+
builder.organization_name = "Acme, Inc"
|
10
|
+
builder.organization_url = 'https://www.example.com'
|
11
|
+
builder.build_identity_provider do |x|
|
12
|
+
x.add_single_sign_on_service('https://www.example.com/login', binding: :http_post)
|
13
|
+
x.add_single_sign_on_service('https://www.example.com/login', binding: :http_redirect)
|
14
|
+
x.add_single_logout_service('https://www.example.com/logout', binding: :http_post)
|
15
|
+
x.name_id_formats = [ Saml::Kit::Namespaces::EMAIL_ADDRESS ]
|
16
|
+
x.attributes << :id
|
17
|
+
x.attributes << :email
|
18
|
+
end
|
19
|
+
builder.build_service_provider do |x|
|
20
|
+
x.add_assertion_consumer_service('https://www.example.com/consume', binding: :http_post)
|
21
|
+
x.add_single_logout_service('https://www.example.com/logout', binding: :http_post)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
sp = Saml::Kit::IdentityProviderMetadata.new(xml)
|
26
|
+
url, saml_params = sp.logout_request_for(user, binding: :http_post)
|
27
|
+
expect(url).to eql("https://www.example.com/logout")
|
28
|
+
expect(saml_params['SAMLRequest']).to be_present
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require_relative './principal'
|
2
|
+
|
3
|
+
RSpec.describe "Logout Response" do
|
4
|
+
let(:user) { Principal.new(id: SecureRandom.uuid, email: "hello@example.com") }
|
5
|
+
|
6
|
+
it 'generates a logout response' do
|
7
|
+
xml = Saml::Kit::Metadata.build_xml do |builder|
|
8
|
+
builder.contact_email = 'hi@example.com'
|
9
|
+
builder.organization_name = "Acme, Inc"
|
10
|
+
builder.organization_url = 'https://www.example.com'
|
11
|
+
builder.build_identity_provider do |x|
|
12
|
+
x.add_single_sign_on_service('https://www.example.com/login', binding: :http_post)
|
13
|
+
x.add_single_sign_on_service('https://www.example.com/login', binding: :http_redirect)
|
14
|
+
x.add_single_logout_service('https://www.example.com/logout', binding: :http_post)
|
15
|
+
x.name_id_formats = [ Saml::Kit::Namespaces::EMAIL_ADDRESS ]
|
16
|
+
x.attributes << :id
|
17
|
+
x.attributes << :email
|
18
|
+
end
|
19
|
+
builder.build_service_provider do |x|
|
20
|
+
x.add_assertion_consumer_service('https://www.example.com/consume', binding: :http_post)
|
21
|
+
x.add_single_logout_service('https://www.example.com/logout', binding: :http_post)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
idp = Saml::Kit::IdentityProviderMetadata.new(xml)
|
26
|
+
url, saml_params = idp.logout_request_for(user, binding: :http_post)
|
27
|
+
uri = URI.parse("#{url}?#{saml_params.map { |(x, y)| "#{x}=#{y}" }.join('&')}")
|
28
|
+
|
29
|
+
raw_params = Hash[uri.query.split("&").map { |x| x.split("=", 2) }].symbolize_keys
|
30
|
+
|
31
|
+
binding = idp.single_logout_service_for(binding: :http_post)
|
32
|
+
saml_request = binding.deserialize(raw_params)
|
33
|
+
sp = Saml::Kit::ServiceProviderMetadata.new(xml)
|
34
|
+
allow(saml_request).to receive(:provider).and_return(sp)
|
35
|
+
url, saml_params = saml_request.response_for(binding: :http_post)
|
36
|
+
expect(url).to eql("https://www.example.com/logout")
|
37
|
+
expect(saml_params['SAMLResponse']).to be_present
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
RSpec.describe "Metadata" do
|
2
|
+
it 'consumes metadata' do
|
3
|
+
raw_xml = <<-XML
|
4
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
5
|
+
<EntityDescriptor entityID="https://www.example.com/metadata" xmlns="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="_50643868-c737-40c8-a30d-b5dc7f3c69d9">
|
6
|
+
<IDPSSODescriptor WantAuthnRequestsSigned="true" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
|
7
|
+
<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:persistent</NameIDFormat>
|
8
|
+
<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://www.example.com/login"/>
|
9
|
+
</IDPSSODescriptor>
|
10
|
+
<SPSSODescriptor AuthnRequestsSigned="false" WantAssertionsSigned="true" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
|
11
|
+
<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat>
|
12
|
+
<AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://www.example.com/consume" index="0" isDefault="true"/>
|
13
|
+
</SPSSODescriptor>
|
14
|
+
</EntityDescriptor>
|
15
|
+
XML
|
16
|
+
|
17
|
+
metadata = Saml::Kit::Metadata.from(raw_xml)
|
18
|
+
expect(metadata.entity_id).to eql('https://www.example.com/metadata')
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'produces metadata for a service provider and identity provider' do
|
22
|
+
metadata = Saml::Kit::Metadata.build do |builder|
|
23
|
+
builder.contact_email = 'hi@example.com'
|
24
|
+
builder.organization_name = "Acme, Inc"
|
25
|
+
builder.organization_url = 'https://www.example.com'
|
26
|
+
builder.build_identity_provider do |x|
|
27
|
+
x.add_single_sign_on_service('https://www.example.com/login', binding: :http_post)
|
28
|
+
x.add_single_sign_on_service('https://www.example.com/login', binding: :http_redirect)
|
29
|
+
x.add_single_logout_service('https://www.example.com/logout', binding: :http_post)
|
30
|
+
x.name_id_formats = [ Saml::Kit::Namespaces::EMAIL_ADDRESS ]
|
31
|
+
x.attributes << :id
|
32
|
+
x.attributes << :email
|
33
|
+
end
|
34
|
+
builder.build_service_provider do |x|
|
35
|
+
x.add_assertion_consumer_service('https://www.example.com/consume', binding: :http_post)
|
36
|
+
x.add_single_logout_service('https://www.example.com/logout', binding: :http_post)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
xml = metadata.to_xml(pretty: true)
|
40
|
+
expect(xml).to be_present
|
41
|
+
expect(xml).to have_xpath("//md:EntityDescriptor//md:IDPSSODescriptor")
|
42
|
+
expect(xml).to have_xpath("//md:EntityDescriptor//md:SPSSODescriptor")
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class Principal
|
2
|
+
attr_reader :id, :email
|
3
|
+
|
4
|
+
def initialize(id:, email:)
|
5
|
+
@id = id
|
6
|
+
@email = email
|
7
|
+
end
|
8
|
+
|
9
|
+
def name_id_for(name_id_format)
|
10
|
+
Saml::Kit::Namespaces::PERSISTENT == name_id_format ? id : email
|
11
|
+
end
|
12
|
+
|
13
|
+
def assertion_attributes_for(request)
|
14
|
+
request.trusted? ? { access_token: SecureRandom.uuid } : {}
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require_relative './principal'
|
2
|
+
|
3
|
+
RSpec.describe "Response" do
|
4
|
+
let(:user) { Principal.new(id: SecureRandom.uuid, email: "hello@example.com") }
|
5
|
+
let(:request) { Saml::Kit::AuthenticationRequest.build }
|
6
|
+
|
7
|
+
it 'consumes a Response' do
|
8
|
+
raw_xml = <<-XML
|
9
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
10
|
+
<Response xmlns="urn:oasis:names:tc:SAML:2.0:protocol" ID="_32594448-5d41-4e5b-87c5-ee32ef1f14f7" Version="2.0" IssueInstant="2017-12-23T18:13:58Z" Destination="" Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" InResponseTo="_55236abc-636f-41d1-8c0d-81c5384786dd">
|
11
|
+
<Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">https://www.example.com/metadata</Issuer>
|
12
|
+
<Status>
|
13
|
+
<StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
|
14
|
+
</Status>
|
15
|
+
<Assertion xmlns="urn:oasis:names:tc:SAML:2.0:assertion" ID="_843f14bc-51e9-40d3-9861-23e59ccc8427" IssueInstant="2017-12-23T18:13:58Z" Version="2.0">
|
16
|
+
<Issuer>https://www.example.com/metadata</Issuer>
|
17
|
+
<Subject>
|
18
|
+
<NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent">ed215a85-597f-4e74-a892-ac83c386190b</NameID>
|
19
|
+
<SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
|
20
|
+
<SubjectConfirmationData InResponseTo="_55236abc-636f-41d1-8c0d-81c5384786dd" NotOnOrAfter="2017-12-23T21:13:58Z" Recipient=""/>
|
21
|
+
</SubjectConfirmation>
|
22
|
+
</Subject>
|
23
|
+
<Conditions NotBefore="2017-12-23T18:13:58Z" NotOnOrAfter="2017-12-23T21:13:58Z">
|
24
|
+
<AudienceRestriction>
|
25
|
+
<Audience/>
|
26
|
+
</AudienceRestriction>
|
27
|
+
</Conditions>
|
28
|
+
<AuthnStatement AuthnInstant="2017-12-23T18:13:58Z" SessionIndex="_843f14bc-51e9-40d3-9861-23e59ccc8427" SessionNotOnOrAfter="2017-12-23T21:13:58Z">
|
29
|
+
<AuthnContext>
|
30
|
+
<AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Password</AuthnContextClassRef>
|
31
|
+
</AuthnContext>
|
32
|
+
</AuthnStatement>
|
33
|
+
</Assertion>
|
34
|
+
</Response>
|
35
|
+
XML
|
36
|
+
response = Saml::Kit::Response.new(raw_xml)
|
37
|
+
expect(response.assertion.name_id).to eql('ed215a85-597f-4e74-a892-ac83c386190b')
|
38
|
+
expect(response.issuer).to eql("https://www.example.com/metadata")
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'builds a Response document' do
|
42
|
+
response = Saml::Kit::Response.build(user, request) do |builder|
|
43
|
+
builder.issuer = "blah"
|
44
|
+
end
|
45
|
+
|
46
|
+
expect(response.issuer).to eql("blah")
|
47
|
+
expect(response.to_xml).to have_xpath("/samlp:Response/saml:Assertion/saml:Issuer[text()=\"blah\"]")
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'generates a SAMLResponse' do
|
51
|
+
xml = Saml::Kit::Metadata.build_xml do |builder|
|
52
|
+
builder.contact_email = 'hi@example.com'
|
53
|
+
builder.organization_name = "Acme, Inc"
|
54
|
+
builder.organization_url = 'https://www.example.com'
|
55
|
+
builder.build_identity_provider do |x|
|
56
|
+
x.add_single_sign_on_service('https://www.example.com/login', binding: :http_post)
|
57
|
+
x.add_single_sign_on_service('https://www.example.com/login', binding: :http_redirect)
|
58
|
+
x.add_single_logout_service('https://www.example.com/logout', binding: :http_post)
|
59
|
+
x.name_id_formats = [ Saml::Kit::Namespaces::EMAIL_ADDRESS ]
|
60
|
+
x.attributes << :id
|
61
|
+
x.attributes << :email
|
62
|
+
end
|
63
|
+
builder.build_service_provider do |x|
|
64
|
+
x.add_assertion_consumer_service('https://www.example.com/consume', binding: :http_post)
|
65
|
+
x.add_single_logout_service('https://www.example.com/logout', binding: :http_post)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
idp = Saml::Kit::IdentityProviderMetadata.new(xml)
|
70
|
+
url, saml_params = idp.login_request_for(binding: :http_post)
|
71
|
+
uri = URI.parse("#{url}?#{saml_params.map { |(x, y)| "#{x}=#{y}" }.join('&')}")
|
72
|
+
|
73
|
+
sp = Saml::Kit::ServiceProviderMetadata.new(xml)
|
74
|
+
|
75
|
+
binding = idp.single_sign_on_service_for(binding: :http_post)
|
76
|
+
raw_params = Hash[uri.query.split("&").map { |x| x.split("=", 2) }].symbolize_keys
|
77
|
+
saml_request = binding.deserialize(raw_params)
|
78
|
+
allow(saml_request).to receive(:provider).and_return(sp)
|
79
|
+
|
80
|
+
url, saml_params = saml_request.response_for(user, binding: :http_post)
|
81
|
+
|
82
|
+
expect(url).to eql("https://www.example.com/consume")
|
83
|
+
expect(saml_params['SAMLResponse']).to be_present
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
Binary file
|
@@ -0,0 +1,32 @@
|
|
1
|
+
RSpec.describe "Service Provider Metadata" do
|
2
|
+
it 'consumes service provider_metadata' do
|
3
|
+
raw_xml = <<-XML
|
4
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
5
|
+
<EntityDescriptor entityID="myEntityId" xmlns="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
|
6
|
+
<SPSSODescriptor AuthnRequestsSigned="false" WantAssertionsSigned="true" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
|
7
|
+
<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat>
|
8
|
+
</SPSSODescriptor>
|
9
|
+
</EntityDescriptor>
|
10
|
+
XML
|
11
|
+
|
12
|
+
metadata = Saml::Kit::ServiceProviderMetadata.new(raw_xml)
|
13
|
+
expect(metadata.entity_id).to eql('myEntityId')
|
14
|
+
expect(metadata.name_id_formats).to match_array([Saml::Kit::Namespaces::PERSISTENT])
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'produces service provider metadata' do
|
18
|
+
metadata = Saml::Kit::Metadata.build do |builder|
|
19
|
+
builder.contact_email = 'hi@example.com'
|
20
|
+
builder.organization_name = "Acme, Inc"
|
21
|
+
builder.organization_url = 'https://www.example.com'
|
22
|
+
builder.build_service_provider do |x|
|
23
|
+
x.add_assertion_consumer_service('https://www.example.com/consume', binding: :http_post)
|
24
|
+
x.add_single_logout_service('https://www.example.com/logout', binding: :http_post)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
xml = metadata.to_xml(pretty: true)
|
28
|
+
expect(xml).to be_present
|
29
|
+
expect(xml).to_not have_xpath("//md:EntityDescriptor//md:IDPSSODescriptor")
|
30
|
+
expect(xml).to have_xpath("//md:EntityDescriptor//md:SPSSODescriptor")
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: saml-kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mo khan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -142,6 +142,20 @@ dependencies:
|
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '1.22'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: ruby-prof
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
145
159
|
- !ruby/object:Gem::Dependency
|
146
160
|
name: simplecov
|
147
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,21 +194,10 @@ executables:
|
|
180
194
|
extensions: []
|
181
195
|
extra_rdoc_files: []
|
182
196
|
files:
|
183
|
-
- ".gitignore"
|
184
|
-
- ".gitlab-ci.yml"
|
185
|
-
- ".rspec"
|
186
|
-
- ".rubocop.yml"
|
187
|
-
- ".rubocop_todo.yml"
|
188
|
-
- ".travis.yml"
|
189
197
|
- Gemfile
|
190
198
|
- LICENSE.txt
|
191
199
|
- README.md
|
192
200
|
- Rakefile
|
193
|
-
- bin/cibuild
|
194
|
-
- bin/console
|
195
|
-
- bin/lint
|
196
|
-
- bin/setup
|
197
|
-
- bin/test
|
198
201
|
- exe/saml-kit-create-self-signed-certificate
|
199
202
|
- exe/saml-kit-decode-http-post
|
200
203
|
- exe/saml-kit-decode-http-redirect
|
@@ -273,6 +276,15 @@ files:
|
|
273
276
|
- lib/saml/kit/xsd/xmldsig-core-schema.xsd
|
274
277
|
- lib/saml/kit/xsd_validatable.rb
|
275
278
|
- saml-kit.gemspec
|
279
|
+
- spec/examples/authentication_request_spec.rb
|
280
|
+
- spec/examples/identity_provider_metadata_spec.rb
|
281
|
+
- spec/examples/logout_request_spec.rb
|
282
|
+
- spec/examples/logout_response_spec.rb
|
283
|
+
- spec/examples/metadata_spec.rb
|
284
|
+
- spec/examples/principal.rb
|
285
|
+
- spec/examples/response_spec.rb
|
286
|
+
- spec/examples/saml-kit.gif
|
287
|
+
- spec/examples/service_provider_metadata_spec.rb
|
276
288
|
homepage: https://github.com/saml-kit/saml-kit
|
277
289
|
licenses:
|
278
290
|
- MIT
|
data/.gitignore
DELETED
data/.gitlab-ci.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
image: ruby:2.2
|
2
|
-
|
3
|
-
before_script:
|
4
|
-
- apt-get update && apt-get install -y locales
|
5
|
-
- echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
|
6
|
-
- locale-gen
|
7
|
-
- export LC_ALL=en_US.UTF-8
|
8
|
-
|
9
|
-
rspec:
|
10
|
-
script:
|
11
|
-
- bin/cibuild
|
12
|
-
|
13
|
-
lint:
|
14
|
-
script:
|
15
|
-
- bin/lint
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
2
|
-
|
3
|
-
require:
|
4
|
-
- rubocop/cop/internal_affairs
|
5
|
-
- rubocop-rspec
|
6
|
-
|
7
|
-
AllCops:
|
8
|
-
Exclude:
|
9
|
-
- 'coverage/**/*'
|
10
|
-
- 'pkg/**/*'
|
11
|
-
- 'spec/fixtures/**/*'
|
12
|
-
- 'spec/examples/**/*'
|
13
|
-
- 'tmp/**/*'
|
14
|
-
- 'vendor/**/*'
|
15
|
-
TargetRubyVersion: 2.2
|
16
|
-
|
17
|
-
Layout/ClassStructure:
|
18
|
-
Enabled: true
|
19
|
-
Categories:
|
20
|
-
module_inclusion:
|
21
|
-
- include
|
22
|
-
- prepend
|
23
|
-
- extend
|
24
|
-
ExpectedOrder:
|
25
|
-
- module_inclusion
|
26
|
-
- constants
|
27
|
-
- public_class_methods
|
28
|
-
- initializer
|
29
|
-
- instance_methods
|
30
|
-
- protected_methods
|
31
|
-
- private_methods
|
32
|
-
|
33
|
-
Layout/EndOfLine:
|
34
|
-
EnforcedStyle: lf
|
35
|
-
|
36
|
-
Layout/IndentArray:
|
37
|
-
EnforcedStyle: consistent
|
38
|
-
|
39
|
-
Layout/IndentHeredoc:
|
40
|
-
EnforcedStyle: active_support
|
41
|
-
|
42
|
-
Lint/AmbiguousBlockAssociation:
|
43
|
-
Exclude:
|
44
|
-
- 'spec/**/*.rb'
|
45
|
-
|
46
|
-
Lint/InterpolationCheck:
|
47
|
-
Exclude:
|
48
|
-
- 'spec/**/*.rb'
|
49
|
-
|
50
|
-
Metrics/BlockLength:
|
51
|
-
Exclude:
|
52
|
-
- '**/**/*.builder'
|
53
|
-
- '**/*.rake'
|
54
|
-
- '*.gemspec'
|
55
|
-
- 'Rakefile'
|
56
|
-
- 'spec/**/*.rb'
|
57
|
-
|
58
|
-
Metrics/ModuleLength:
|
59
|
-
Exclude:
|
60
|
-
- 'spec/**/*.rb'
|
61
|
-
|
62
|
-
Metrics/LineLength:
|
63
|
-
Exclude:
|
64
|
-
- 'spec/**/*.rb'
|
65
|
-
|
66
|
-
Naming/FileName:
|
67
|
-
Exclude:
|
68
|
-
- 'lib/saml-kit.rb'
|
69
|
-
|
70
|
-
Style/Documentation:
|
71
|
-
Enabled: false
|
72
|
-
|
73
|
-
Style/EachWithObject:
|
74
|
-
Enabled: false
|
75
|
-
|
76
|
-
Style/StringLiterals:
|
77
|
-
EnforcedStyle: 'single_quotes'
|
78
|
-
|
79
|
-
Style/TrailingCommaInLiteral:
|
80
|
-
Enabled: false
|
81
|
-
|
82
|
-
RSpec/ExampleLength:
|
83
|
-
Max: 80
|
84
|
-
|
85
|
-
RSpec/MultipleExpectations:
|
86
|
-
Enabled: false
|
87
|
-
|
88
|
-
RSpec/NamedSubject:
|
89
|
-
Enabled: false
|
90
|
-
|
91
|
-
RSpec/NestedGroups:
|
92
|
-
Max: 7
|
93
|
-
|
94
|
-
RSpec/SubjectStub:
|
95
|
-
Enabled: false
|
data/.rubocop_todo.yml
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2018-02-16 22:08:54 -0700 using RuboCop version 0.52.1.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 1
|
10
|
-
# Cop supports --auto-correct.
|
11
|
-
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
|
12
|
-
Lint/UnusedMethodArgument:
|
13
|
-
Exclude:
|
14
|
-
- 'lib/saml/kit/invalid_document.rb'
|
15
|
-
|
16
|
-
# Offense count: 2
|
17
|
-
Metrics/AbcSize:
|
18
|
-
Max: 16
|
19
|
-
|
20
|
-
# Offense count: 3
|
21
|
-
# Configuration parameters: CountComments.
|
22
|
-
Metrics/ClassLength:
|
23
|
-
Max: 136
|
24
|
-
|
25
|
-
# Offense count: 6
|
26
|
-
# Configuration parameters: CountComments.
|
27
|
-
Metrics/MethodLength:
|
28
|
-
Max: 13
|
29
|
-
|
30
|
-
# Offense count: 1
|
31
|
-
Style/DateTime:
|
32
|
-
Exclude:
|
33
|
-
- 'lib/saml/kit/assertion.rb'
|
34
|
-
|
35
|
-
# Offense count: 1
|
36
|
-
# Cop supports --auto-correct.
|
37
|
-
Style/IfUnlessModifier:
|
38
|
-
Exclude:
|
39
|
-
- 'lib/saml/kit/builders/authentication_request.rb'
|
40
|
-
|
41
|
-
# Offense count: 128
|
42
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
43
|
-
# URISchemes: http, https
|
44
|
-
Metrics/LineLength:
|
45
|
-
Max: 313
|
data/.travis.yml
DELETED
data/bin/cibuild
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
# script/cibuild: Setup environment for CI to run tests. This is primarily
|
4
|
-
# designed to run on the continuous integration server.
|
5
|
-
|
6
|
-
set -e
|
7
|
-
|
8
|
-
cd "$(dirname "$0")/.."
|
9
|
-
|
10
|
-
echo [$(date "+%H:%M:%S")] "==> Started at…"
|
11
|
-
|
12
|
-
# GC customizations
|
13
|
-
export RUBY_GC_MALLOC_LIMIT=79000000
|
14
|
-
export RUBY_GC_HEAP_INIT_SLOTS=800000
|
15
|
-
export RUBY_HEAP_FREE_MIN=100000
|
16
|
-
export RUBY_HEAP_SLOTS_INCREMENT=400000
|
17
|
-
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
|
18
|
-
|
19
|
-
ruby -v
|
20
|
-
gem install bundler --no-ri --no-rdoc --conservative
|
21
|
-
bin/test
|
data/bin/console
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'bundler/setup'
|
5
|
-
require 'saml/kit'
|
6
|
-
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
9
|
-
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
# require "pry"
|
12
|
-
# Pry.start
|
13
|
-
|
14
|
-
require 'irb'
|
15
|
-
IRB.start(__FILE__)
|
data/bin/lint
DELETED
data/bin/setup
DELETED
data/bin/test
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
# script/test: Run test suite for application. Optionally pass in a path to an
|
4
|
-
# individual test file to run a single test.
|
5
|
-
|
6
|
-
|
7
|
-
set -e
|
8
|
-
|
9
|
-
cd "$(dirname "$0")/.."
|
10
|
-
|
11
|
-
[ -z "$DEBUG" ] || set -x
|
12
|
-
|
13
|
-
echo [$(date "+%H:%M:%S")] "==> Running setup…"
|
14
|
-
bin/setup
|
15
|
-
|
16
|
-
echo [$(date "+%H:%M:%S")] "==> Running tests…"
|
17
|
-
bundle exec rake spec
|