ruby-saml-mod 0.1.30 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/onelogin/saml.rb +3 -2
- data/lib/onelogin/saml/auth_request.rb +37 -43
- data/lib/onelogin/saml/base_assertion.rb +159 -0
- data/lib/onelogin/saml/logout_request.rb +44 -0
- data/lib/onelogin/saml/logout_response.rb +24 -25
- data/lib/onelogin/saml/response.rb +2 -4
- data/lib/onelogin/saml/settings.rb +23 -17
- data/spec/base_assertion_spec.rb +5 -0
- data/spec/fixtures/logout_request.xml +11 -0
- data/spec/fixtures/logout_response.xml +13 -0
- data/spec/fixtures/test1-cert.pem +21 -0
- data/spec/fixtures/test1-key.pem +15 -0
- data/spec/fixtures/test1-response.xml +62 -0
- data/spec/fixtures/test2-response.xml +70 -0
- data/spec/fixtures/test3-response.xml +9 -0
- data/spec/fixtures/test4-response.xml +57 -0
- data/spec/fixtures/test5-response.xml +48 -0
- data/spec/fixtures/test6-response.xml +9 -0
- data/spec/fixtures/wrong-key.pem +15 -0
- data/spec/fixtures/xml_signature_wrapping_attack_duplicate_ids.xml +11 -0
- data/spec/fixtures/xml_signature_wrapping_attack_response_attributes.xml +45 -0
- data/spec/fixtures/xml_signature_wrapping_attack_response_nameid.xml +44 -0
- data/spec/logout_request_spec.rb +89 -0
- data/spec/logout_response_spec.rb +76 -0
- data/spec/meta_data_spec.rb +39 -0
- data/spec/response_spec.rb +193 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/support/test_server.rb +73 -0
- metadata +77 -10
- data/LICENSE +0 -19
- data/README +0 -7
- data/lib/onelogin/saml/log_out_request.rb +0 -54
- data/ruby-saml-mod.gemspec +0 -33
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-saml-mod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OneLogin LLC
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2014-
|
17
|
+
date: 2014-10-31 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: libxml-ruby
|
@@ -44,20 +44,46 @@ dependencies:
|
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rspec
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - '='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 2.14.1
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - '='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 2.14.1
|
47
75
|
description: 'This is an early fork from https://github.com/onelogin/ruby-saml - I
|
48
76
|
plan to "rebase" these changes ontop of their current version eventually. '
|
49
77
|
email:
|
50
78
|
executables: []
|
51
79
|
extensions: []
|
52
|
-
extra_rdoc_files:
|
53
|
-
- LICENSE
|
80
|
+
extra_rdoc_files: []
|
54
81
|
files:
|
55
|
-
- LICENSE
|
56
|
-
- README
|
57
82
|
- lib/onelogin/saml.rb
|
58
83
|
- lib/onelogin/saml/auth_request.rb
|
59
84
|
- lib/onelogin/saml/authn_contexts.rb
|
60
|
-
- lib/onelogin/saml/
|
85
|
+
- lib/onelogin/saml/base_assertion.rb
|
86
|
+
- lib/onelogin/saml/logout_request.rb
|
61
87
|
- lib/onelogin/saml/logout_response.rb
|
62
88
|
- lib/onelogin/saml/meta_data.rb
|
63
89
|
- lib/onelogin/saml/name_identifiers.rb
|
@@ -65,8 +91,28 @@ files:
|
|
65
91
|
- lib/onelogin/saml/settings.rb
|
66
92
|
- lib/onelogin/saml/status_codes.rb
|
67
93
|
- lib/xml_sec.rb
|
68
|
-
-
|
69
|
-
|
94
|
+
- spec/base_assertion_spec.rb
|
95
|
+
- spec/fixtures/logout_request.xml
|
96
|
+
- spec/fixtures/logout_response.xml
|
97
|
+
- spec/fixtures/test1-cert.pem
|
98
|
+
- spec/fixtures/test1-key.pem
|
99
|
+
- spec/fixtures/test1-response.xml
|
100
|
+
- spec/fixtures/test2-response.xml
|
101
|
+
- spec/fixtures/test3-response.xml
|
102
|
+
- spec/fixtures/test4-response.xml
|
103
|
+
- spec/fixtures/test5-response.xml
|
104
|
+
- spec/fixtures/test6-response.xml
|
105
|
+
- spec/fixtures/wrong-key.pem
|
106
|
+
- spec/fixtures/xml_signature_wrapping_attack_duplicate_ids.xml
|
107
|
+
- spec/fixtures/xml_signature_wrapping_attack_response_attributes.xml
|
108
|
+
- spec/fixtures/xml_signature_wrapping_attack_response_nameid.xml
|
109
|
+
- spec/logout_request_spec.rb
|
110
|
+
- spec/logout_response_spec.rb
|
111
|
+
- spec/meta_data_spec.rb
|
112
|
+
- spec/response_spec.rb
|
113
|
+
- spec/spec_helper.rb
|
114
|
+
- spec/support/test_server.rb
|
115
|
+
homepage: http://github.com/instructure/ruby-saml
|
70
116
|
licenses: []
|
71
117
|
metadata: {}
|
72
118
|
post_install_message:
|
@@ -89,5 +135,26 @@ rubygems_version: 2.2.2
|
|
89
135
|
signing_key:
|
90
136
|
specification_version: 4
|
91
137
|
summary: Ruby library for SAML service providers
|
92
|
-
test_files:
|
138
|
+
test_files:
|
139
|
+
- spec/base_assertion_spec.rb
|
140
|
+
- spec/fixtures/logout_request.xml
|
141
|
+
- spec/fixtures/logout_response.xml
|
142
|
+
- spec/fixtures/test1-cert.pem
|
143
|
+
- spec/fixtures/test1-key.pem
|
144
|
+
- spec/fixtures/test1-response.xml
|
145
|
+
- spec/fixtures/test2-response.xml
|
146
|
+
- spec/fixtures/test3-response.xml
|
147
|
+
- spec/fixtures/test4-response.xml
|
148
|
+
- spec/fixtures/test5-response.xml
|
149
|
+
- spec/fixtures/test6-response.xml
|
150
|
+
- spec/fixtures/wrong-key.pem
|
151
|
+
- spec/fixtures/xml_signature_wrapping_attack_duplicate_ids.xml
|
152
|
+
- spec/fixtures/xml_signature_wrapping_attack_response_attributes.xml
|
153
|
+
- spec/fixtures/xml_signature_wrapping_attack_response_nameid.xml
|
154
|
+
- spec/logout_request_spec.rb
|
155
|
+
- spec/logout_response_spec.rb
|
156
|
+
- spec/meta_data_spec.rb
|
157
|
+
- spec/response_spec.rb
|
158
|
+
- spec/spec_helper.rb
|
159
|
+
- spec/support/test_server.rb
|
93
160
|
has_rdoc:
|
data/LICENSE
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
Copyright (c) 2010 OneLogin, LLC
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
5
|
-
in the Software without restriction, including without limitation the rights
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
8
|
-
furnished to do so, subject to the following conditions:
|
9
|
-
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
11
|
-
all copies or substantial portions of the Software.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
THE SOFTWARE.
|
data/README
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
module Onelogin::Saml
|
2
|
-
class LogOutRequest
|
3
|
-
attr_reader :settings, :id, :request_xml, :forward_url
|
4
|
-
|
5
|
-
def initialize(settings, session)
|
6
|
-
@settings = settings
|
7
|
-
@session = session
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.create(settings, session)
|
11
|
-
ar = LogOutRequest.new(settings, session)
|
12
|
-
ar.generate_request
|
13
|
-
end
|
14
|
-
|
15
|
-
def generate_request
|
16
|
-
@id = Onelogin::Saml::AuthRequest.generate_unique_id(42)
|
17
|
-
issue_instant = Onelogin::Saml::AuthRequest.get_timestamp
|
18
|
-
|
19
|
-
@request_xml = <<-REQUEST_XML
|
20
|
-
<samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" ID="#{@id}" Version="2.0" IssueInstant="#{issue_instant}" Destination="#{@settings.idp_slo_target_url}">
|
21
|
-
<saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">#{@settings.issuer}</saml:Issuer>
|
22
|
-
<saml:NameID xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" NameQualifier="#{@session[:name_qualifier]}" SPNameQualifier="#{@settings.issuer}" Format="#{@settings.name_identifier_format}">#{@session[:name_id]}</saml:NameID>
|
23
|
-
<samlp:SessionIndex xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">#{@session[:session_index]}</samlp:SessionIndex>
|
24
|
-
</samlp:LogoutRequest>
|
25
|
-
REQUEST_XML
|
26
|
-
|
27
|
-
deflated_logout_request = Zlib::Deflate.deflate(@request_xml, 9)[2..-5]
|
28
|
-
base64_logout_request = Base64.strict_encode64(deflated_logout_request)
|
29
|
-
|
30
|
-
url, existing_query_string = @settings.idp_slo_target_url.split('?')
|
31
|
-
query_string = _query_string_append(existing_query_string, 'SAMLRequest', base64_logout_request)
|
32
|
-
|
33
|
-
if settings.sign?
|
34
|
-
query_string = _query_string_append(query_string, "SigAlg", "http://www.w3.org/2000/09/xmldsig#rsa-sha1")
|
35
|
-
signature = _generate_signature(query_string, @settings.xmlsec_privatekey)
|
36
|
-
query_string = _query_string_append(query_string, "Signature", signature)
|
37
|
-
end
|
38
|
-
|
39
|
-
@forward_url = [url, query_string].join("?")
|
40
|
-
|
41
|
-
@forward_url
|
42
|
-
end
|
43
|
-
|
44
|
-
def _generate_signature(string, private_key)
|
45
|
-
pkey = OpenSSL::PKey::RSA.new(File.read(private_key))
|
46
|
-
sign = pkey.sign(OpenSSL::Digest::SHA1.new, string)
|
47
|
-
Base64.encode64(sign).gsub(/\s/, '')
|
48
|
-
end
|
49
|
-
|
50
|
-
def _query_string_append(query_string, key, value)
|
51
|
-
[query_string, "#{CGI.escape(key)}=#{CGI.escape(value)}"].compact.join('&')
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
data/ruby-saml-mod.gemspec
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |s|
|
2
|
-
s.name = %q{ruby-saml-mod}
|
3
|
-
s.version = "0.1.30"
|
4
|
-
|
5
|
-
s.authors = ["OneLogin LLC", "Bracken", "Zach", "Cody", "Jeremy", "Paul", "Nick"]
|
6
|
-
s.date = %q{2014-05-05}
|
7
|
-
s.extra_rdoc_files = [
|
8
|
-
"LICENSE"
|
9
|
-
]
|
10
|
-
s.files = [
|
11
|
-
"LICENSE",
|
12
|
-
"README",
|
13
|
-
"lib/onelogin/saml.rb",
|
14
|
-
"lib/onelogin/saml/auth_request.rb",
|
15
|
-
"lib/onelogin/saml/authn_contexts.rb",
|
16
|
-
"lib/onelogin/saml/log_out_request.rb",
|
17
|
-
"lib/onelogin/saml/logout_response.rb",
|
18
|
-
"lib/onelogin/saml/meta_data.rb",
|
19
|
-
"lib/onelogin/saml/name_identifiers.rb",
|
20
|
-
"lib/onelogin/saml/response.rb",
|
21
|
-
"lib/onelogin/saml/settings.rb",
|
22
|
-
"lib/onelogin/saml/status_codes.rb",
|
23
|
-
"lib/xml_sec.rb",
|
24
|
-
"ruby-saml-mod.gemspec"
|
25
|
-
]
|
26
|
-
s.add_dependency('libxml-ruby', '>= 2.3.0')
|
27
|
-
s.add_dependency('ffi')
|
28
|
-
|
29
|
-
s.homepage = %q{http://github.com/bracken/ruby-saml}
|
30
|
-
s.require_paths = ["lib"]
|
31
|
-
s.summary = %q{Ruby library for SAML service providers}
|
32
|
-
s.description = %q{This is an early fork from https://github.com/onelogin/ruby-saml - I plan to "rebase" these changes ontop of their current version eventually. }
|
33
|
-
end
|