You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge remote-tracking branch 'upstream/master' into feature/jruby_support_0.9_rebase
* upstream/master: (47 commits)
Handle empty URI references as per http://www.w3.org/TR/xmldsig-core/#sec-Same-Document; thx to @sixto for resolving a test case failure.
support nameid in attribute values
first attempt at adding support for scoped attributes needs additional work and tests
Add some documentation about the soft setting parameter
Update readme.md for 1.0.0 release
Update date of the 1.0.0 release
Update Readme and changelog
Security improvement: Avoid entity expansion (XEE attacks)
According to the xsd, the issuer has to be before the status
Update changelog
Fix#244, related to PR #243. Fix bug on metadata. Reorder KeyDescriptors
Add logging information to README
Allow logging to be delegated to an arbitrary Logger.
Add tests for existing Logging functionality
no more silent failure fetching idp metadata
fix schema validation errors in service provider metadata
tests to validate service provider metadata xml against the schema
ignore gemfile.lock files in the gemfiles directory
Prepare 1.0.0 release
Improve compatibility with namespaces
...
Version `1.0` is a recommended update for all Ruby SAML users as it includes security fixes.
7
+
8
+
Version `1.0` adds security improvements like entity expansion limitation, more SAML message validations, and other important improvements like decrypt support.
9
+
10
+
For more details, please review [the changelog](changelog.md).
11
+
12
+
### Important Changes
13
+
Please note the `get_idp_metadata` method raises an exception when it is not able to fetch the idp metadata, so review your integration if you are using this functionality.
2
14
3
15
## Updating from 0.8.x to 0.9.x
4
-
Version `0.9` adds many new features and improvements. It is a recommended update for all Ruby SAML users. For more details, please review [the changelog](changelog.md)
16
+
Version `0.9` adds many new features and improvements.
5
17
6
18
## Updating from 0.7.x to 0.8.x
7
19
Version `0.8.x` changes the namespace of the gem from `OneLogin::Saml` to `OneLogin::RubySaml`. Please update your implementations of the gem accordingly.
@@ -18,7 +30,7 @@ We created a demo project for Rails4 that uses the latest version of this librar
18
30
* 1.8.7
19
31
* 1.9.x
20
32
* 2.1.x
21
-
* 2.2.0
33
+
* 2.2.x
22
34
* JRuby 1.7.19
23
35
24
36
## Adding Features, Pull Requests
@@ -36,7 +48,7 @@ Using `Gemfile`
36
48
37
49
```ruby
38
50
# latest stable
39
-
gem 'ruby-saml', '~> 0.9'
51
+
gem 'ruby-saml', '~> 1.0.0'
40
52
41
53
# or track master for bleeding-edge
42
54
gem 'ruby-saml', :github => 'onelogin/ruby-saml'
@@ -75,6 +87,19 @@ Using RubyGems
75
87
gem install nokogiri --version '~> 1.5.10'
76
88
````
77
89
90
+
### Configuring Logging
91
+
92
+
When troubleshooting SAML integration issues, you will find it extremely helpful to examine the
93
+
output of this gem's business logic. By default, log messages are emitted to RAILS_DEFAULT_LOGGER
94
+
when the gem is used in a Rails context, and to STDOUT when the gem is used outside of Rails.
95
+
96
+
To override the default behavior and control the destination of log messages, provide
97
+
a ruby Logger object to the gem's logging singleton:
This is the first request you will get from the identity provider. It will hit your application at a specific URL (that you've announced as being your SAML initialization point). The response to this initialization, is a redirect back to the identity provider, which can look something like this (ignore the saml_settings method call for now):
@@ -90,27 +115,36 @@ Once you've redirected back to the identity provider, it will ensure that the us
# We validate the SAML Response and check if the user already exists in the system
97
121
if response.is_valid?
98
122
# authorize_success, log the user
99
-
session[:userid] = response.name_id
123
+
session[:userid] = response.nameid
100
124
session[:attributes] = response.attributes
101
125
else
102
126
authorize_failure # This method shows an error message
103
127
end
104
128
end
105
129
```
106
130
107
-
In the above there are a few assumptions in place, one being that the response.name_id is an email address. This is all handled with how you specify the settings that are in play via the saml_settings method. That could be implemented along the lines of this:
131
+
In the above there are a few assumptions in place, one being that the response.nameid is an email address. This is all handled with how you specify the settings that are in play via the saml_settings method. That could be implemented along the lines of this:
132
+
133
+
If the assertion of the SAMLResponse is not encrypted, you can initialize the Response without the :settings parameter and set it later,
@@ -148,7 +182,7 @@ class SamlController < ApplicationController
148
182
# We validate the SAML Response and check if the user already exists in the system
149
183
if response.is_valid?
150
184
# authorize_success, log the user
151
-
session[:userid] = response.name_id
185
+
session[:userid] = response.nameid
152
186
session[:attributes] = response.attributes
153
187
else
154
188
authorize_failure # This method shows an error message
@@ -331,8 +365,8 @@ The Ruby Toolkit supports 2 different kinds of signature: Embeded and as GET par
331
365
In order to be able to sign we need first to define the private key and the public cert of the service provider
332
366
333
367
```ruby
334
-
settings.certificate = "CERTIFICATE TEXT WITH HEADS"
335
-
settings.private_key = "PRIVATE KEY TEXT WITH HEADS"
368
+
settings.certificate = "CERTIFICATE TEXT WITH HEAD AND FOOT"
369
+
settings.private_key = "PRIVATE KEY TEXT WITH HEAD AND FOOT"
336
370
```
337
371
338
372
The settings related to sign are stored in the `security` attribute of the settings:
@@ -355,6 +389,29 @@ Notice that the RelayState parameter is used when creating the Signature on the
355
389
remember to provide it to the Signature builder if you are sending a GET RelayState parameter or
356
390
Signature validation process will fail at the Identity Provider.
357
391
392
+
The Service Provider will sign the request/responses with its private key.
393
+
The Identity Provider will validate the sign of the received request/responses with the public x500 cert of the
394
+
Service Provider.
395
+
396
+
Notice that this toolkit uses 'settings.certificate' and 'settings.private_key' for the sign and the decrypt process.
397
+
398
+
Enable/disable the soft mode by the settings.soft parameter. When is set false, the saml validations errors will raise an exception.
399
+
400
+
## Decrypting
401
+
402
+
The Ruby Toolkit supports EncryptedAssertion.
403
+
404
+
In order to be able to decrypt a SAML Response that contains a EncryptedAssertion we need first to define the private key and the public cert of the service provider, and share this with the Identity Provider.
405
+
406
+
```ruby
407
+
settings.certificate = "CERTIFICATE TEXT WITH HEAD AND FOOT"
408
+
settings.private_key = "PRIVATE KEY TEXT WITH HEAD AND FOOT"
409
+
```
410
+
411
+
The Identity Provider will encrypt the Assertion with the public cert of the Service Provider.
412
+
The Service Provider will decrypt the EncryptedAssertion with its private key.
413
+
414
+
Notice that this toolkit uses 'settings.certificate' and 'settings.private_key' for the sign and the decrypt process.
*[#246](https://github.com/onelogin/ruby-saml/pull/246) Fix bug generating Logout Response (issuer was at wrong order)
6
+
*[#243](https://github.com/onelogin/ruby-saml/issues/243) and [#244](https://github.com/onelogin/ruby-saml/issues/244) Fix metadata builder errors. Fix metadata xsd.
7
+
*[#241](https://github.com/onelogin/ruby-saml/pull/241) Add decrypt support (EncryptID and EncryptedAssertion). Improve compatibility with namespaces.
8
+
*[#240](https://github.com/onelogin/ruby-saml/pull/240) and [#238](https://github.com/onelogin/ruby-saml/pull/238) Improve test coverage and refactor.
9
+
*[#239](https://github.com/onelogin/ruby-saml/pull/239) Improve security: Add more validations to SAMLResponse, LogoutRequest and LogoutResponse. Refactor code and improve tests coverage.
10
+
*[#237](https://github.com/onelogin/ruby-saml/pull/237) Don't pretty print metadata by default.
11
+
*[#235](https://github.com/onelogin/ruby-saml/pull/235) Remove the soft parameter from validation methods. Now can be configured on the settings and each class read it and store as an attribute of the class. Adding some validations and refactor old ones.
12
+
*[#232](https://github.com/onelogin/ruby-saml/pull/232) Improve validations: Store the causes in the errors array, code refactor
13
+
*[#231](https://github.com/onelogin/ruby-saml/pull/231) Refactor HTTP-Redirect Sign method, Move test data to right folder
14
+
*[#226](https://github.com/onelogin/ruby-saml/pull/226) Ensure IdP certificate is formatted properly
15
+
*[#225](https://github.com/onelogin/ruby-saml/pull/225) Add documentation to several methods. Fix xpath injection on xml_security.rb
16
+
*[#223](https://github.com/onelogin/ruby-saml/pull/223) Allow logging to be delegated to an arbitrary Logger
17
+
*[#222](https://github.com/onelogin/ruby-saml/pull/222) No more silent failure fetching idp metadata (OneLogin::RubySaml::HttpError raised).
18
+
2
19
### 0.9.2 (Apr 28, 2015)
3
20
*[#216](https://github.com/onelogin/ruby-saml/pull/216) Add fingerprint algorithm support
0 commit comments