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
{{ message }}
This repository was archived by the owner on Mar 12, 2026. It is now read-only.
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.
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
23
35
## Adding Features, Pull Requests
24
36
* Fork the repository
@@ -35,7 +47,7 @@ Using `Gemfile`
35
47
36
48
```ruby
37
49
# latest stable
38
-
gem 'ruby-saml', '~> 0.9.1'
50
+
gem 'ruby-saml', '~> 1.0.0'
39
51
40
52
# or track master for bleeding-edge
41
53
gem 'ruby-saml', :github => 'onelogin/ruby-saml'
@@ -74,6 +86,19 @@ Using RubyGems
74
86
gem install nokogiri --version '~> 1.5.10'
75
87
````
76
88
89
+
### Configuring Logging
90
+
91
+
When troubleshooting SAML integration issues, you will find it extremely helpful to examine the
92
+
output of this gem's business logic. By default, log messages are emitted to RAILS_DEFAULT_LOGGER
93
+
when the gem is used in a Rails context, and to STDOUT when the gem is used outside of Rails.
94
+
95
+
To override the default behavior and control the destination of log messages, provide
96
+
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):
@@ -89,28 +114,37 @@ 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
96
120
if response.is_valid?
97
121
# authorize_success, log the user
98
-
session[:userid] = response.name_id
122
+
session[:userid] = response.nameid
99
123
session[:attributes] = response.attributes
100
124
else
101
125
authorize_failure # This method shows an error message
102
126
end
103
127
end
104
128
```
105
129
106
-
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:
130
+
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:
131
+
132
+
If the assertion of the SAMLResponse is not encrypted, you can initialize the Response without the :settings parameter and set it later,
@@ -330,8 +364,8 @@ The Ruby Toolkit supports 2 different kinds of signature: Embeded and as GET par
330
364
In order to be able to sign we need first to define the private key and the public cert of the service provider
331
365
332
366
```ruby
333
-
settings.certificate = "CERTIFICATE TEXT WITH HEADS"
334
-
settings.private_key = "PRIVATE KEY TEXT WITH HEADS"
367
+
settings.certificate = "CERTIFICATE TEXT WITH HEAD AND FOOT"
368
+
settings.private_key = "PRIVATE KEY TEXT WITH HEAD AND FOOT"
335
369
```
336
370
337
371
The settings related to sign are stored in the `security` attribute of the settings:
@@ -354,6 +388,28 @@ Notice that the RelayState parameter is used when creating the Signature on the
354
388
remember to provide it to the Signature builder if you are sending a GET RelayState parameter or
355
389
Signature validation process will fail at the Identity Provider.
356
390
391
+
The Service Provider will sign the request/responses with its private key.
392
+
The Identity Provider will validate the sign of the received request/responses with the public x500 cert of the
393
+
Service Provider.
394
+
395
+
Notice that this toolkit uses 'settings.certificate' and 'settings.private_key' for the sign and the decrypt process.
396
+
397
+
398
+
## Decrypting
399
+
400
+
The Ruby Toolkit supports EncryptedAssertion.
401
+
402
+
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.
403
+
404
+
```ruby
405
+
settings.certificate = "CERTIFICATE TEXT WITH HEAD AND FOOT"
406
+
settings.private_key = "PRIVATE KEY TEXT WITH HEAD AND FOOT"
407
+
```
408
+
409
+
The Identity Provider will encrypt the Assertion with the public cert of the Service Provider.
410
+
The Service Provider will decrypt the EncryptedAssertion with its private key.
411
+
412
+
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