intuit-saml 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,209 @@
1
+ Eclipse Public License -v 1.0
2
+
3
+ THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
4
+ LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
5
+ CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
6
+
7
+ 1. DEFINITIONS
8
+
9
+ "Contribution" means:
10
+
11
+ a) in the case of the initial Contributor, the initial code and documentation
12
+ distributed under this Agreement, and
13
+
14
+ b) in the case of each subsequent Contributor:
15
+
16
+ i) changes to the Program, and
17
+
18
+ ii) additions to the Program;
19
+
20
+ where such changes and/or additions to the Program originate from and are
21
+ distributed by that particular Contributor. A Contribution 'originates' from a
22
+ Contributor if it was added to the Program by such Contributor itself or anyone
23
+ acting on such Contributor's behalf. Contributions do not include additions to
24
+ the Program which: (i) are separate modules of software distributed in
25
+ conjunction with the Program under their own license agreement, and (ii) are
26
+ not derivative works of the Program.
27
+
28
+ "Contributor" means any person or entity that distributes the Program.
29
+
30
+ "Licensed Patents " mean patent claims licensable by a Contributor which are
31
+ necessarily infringed by the use or sale of its Contribution alone or when
32
+ combined with the Program.
33
+
34
+ "Program" means the Contributions distributed in accordance with this Agreement.
35
+
36
+ "Recipient" means anyone who receives the Program under this Agreement,
37
+ including all Contributors.
38
+
39
+ 2. GRANT OF RIGHTS
40
+
41
+ a) Subject to the terms of this Agreement, each Contributor hereby grants
42
+ Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce,
43
+ prepare derivative works of, publicly display, publicly perform, distribute
44
+ and sublicense the Contribution of such Contributor, if any, and such derivative
45
+ works, in source code and object code form.
46
+
47
+ b) Subject to the terms of this Agreement, each Contributor hereby grants
48
+ Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed
49
+ Patents to make, use, sell, offer to sell, import and otherwise transfer the
50
+ Contribution of such Contributor, if any, in source code and object code form.
51
+ This patent license shall apply to the combination of the Contribution and the
52
+ Program if, at the time the Contribution is added by the Contributor, such
53
+ addition of the Contribution causes such combination to be covered by the
54
+ Licensed Patents. The patent license shall not apply to any other combinations
55
+ which include the Contribution. No hardware per se is licensed hereunder.
56
+
57
+ c) Recipient understands that although each Contributor grants the licenses to
58
+ its Contributions set forth herein, no assurances are provided by any Contributor
59
+ that the Program does not infringe the patent or other intellectual property
60
+ rights of any other entity. Each Contributor disclaims any liability to Recipient
61
+ for claims brought by any other entity based on infringement of intellectual
62
+ property rights or otherwise. As a condition to exercising the rights and
63
+ licenses granted hereunder, each Recipient hereby assumes sole responsibility
64
+ to secure any other intellectual property rights needed, if any. For example,
65
+ if a third party patent license is required to allow Recipient to distribute
66
+ the Program, it is Recipient's responsibility to acquire that license before
67
+ distributing the Program.
68
+
69
+ d) Each Contributor represents that to its knowledge it has sufficient copyright
70
+ rights in its Contribution, if any, to grant the copyright license set forth in
71
+ this Agreement.
72
+
73
+ 3. REQUIREMENTS
74
+
75
+ A Contributor may choose to distribute the Program in object code form under its
76
+ own license agreement, provided that:
77
+
78
+ a) it complies with the terms and conditions of this Agreement; and
79
+
80
+ b) its license agreement:
81
+
82
+ i) effectively disclaims on behalf of all Contributors all warranties and
83
+ conditions, express and implied, including warranties or conditions of title and
84
+ non-infringement, and implied warranties or conditions of merchantability and
85
+ fitness for a particular purpose;
86
+
87
+ ii) effectively excludes on behalf of all Contributors all liability for
88
+ damages, including direct, indirect, special, incidental and consequential
89
+ damages, such as lost profits;
90
+
91
+ iii) states that any provisions which differ from this Agreement are offered
92
+ by that Contributor alone and not by any other party; and
93
+
94
+ iv) states that source code for the Program is available from such
95
+ Contributor, and informs licensees how to obtain it in a reasonable manner on
96
+ or through a medium customarily used for software exchange.
97
+
98
+ When the Program is made available in source code form:
99
+
100
+ a) it must be made available under this Agreement; and
101
+
102
+ b) a copy of this Agreement must be included with each copy of the Program.
103
+
104
+ Contributors may not remove or alter any copyright notices contained within
105
+ the Program.
106
+
107
+ Each Contributor must identify itself as the originator of its Contribution,
108
+ if any, in a manner that reasonably allows subsequent Recipients to identify
109
+ the originator of the Contribution.
110
+
111
+ 4. COMMERCIAL DISTRIBUTION
112
+
113
+ Commercial distributors of software may accept certain responsibilities with
114
+ respect to end users, business partners and the like. While this license is
115
+ intended to facilitate the commercial use of the Program, the Contributor who
116
+ includes the Program in a commercial product offering should do so in a manner
117
+ which does not create potential liability for other Contributors. Therefore,
118
+ if a Contributor includes the Program in a commercial product offering, such
119
+ Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
120
+ every other Contributor ("Indemnified Contributor") against any losses,
121
+ damages and costs (collectively "Losses") arising from claims, lawsuits and
122
+ other legal actions brought by a third party against the Indemnified
123
+ Contributor to the extent caused by the acts or omissions of such Commercial
124
+ Contributor in connection with its distribution of the Program in a commercial
125
+ product offering. The obligations in this section do not apply to any claims
126
+ or Losses relating to any actual or alleged intellectual property infringement.
127
+ In order to qualify, an Indemnified Contributor must: a) promptly notify the
128
+ Commercial Contributor in writing of such claim, and b) allow the Commercial
129
+ Contributor to control, and cooperate with the Commercial Contributor in, the
130
+ defense and any related settlement negotiations. The Indemnified Contributor
131
+ may participate in any such claim at its own expense.
132
+
133
+ For example, a Contributor might include the Program in a commercial product
134
+ offering, Product X. That Contributor is then a Commercial Contributor. If that
135
+ Commercial Contributor then makes performance claims, or offers warranties
136
+ related to Product X, those performance claims and warranties are such
137
+ Commercial Contributor's responsibility alone. Under this section, the
138
+ Commercial Contributor would have to defend claims against the other
139
+ Contributors related to those performance claims and warranties, and if a court
140
+ requires any other Contributor to pay any damages as a result, the Commercial
141
+ Contributor must pay those damages.
142
+
143
+ 5. NO WARRANTY
144
+
145
+ EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
146
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
147
+ IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
148
+ NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
149
+ Recipient is solely responsible for determining the appropriateness of using
150
+ and distributing the Program and assumes all risks associated with its exercise
151
+ of rights under this Agreement , including but not limited to the risks and
152
+ costs of program errors, compliance with applicable laws, damage to or loss of
153
+ data, programs or equipment, and unavailability or interruption of operations.
154
+
155
+ 6. DISCLAIMER OF LIABILITY
156
+
157
+ EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
158
+ CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
159
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
160
+ LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
161
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
162
+ IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY
163
+ RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
164
+
165
+ 7. GENERAL
166
+
167
+ If any provision of this Agreement is invalid or unenforceable under applicable
168
+ law, it shall not affect the validity or enforceability of the remainder of the
169
+ terms of this Agreement, and without further action by the parties hereto, such
170
+ provision shall be reformed to the minimum extent necessary to make such
171
+ provision valid and enforceable.
172
+
173
+ If Recipient institutes patent litigation against any entity (including a
174
+ cross-claim or counterclaim in a lawsuit) alleging that the Program itself
175
+ (excluding combinations of the Program with other software or hardware)
176
+ infringes such Recipient's patent(s), then such Recipient's rights granted
177
+ under Section 2(b) shall terminate as of the date such litigation is filed.
178
+
179
+ All Recipient's rights under this Agreement shall terminate if it fails to
180
+ comply with any of the material terms or conditions of this Agreement and does
181
+ not cure such failure in a reasonable period of time after becoming aware of
182
+ such noncompliance. If all Recipient's rights under this Agreement terminate,
183
+ Recipient agrees to cease use and distribution of the Program as soon as
184
+ reasonably practicable. However, Recipient's obligations under this Agreement
185
+ and any licenses granted by Recipient relating to the Program shall continue
186
+ and survive.
187
+
188
+ Everyone is permitted to copy and distribute copies of this Agreement, but in
189
+ order to avoid inconsistency the Agreement is copyrighted and may only be
190
+ modified in the following manner. The Agreement Steward reserves the right to
191
+ publish new versions (including revisions) of this Agreement from time to time.
192
+ No one other than the Agreement Steward has the right to modify this Agreement.
193
+ The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation
194
+ may assign the responsibility to serve as the Agreement Steward to a suitable
195
+ separate entity. Each new version of the Agreement will be given a distinguishing
196
+ version number. The Program (including Contributions) may always be distributed
197
+ subject to the version of the Agreement under which it was received. In addition,
198
+ after a new version of the Agreement is published, Contributor may elect to
199
+ distribute the Program (including its Contributions) under the new version.
200
+ Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives
201
+ no rights or licenses to the intellectual property of any Contributor under
202
+ this Agreement, whether expressly, by implication, estoppel or otherwise. All
203
+ rights in the Program not expressly granted under this Agreement are reserved.
204
+
205
+ This Agreement is governed by the laws of the State of New York and the
206
+ intellectual property laws of the United States of America. No party to this
207
+ Agreement will bring a legal action under this Agreement more than one year
208
+ after the cause of action arose. Each party waives its rights to a jury trial
209
+ in any resulting litigation.
data/Manifest ADDED
@@ -0,0 +1,9 @@
1
+ LICENSE
2
+ Manifest
3
+ README.rdoc
4
+ Rakefile
5
+ intuit-saml.gemspec
6
+ lib/intuit-saml.rb
7
+ spec/data/test-private.key
8
+ spec/data/test-samlresponse.txt
9
+ spec/intuit-saml_spec.rb
data/README.rdoc ADDED
@@ -0,0 +1,40 @@
1
+ = Intuit SAML
2
+
3
+ Allows a ruby-based web site to federate with the Intuit Parter Platform (more information available at https://ipp.developer.intuit.com/ipp/federated) and work with Intuit's single sign-on solution.
4
+
5
+ == Description
6
+
7
+ In order to federate a web application with Intuit's cloud environment, the Intuit Partner Platform, the app needs to provide a SAML gateway to handle incoming SAML responses from Intuit's outgoing SAML gateway.
8
+
9
+ == Install
10
+
11
+ gem install intuit-saml
12
+
13
+ === Source
14
+
15
+ The source is available via SVN at the {Intuit open source repository}[https://code.intuit.com/sf/wiki/do/viewPage/projects.ipp_fed_auth/wiki/RubySAMLGateway]. It may be hosted on Github in the future-- check back for more information as we continue development.
16
+
17
+ === Dependencies
18
+
19
+ Due to issues with the older openssl lib, intuit-saml requires Ruby 1.8.7.
20
+
21
+ == Creating a SAML Gateway
22
+
23
+ Below are the general steps to using this gem to create your own SAML gateway so that you can federate with Intuit's cloud services and get access to user and company information. Please note that currently this library is targeted ONLY at providing SAML response decryption and unpacking. It does not currently provide model access to any of the IPP data, nor does it automate integration with your particular user authentication/authorization system.
24
+
25
+ === Summary
26
+
27
+ Once the gem is installed, you will have access to an Intuit::Saml class. Use this class to decrypt the SAML Response from the Intuit outgoing gateway; inside you will find a <tt>ticket</tt> and an <tt>application_destination_url</tt>. You can use the ticket to call back into IPP and retrieve information about the user and their company.
28
+
29
+ == Contributions
30
+
31
+ Please consider joining the Intuit Open Source community at http://code.intuit.com to submit patches and enhancements for this gem.
32
+
33
+ == Authors
34
+
35
+ intuit-saml was originally written by Nathan Smith. Other contributors include:
36
+ * Zachery Moneypenny
37
+
38
+ == License
39
+
40
+ This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.opensource.org/licenses/eclipse-1.0.php. See accompanying LICENSE file for more information.
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('intuit-saml', '0.1.0') do |p|
6
+ p.description = "Allow sites federated with Intuit to process SAML auth requests"
7
+ p.url = "https://code.intuit.com/sf/wiki/do/viewPage/projects.ipp_fed_auth/wiki/RubySAMLGateway"
8
+ p.author = "Zachery Moneypenny, Nathan Smith"
9
+ p.email = "zachery_moneypenny@intuit.com"
10
+ p.ignore_pattern = ["tmp/*", "script/*"]
11
+ p.development_dependencies = []
12
+ end
13
+
14
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each {|ext| load ext}
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{intuit-saml}
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Zachery Moneypenny, Nathan Smith"]
9
+ s.date = %q{2010-06-11}
10
+ s.description = %q{Allow sites federated with Intuit to process SAML auth requests}
11
+ s.email = %q{zachery_moneypenny@intuit.com}
12
+ s.extra_rdoc_files = ["LICENSE", "README.rdoc", "lib/intuit-saml.rb"]
13
+ s.files = ["LICENSE", "Manifest", "README.rdoc", "Rakefile", "intuit-saml.gemspec", "lib/intuit-saml.rb", "spec/data/test-private.key", "spec/data/test-samlresponse.txt", "spec/intuit-saml_spec.rb"]
14
+ s.homepage = %q{https://code.intuit.com/sf/wiki/do/viewPage/projects.ipp_fed_auth/wiki/RubySAMLGateway}
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Intuit-saml", "--main", "README.rdoc"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{intuit-saml}
18
+ s.rubygems_version = %q{1.3.7}
19
+ s.summary = %q{Allow sites federated with Intuit to process SAML auth requests}
20
+
21
+ if s.respond_to? :specification_version then
22
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
+ s.specification_version = 3
24
+
25
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
+ else
27
+ end
28
+ else
29
+ end
30
+ end
@@ -0,0 +1,133 @@
1
+ ###############################################################################
2
+ # Copyright (c) 2009-06-26 VerticalResponse.
3
+ # All rights reserved. This program and the accompanying materials
4
+ # are made available under the terms of the Eclipse Public License v1.0
5
+ # which accompanies this distribution, and is available at
6
+ # http://www.opensource.org/licenses/eclipse-1.0.php
7
+ # Contributors:
8
+ #
9
+ # Nathan Smith - initial AES-128-CBC-only, non-validating implementation
10
+ #
11
+ ###############################################################################
12
+ require 'base64'
13
+ require 'openssl'
14
+ require 'xml'
15
+
16
+ module Intuit
17
+
18
+ class MissingExpectedSamlNode < Exception; end
19
+ class UnknownSymmetricEncryptionAlgorithmException < Exception; end
20
+ class NoEncryptedKey < Exception; end
21
+ class NoEncryptedTicket < Exception; end
22
+ class NoDestinationURL < Exception; end
23
+
24
+ # = Usage
25
+ #
26
+ # saml = Intuit::Saml.new(
27
+ # :saml_xml => Base64.decode64( params[:SAMLResponse] ),
28
+ # :private_key => File.read( '/path/to/your/private/ssl.key' )
29
+ # )
30
+ # ipp_ticket = saml.ticket
31
+ # target_url = saml.application_destination_url
32
+ class Saml
33
+
34
+ @@namespaces = {
35
+ 'ds' => 'http://www.w3.org/2000/09/xmldsig#',
36
+ 'saml' => 'urn:oasis:names:tc:SAML:2.0:assertion',
37
+ 'samlp' => 'urn:oasis:names:tc:SAML:2.0:protocol',
38
+ 'xenc' => 'http://www.w3.org/2001/04/xmlenc#',
39
+ }
40
+
41
+ # sets up the tool with the SAML XML and the private key corresponding to the public key registered with IPP
42
+ #
43
+ #
44
+ # saml = Intuit::Saml.new(
45
+ # :saml_xml => Base64.decode64( params[:SAMLResponse] ),
46
+ # :private_key => File.read( '/path/to/your/private/ssl.key' )
47
+ # )
48
+ def initialize params
49
+ @saml_doc = LibXML::XML::Parser.string( params[:saml_xml] ).parse
50
+ @private_key = OpenSSL::PKey::RSA.new( params[:private_key] )
51
+ end
52
+
53
+ # extracts the IPP API ticket from the SAML document
54
+ def ticket
55
+ # collect relevant parts of the saml document
56
+ begin
57
+ @encrypted_key = expected_saml_node_content( @saml_doc, '/samlp:Response/saml:Assertion/saml:AttributeStatement/saml:EncryptedAttribute/xenc:EncryptedData/ds:KeyInfo/xenc:EncryptedKey/xenc:CipherData/xenc:CipherValue' )
58
+ rescue Intuit::MissingExpectedSamlNode
59
+ raise NoEncryptedKey.new
60
+ end
61
+ begin
62
+ @encrypted_ticket = expected_saml_node_content( @saml_doc, '/samlp:Response/saml:Assertion/saml:AttributeStatement/saml:EncryptedAttribute/xenc:EncryptedData/xenc:CipherData/xenc:CipherValue' )
63
+ rescue Intuit::MissingExpectedSamlNode
64
+ raise NoEncryptedTicket.new
65
+ end
66
+
67
+ # make sure the encryption algorithm is something that is recognized (currently only aes-128 is recognized)
68
+ encryption_method_node = expected_saml_node( @saml_doc, '/samlp:Response/saml:Assertion/saml:AttributeStatement/saml:EncryptedAttribute/xenc:EncryptedData/xenc:EncryptionMethod' )
69
+ algorithm = encryption_method_node.attributes.to_h['Algorithm']
70
+ unless algorithm.eql?( 'http://www.w3.org/2001/04/xmlenc#aes128-cbc' )
71
+ raise Intuit::UnknownSymmetricEncryptionAlgorithmException.new( "unknown symmetric encryption algorithm #{ algorithm }" )
72
+ end
73
+
74
+ # decrypt aes-128 key using rsa
75
+ @decrypted_key = @private_key.private_decrypt( Base64::decode64( @encrypted_key ) )
76
+
77
+ # decrypt ticket using aes-128
78
+ # http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#aes128-cbc
79
+ cipher = OpenSSL::Cipher::Cipher.new( 'AES-128-CBC' )
80
+ cipher.decrypt
81
+ cipher.key = @decrypted_key
82
+ cipher.padding = 0
83
+ ciphertext = Base64::decode64( @encrypted_ticket )
84
+ # remove the first 16 bytes and use them as the initialization vector
85
+ cipher.iv = ciphertext[0,cipher.iv_len]
86
+ ciphertext = ciphertext[cipher.iv_len..-1]
87
+ @decrypted_ticket = cipher.update( ciphertext ) + cipher.final
88
+ # number of padding bytes at the end of the cleartext is recorded in the last byte
89
+ last_byte = @decrypted_ticket[-1].ord
90
+ @decrypted_ticket = @decrypted_ticket[0..-last_byte-1]
91
+ # decrypted value is itself an xml document
92
+ ticket_doc = LibXML::XML::Parser.string( @decrypted_ticket ).parse
93
+ @ticket = expected_saml_node_content( ticket_doc, '/saml:Attribute[@Name="ticket"]/saml:AttributeValue' )
94
+ end
95
+
96
+ # extracts the targetUrl from the SAML document -
97
+ # this is referred to as "Application Destination URL" in the Federation Advanced Settings for your app
98
+ def application_destination_url
99
+ @application_destination_url = expected_saml_node_content( @saml_doc, '/samlp:Response/saml:Assertion/saml:AttributeStatement/saml:Attribute[@Name = "targetUrl"]/saml:AttributeValue' )
100
+ rescue Intuit::MissingExpectedSamlNode
101
+ raise NoDestinationURL.new
102
+ return @application_destination_url
103
+ end
104
+
105
+ # returns a hash full of intermediate data for debugging purposes
106
+ def debug_info
107
+ return {
108
+ :saml_doc => @saml_doc,
109
+ :encrypted_key => @encrypted_key,
110
+ :encrypted_ticket => @encrypted_ticket,
111
+ :decrypted_key => @decrypted_key,
112
+ :decrypted_ticket => @decrypted_ticket,
113
+ :ticket => @ticket,
114
+ }
115
+ end
116
+
117
+ private
118
+
119
+ def expected_saml_node doc, xpath_expression
120
+ xpath = doc.find( xpath_expression, @@namespaces )
121
+ node = xpath.first
122
+ raise Intuit::MissingExpectedSamlNode.new( "expected node '#{ xpath_expression }' not found" ) if node.nil?
123
+ return node
124
+ end
125
+
126
+ def expected_saml_node_content doc, xpath_expression
127
+ node = expected_saml_node( doc, xpath_expression )
128
+ return node.content
129
+ end
130
+
131
+ end
132
+
133
+ end
@@ -0,0 +1,15 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIICXAIBAAKBgQCZ9ZrZJ4dz6FkCn5CVSqpUiutxr7gSvJL26BzbPBO3IT8pNnLV
3
+ fkLn0Dhbha4FM1D7kJ+oJm1yKtsNpE7Wsm3BfZAayGd6IroCXUvRThpF3Exx1ev5
4
+ S7fcJw14Psnee6K0/+6CWgwLgI1hOus/nubJFY8INaA7bSsYj7+mi6CkyQIDAQAB
5
+ AoGBAI9xKSiRj74KCIRNLmQqALBsDhkJ4rJyR2sLr3cDbkr9Ct/W/v6yeJu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+PC9zYW1sOkF0dHJpYnV0ZVN0YXRlbWVudD48L3NhbWw6QXNzZXJ0aW9uPjwvc2FtbHA6UmVzcG9uc2U+
@@ -0,0 +1,20 @@
1
+ require File.dirname(__FILE__)+'/../lib/intuit-saml'
2
+
3
+ describe Intuit::Saml do
4
+
5
+ before do
6
+ @testdir = File.dirname(__FILE__)
7
+ end
8
+
9
+ it "should correctly decrypt the ticket and destination url from the SAML response" do
10
+ saml = Intuit::Saml.new(
11
+ :saml_xml => Base64.decode64( File.read("#{@testdir}/data/test-samlresponse.txt") ),
12
+ :private_key => File.read( "#{@testdir}/data/test-private.key" )
13
+ )
14
+ saml.ticket.should == "5_bfexnbyt5_bw8m98_b_b4wked5drx52bxd6wp65nca2dreu_zxvftx8sde2tmswagyy8sccak8dp9y7p4d7d85xpwgq3g4unkc6b"
15
+ saml.application_destination_url.should == "http://ids.whazzing.com/account"
16
+ end
17
+
18
+
19
+
20
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: intuit-saml
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Zachery Moneypenny, Nathan Smith
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-06-11 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Allow sites federated with Intuit to process SAML auth requests
23
+ email: zachery_moneypenny@intuit.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - LICENSE
30
+ - README.rdoc
31
+ - lib/intuit-saml.rb
32
+ files:
33
+ - LICENSE
34
+ - Manifest
35
+ - README.rdoc
36
+ - Rakefile
37
+ - intuit-saml.gemspec
38
+ - lib/intuit-saml.rb
39
+ - spec/data/test-private.key
40
+ - spec/data/test-samlresponse.txt
41
+ - spec/intuit-saml_spec.rb
42
+ has_rdoc: true
43
+ homepage: https://code.intuit.com/sf/wiki/do/viewPage/projects.ipp_fed_auth/wiki/RubySAMLGateway
44
+ licenses: []
45
+
46
+ post_install_message:
47
+ rdoc_options:
48
+ - --line-numbers
49
+ - --inline-source
50
+ - --title
51
+ - Intuit-saml
52
+ - --main
53
+ - README.rdoc
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 3
62
+ segments:
63
+ - 0
64
+ version: "0"
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ hash: 11
71
+ segments:
72
+ - 1
73
+ - 2
74
+ version: "1.2"
75
+ requirements: []
76
+
77
+ rubyforge_project: intuit-saml
78
+ rubygems_version: 1.3.7
79
+ signing_key:
80
+ specification_version: 3
81
+ summary: Allow sites federated with Intuit to process SAML auth requests
82
+ test_files: []
83
+