samlr 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of samlr might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/.travis.yml +5 -0
- data/Gemfile +8 -0
- data/LICENSE +176 -0
- data/README.md +182 -0
- data/Rakefile +12 -0
- data/bin/samlr +46 -0
- data/config/schemas/XMLSchema.xsd +2534 -0
- data/config/schemas/saml-schema-assertion-2.0.xsd +283 -0
- data/config/schemas/saml-schema-metadata-2.0.xsd +337 -0
- data/config/schemas/saml-schema-protocol-2.0.xsd +302 -0
- data/config/schemas/xenc-schema.xsd +146 -0
- data/config/schemas/xml.xsd +287 -0
- data/config/schemas/xmldsig-core-schema.xsd +318 -0
- data/lib/samlr.rb +52 -0
- data/lib/samlr/assertion.rb +91 -0
- data/lib/samlr/certificate.rb +23 -0
- data/lib/samlr/command.rb +41 -0
- data/lib/samlr/condition.rb +31 -0
- data/lib/samlr/errors.rb +22 -0
- data/lib/samlr/fingerprint.rb +44 -0
- data/lib/samlr/logout_request.rb +7 -0
- data/lib/samlr/reference.rb +32 -0
- data/lib/samlr/request.rb +37 -0
- data/lib/samlr/response.rb +68 -0
- data/lib/samlr/signature.rb +129 -0
- data/lib/samlr/tools.rb +108 -0
- data/lib/samlr/tools/certificate_builder.rb +74 -0
- data/lib/samlr/tools/logout_request_builder.rb +27 -0
- data/lib/samlr/tools/metadata_builder.rb +41 -0
- data/lib/samlr/tools/request_builder.rb +44 -0
- data/lib/samlr/tools/response_builder.rb +157 -0
- data/lib/samlr/tools/timestamp.rb +26 -0
- data/samlr.gemspec +19 -0
- data/test/fixtures/default_samlr_certificate.pem +11 -0
- data/test/fixtures/default_samlr_private_key.pem +9 -0
- data/test/fixtures/no_cert_response.xml +2 -0
- data/test/fixtures/sample_metadata.xml +7 -0
- data/test/fixtures/sample_response.xml +2 -0
- data/test/test_helper.rb +55 -0
- data/test/unit/test_assertion.rb +54 -0
- data/test/unit/test_condition.rb +71 -0
- data/test/unit/test_fingerprint.rb +45 -0
- data/test/unit/test_logout_request.rb +39 -0
- data/test/unit/test_reference.rb +32 -0
- data/test/unit/test_request.rb +34 -0
- data/test/unit/test_response.rb +94 -0
- data/test/unit/test_response_scenarios.rb +111 -0
- data/test/unit/test_signature.rb +54 -0
- data/test/unit/test_timestamp.rb +58 -0
- data/test/unit/test_tools.rb +100 -0
- data/test/unit/tools/test_certificate_builder.rb +41 -0
- data/test/unit/tools/test_logout_request_builder.rb +26 -0
- data/test/unit/tools/test_metadata_builder.rb +26 -0
- data/test/unit/tools/test_request_builder.rb +35 -0
- data/test/unit/tools/test_response_builder.rb +19 -0
- metadata +184 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a2074e685eb574ec5c1c6577ff9bf640057e9ec5
|
4
|
+
data.tar.gz: e3237358e321f2a8d7719b4217a30e53788c5395
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 00ccf48f9a7c23d83ec70a00580149064b57ec1893e7b026ac7fa6a8bfa31e2ae3a3610542cc0b4fd2872029d5141c881fdc4c88be8dbe6bfaeb188dfafe404d
|
7
|
+
data.tar.gz: 1f4759e04686aa452d6de7c47a0205e18fe31be6a2dde8fc8e265ec4510d7bda2c43b821287f69a6c5f1b460261b29bc49444892e95c835d2534629e362393fd
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,176 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
data/README.md
ADDED
@@ -0,0 +1,182 @@
|
|
1
|
+
## Samlr [![Build Status](https://secure.travis-ci.org/zendesk/samlr.png)](http://travis-ci.org/zendesk/samlr)
|
2
|
+
|
3
|
+
Samlr is a clean room implementation of SAML for Ruby. It's focused on implementing the service provider (SP) side rather than the identity provider (IdP).
|
4
|
+
|
5
|
+
Samlr leverages Nokogiri for the heavy lifting and keeps things simple. Samlr allows you to receive and validate SAML authentication requests. It's SAML 2.0 only, doesn't support everything and makes liberal assumptions about the input - none of which cannot be improved going forward.
|
6
|
+
|
7
|
+
### Initiating an authentication request
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
saml_request = Samlr::Request.new(
|
11
|
+
:issuer => request.host,
|
12
|
+
:name_identity_format => Samlr::EMAIL_FORMAT,
|
13
|
+
:consumer_service_url => "https://#{request.host}/auth/saml"
|
14
|
+
)
|
15
|
+
```
|
16
|
+
|
17
|
+
At this point you can access `request.param` if all you want is the encoded params, or you can get a fully valid request URL with an appropriate `RelayState` value:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
redirect_to saml_request.url(
|
21
|
+
"https://idp.example.com/auth/saml", { :RelayState => request.url }
|
22
|
+
)
|
23
|
+
```
|
24
|
+
|
25
|
+
Once the IdP receives the request, it prompts the user to authenticate, after which it sends the SAML response to your application.
|
26
|
+
|
27
|
+
### Verifying a SAML response
|
28
|
+
|
29
|
+
You can validate a SAML response string using either of the below approaches. The fingerprint is a certificate fingerprint, and the certificate is the certificate PEM (from which Samlr will obtain the fingerprint).
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
saml_response = Samlr::Response.new(params[:SAMLResponse], :fingerprint => fingerprint)
|
33
|
+
```
|
34
|
+
|
35
|
+
Or using a certificate:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
saml_response = Samlr::Response.new(params[:SAMLResponse], :certificate => certificate)
|
39
|
+
```
|
40
|
+
|
41
|
+
You then verify the response by calling
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
saml_response.verify!
|
45
|
+
```
|
46
|
+
|
47
|
+
If the verification fails for whatever reason, a `Samlr::Error` will be thrown. This error class has several subclasses and generally contains a useful error message that can help trouble shooting. The error also has a `Samlr::Error#details` value, which contains potentially sensitive data (fingerprint values, canonicalization results).
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
begin
|
51
|
+
saml_response.verify!
|
52
|
+
redirect_to success!(saml_response.name_id)
|
53
|
+
rescue Samlr::SamlrError => e
|
54
|
+
logger.warn("SAML error #{e.class} #{e.message} #{e.details}")
|
55
|
+
flash[:error] = e.message
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
59
|
+
When the verification suceeds,the resulting response object will surface `saml_response.name_id` (String) and `saml_response.attributes` (Hash).
|
60
|
+
|
61
|
+
### Metadata
|
62
|
+
|
63
|
+
Currently no support for signing, but that should be fairly easy to extract from the `Samlr::Tools::ResponseBuilder`. Get a metadata XML document like this:
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
xml = Samlr::Tools::MetadataBuilder.build({
|
67
|
+
:entity_id => "https://sp.example.com/saml",
|
68
|
+
:name_identity_format => Samlr::EMAIL_FORMAT,
|
69
|
+
:consumer_service_url => "https://sp.example.com/saml"
|
70
|
+
})
|
71
|
+
```
|
72
|
+
|
73
|
+
### Command line
|
74
|
+
|
75
|
+
Useful to work with files, e.g.
|
76
|
+
|
77
|
+
```
|
78
|
+
$ samlr -v --skip-conditions -f 83:CC:12:...:F7:9D:19 response.xml.base64
|
79
|
+
$ Verification passed
|
80
|
+
```
|
81
|
+
|
82
|
+
Run `samlr -h` for options.
|
83
|
+
|
84
|
+
```
|
85
|
+
SAML response command line tool.
|
86
|
+
|
87
|
+
Usage examples:
|
88
|
+
samlr --verify --fingerprint ab:23:cd --skip-conditions <response.xml|directory of responses>
|
89
|
+
samlr --verify --skip-fingerprint --skip-conditions <response.xml|directory of responses>
|
90
|
+
samlr --schema-validate response.xml
|
91
|
+
samlr --print response.xml[.base64]
|
92
|
+
|
93
|
+
Try it with the gem example:
|
94
|
+
ruby -Ilib bin/samlr -v -s -f 44:D2:9D:98:49:66:27:30:3A:67:A2:5D:97:62:31:65:57:9F:57:D1 test/fixtures/sample_response.xml
|
95
|
+
|
96
|
+
Full list of options:
|
97
|
+
--verify, -v: Verify a SAML response document
|
98
|
+
--fingerprint, -f <s>: The fingerprint to verify the certificate against
|
99
|
+
--skip-conditions, -s: Skip conditions check
|
100
|
+
--skip-validation, -k: Skip schema validation rejection
|
101
|
+
--logging, -l: Log to STDOUT
|
102
|
+
--skip-fingerprint, -i: Skip certificate fingerprint check
|
103
|
+
--schema-validate, -c: Perform a schema validation against the input
|
104
|
+
--print, -p: Pretty prints the XML
|
105
|
+
--help, -h: Show this message
|
106
|
+
```
|
107
|
+
|
108
|
+
You can also validate/test manually using e.g. `xmllint`:
|
109
|
+
|
110
|
+
```
|
111
|
+
xmllint --noout --schema schema.xsd file.xml
|
112
|
+
```
|
113
|
+
|
114
|
+
### Testing
|
115
|
+
|
116
|
+
```
|
117
|
+
bundle install
|
118
|
+
rake
|
119
|
+
```
|
120
|
+
|
121
|
+
### Supported IdPs
|
122
|
+
|
123
|
+
Please help adding IdP's or IdP services you find to work with Samlr. The below list of are known to work:
|
124
|
+
|
125
|
+
* Novell/NetIQ
|
126
|
+
* MS ADFS 2.0
|
127
|
+
* http://simplesamlphp.org/
|
128
|
+
* http://www.ssoeasy.com/
|
129
|
+
* http://www.okta.com/
|
130
|
+
* http://www.onelogin.com/
|
131
|
+
* [Salesforce SAML IdP](https://login.salesforce.com/help/doc/en/identity_provider_about.htm)
|
132
|
+
|
133
|
+
### Security
|
134
|
+
|
135
|
+
As part of keeping things secure, Samlr does schema validation on all response documents. You can control what it should do in case of invalid documents:
|
136
|
+
|
137
|
+
1. Reject the request. This is the recommended and default.
|
138
|
+
2. Log the errorneous document. In case you're transitioning to Samlr and want reassurance.
|
139
|
+
|
140
|
+
You control this by setting the schema validation mode in e.g. an initializer
|
141
|
+
|
142
|
+
```ruby
|
143
|
+
Samlr.validation_mode = :reject
|
144
|
+
Samlr.validation_mode = :log
|
145
|
+
```
|
146
|
+
|
147
|
+
### Logging
|
148
|
+
|
149
|
+
Samlr has a (silent) default logger that prints to STDOUT. You can change the log level of this logger if you want to see the output:
|
150
|
+
|
151
|
+
```ruby
|
152
|
+
Samlr.logger.level = Logger::DEBUG
|
153
|
+
```
|
154
|
+
|
155
|
+
Or you can replace the logger altogether
|
156
|
+
|
157
|
+
```ruby
|
158
|
+
Samlr.logger = Rails.logger
|
159
|
+
```
|
160
|
+
|
161
|
+
### Known Issues
|
162
|
+
|
163
|
+
Does not build on JRuby. See issue #2.
|
164
|
+
|
165
|
+
### Contributing
|
166
|
+
|
167
|
+
Pull requests very welcome. Write tests. Adhere to standards employed (indentation, spaces vs. tabs etc.).
|
168
|
+
|
169
|
+
### Error reporting
|
170
|
+
|
171
|
+
Pull requests with a failing test case much preferred.
|
172
|
+
|
173
|
+
### License
|
174
|
+
|
175
|
+
Copyright 2013 Zendesk
|
176
|
+
|
177
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
178
|
+
You may obtain a copy of the License at
|
179
|
+
|
180
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
181
|
+
|
182
|
+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
data/Rakefile
ADDED
data/bin/samlr
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "samlr"
|
4
|
+
require "samlr/command"
|
5
|
+
|
6
|
+
require "trollop"
|
7
|
+
|
8
|
+
ARGV << "--help" if ARGV.empty?
|
9
|
+
|
10
|
+
opts = Trollop.options do
|
11
|
+
banner <<-EOS
|
12
|
+
SAML response command line tool.
|
13
|
+
|
14
|
+
Usage examples:
|
15
|
+
samlr --verify --fingerprint ab:23:cd --skip-conditions <response.xml|directory of responses>
|
16
|
+
samlr --verify --certificate <x509_certificate.crt> --skip-conditions <response.xml|directory of responses>
|
17
|
+
samlr --verify --skip-fingerprint --skip-conditions <response.xml|directory of responses>
|
18
|
+
samlr --schema-validate response.xml
|
19
|
+
samlr --print response.xml[.base64]
|
20
|
+
|
21
|
+
Try it with the gem examples:
|
22
|
+
ruby -Ilib bin/samlr -v -s -f 44:D2:9D:98:49:66:27:30:3A:67:A2:5D:97:62:31:65:57:9F:57:D1 test/fixtures/sample_response.xml
|
23
|
+
ruby -Ilib bin/samlr -v -s -c test/fixtures/default_samlr_certificate.pem test/fixtures/no_cert_response.xml
|
24
|
+
|
25
|
+
Full list of options:
|
26
|
+
EOS
|
27
|
+
|
28
|
+
opt :verify, "Verify a SAML response document"
|
29
|
+
opt :fingerprint, "The fingerprint to verify the certificate against", :type => String
|
30
|
+
opt :certificate, "A certificate (PEM or DER) to validate the signature against (assuming no certificate embedded in the response)", :type => IO
|
31
|
+
opt :skip_conditions, "Skip conditions check"
|
32
|
+
opt :skip_validation, "Skip schema validation rejection"
|
33
|
+
opt :skip_fingerprint, "Skip certificate fingerprint check"
|
34
|
+
opt :verbose, "Log to STDOUT"
|
35
|
+
opt :schema_validate, "Perform a schema validation against the input"
|
36
|
+
opt :print, "Pretty prints the XML"
|
37
|
+
end
|
38
|
+
|
39
|
+
if ARGV.empty? || !File.exist?(ARGV[0])
|
40
|
+
puts "Input file not given or does not exist"
|
41
|
+
exit 1
|
42
|
+
end
|
43
|
+
|
44
|
+
opts[:certificate] &&= opts[:certificate].read
|
45
|
+
|
46
|
+
puts Samlr::Command.execute(opts, ARGV[0])
|