omniauth-saml 1.1.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 032f34c12924a5666a189462f819b871c2e321891cbe23b45e56c47acdbfc53c
4
+ data.tar.gz: 17bb6e9741181862fcb34f3ca0a47084b9805aba71b3dd5dadfb951c7cd20d27
5
+ SHA512:
6
+ metadata.gz: eb87a7392dc23407ab0064b67efd4ffefd9ec3fbbca18b32e96bf973281dffb9477bffc3765d8b4c3e278df7aedca255a95aa03deb44053b33c3cfff5af9435e
7
+ data.tar.gz: 22daef0cc26447f27023c5dc2e6f816e1f79c57c0538b86ffae0f8a2ea9d08492bc351aa31838ca7b4a272ae577aea3f914a87dba0656e1ac2e098f49f034041
data/CHANGELOG.md CHANGED
@@ -1,35 +1,182 @@
1
- # OmniAuth SAML Version History
1
+ <a name="v2.1.0"></a>
2
+ ### v2.1.0 (2022-03-01)
2
3
 
3
- A generic SAML strategy for OmniAuth.
4
4
 
5
- https://github.com/PracticallyGreen/omniauth-saml
5
+ #### Refactor
6
6
 
7
+ * Rename usage of deprecated SAML options ([74ed8df](/../../commit/74ed8df))
7
8
 
8
- ## 1.1.0 (2013-11-07)
9
+ #### Chores
10
+
11
+ * bump ruby-saml to 1.12 ([15c156a](/../../commit/15c156a))
12
+
13
+ <a name="v2.0.0"></a>
14
+ ### v2.0.0 (2021-01-13)
15
+
16
+
17
+ #### Chores
18
+
19
+ * Allow OmniAuth 2.0.0 ([f7ec7ee](/../../commit/f7ec7ee))
20
+
21
+
22
+ <a name="v1.10.3"></a>
23
+ ### v1.10.3 (2020-10-06)
24
+
25
+
26
+ #### Bug Fixes
27
+
28
+ * add options to logout_request initialization ([c271a37](/../../commit/c271a37))
29
+
30
+
31
+ <a name="v1.10.2"></a>
32
+ ### v1.10.2 (2018-05-23)
33
+
34
+
35
+ #### Features
36
+
37
+ * **saml**
38
+ * inherits allows response options from ruby-saml instead of whitelist ([a0eedd6](/../../commit/a0eedd6))
39
+
40
+
41
+ <a name="v1.10.1"></a>
42
+ ### v1.10.1 (2018-06-07)
43
+
44
+
45
+ #### Features
46
+
47
+ * **saml-response**
48
+ * whitelist more response options ([575198d](/../../commit/575198d))
49
+
50
+
51
+ <a name="v1.10.0"></a>
52
+ ### v1.10.0 (2018-02-19)
53
+
54
+
55
+ #### Bug Fixes
56
+
57
+ * ambiguous path match in other phase ([1b465b9](/../../commit/1b465b9))
58
+ * Update ruby-saml gem to 1.7 or later to fix CVE-2017-11430 ([6bc28ad](/../../commit/6bc28ad))
59
+
60
+
61
+ <a name="v1.9.0"></a>
62
+ ### v1.9.0 (2018-01-29)
63
+
64
+
65
+ #### Bug Fixes
66
+
67
+ * Update omniauth gem to 1.3.2 or later 1.3.x ([b6bb425](/../../commit/b6bb425))
68
+
69
+
70
+ <a name="v1.8.1"></a>
71
+ ### v1.8.1 (2017-06-22)
72
+
73
+
74
+ #### Bug Fixes
75
+
76
+ * default assertion_consumer_service_url not set during callback ([4a2a5ef](/../../commit/4a2a5ef))
77
+
78
+
79
+ <a name="v1.8.0"></a>
80
+ ### v1.8.0 (2017-06-07)
81
+
82
+
83
+ #### Features
84
+
85
+ * include SessionIndex in logout requests ([fb6ad86](/../../commit/fb6ad86))
86
+ * Support for configurable IdP SLO session destruction ([586bf89](/../../commit/586bf89))
87
+ * Add `uid_attribute` option to control the attribute used for the user id. ([eacc536](/../../commit/eacc536))
88
+
89
+
90
+ <a name="v1.7.0"></a>
91
+ ### v1.7.0 (2016-10-19)
92
+
93
+ #### Features
94
+
95
+ * Support for Single Logout ([cd3fc43](/../../commit/cd3fc43))
96
+ * Add issuer information to the metadata endpoint, to allow IdPs to properly configure themselves. ([7bbbb67](/../../commit/7bbbb67))
97
+ * Added the response object to the extra['response_object'], so we can use the raw response object if we want to. ([76ed3d6](/../../commit/76ed3d6))
98
+
99
+ #### Chores
100
+
101
+ * Update `ruby-saml` to 1.4.0 to address security fixes. ([638212](/../../commit/638212))
102
+
103
+ <a name="v1.6.0"></a>
104
+ ### v1.6.0 (2016-06-27)
105
+ * Ensure that subclasses of `OmniAuth::Stategies::SAML` are registered with OmniAuth as strategies (https://github.com/omniauth/omniauth-saml/pull/95)
106
+ * Update ruby-saml to 1.3 to address [CVE-2016-5697](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-5697) (Signature wrapping attacks)
107
+
108
+ <a name="v1.5.0"></a>
109
+ ### v1.5.0 (2016-02-25)
110
+
111
+ * Initialize OneLogin::RubySaml::Response instance with settings
112
+ * Adding "settings" to Response Class at initialization to handle signing verification
113
+ * Support custom attributes
114
+ * change URL from PracticallyGreen to omniauth
115
+ * Add specs for ACS fallback URL behavior
116
+ * Call validation earlier to get real error instead of 'response missing name_id'
117
+ * Avoid mutation of the options hash during requests and callbacks
118
+
119
+ <a name="v1.4.2"></a>
120
+ ### v1.4.2 (2016-02-09)
121
+
122
+ * update ruby-saml to 1.1
123
+
124
+ <a name="v1.4.1"></a>
125
+ ### v1.4.1 (2015-08-09)
126
+
127
+ * Configurable attribute_consuming_service
128
+
129
+ <a name="v1.4.0"></a>
130
+ ### v1.4.0 (2015-07-23)
131
+
132
+ * update ruby-saml to 1.0.0
133
+
134
+ <a name="v1.3.1"></a>
135
+ ### v1.3.1 (2015-02-26)
136
+
137
+ * Added missing fingerprint key check
138
+ * Expose fingerprint on the auth_hash
139
+
140
+ <a name="v1.3.0"></a>
141
+ ### v1.3.0 (2015-01-23)
142
+
143
+ * add `idp_cert_fingerprint_validator` option
144
+
145
+ <a name="v1.2.0"></a>
146
+ ### v1.2.0 (2014-03-19)
147
+
148
+ * provide SP metadata at `/auth/saml/metadata`
149
+
150
+ <a name="v1.1.0"></a>
151
+ ### v1.1.0 (2013-11-07)
9
152
 
10
153
  * no longer set a default `name_identifier_format`
11
154
  * pass strategy options to the underlying ruby-saml library
12
155
  * fallback to omniauth callback url if `assertion_consumer_service_url` is not set
13
156
  * add `idp_sso_target_url_runtime_params` option
14
157
 
15
- ## 1.0.0 (2012-11-12)
158
+ <a name="v1.0.0"></a>
159
+ ### v1.0.0 (2012-11-12)
16
160
 
17
161
  * remove SAML code and port to ruby-saml gem
18
162
  * fix incompatibility with OmniAuth 1.1
19
163
 
20
- ## 0.9.2 (2012-03-30)
164
+ <a name="v0.9.2"></a>
165
+ ### v0.9.2 (2012-03-30)
21
166
 
22
167
  * validate the SAML response
23
168
  * 100% test coverage
24
169
  * now requires ruby 1.9.2+
25
170
 
26
- ## 0.9.1 (2012-02-23)
171
+ <a name="v0.9.1"></a>
172
+ ### v0.9.1 (2012-02-23)
27
173
 
28
174
  * return first and last name in the info hash
29
175
  * no longer use LDAP OIDs for name and email selection
30
176
  * return SAML attributes as the omniauth raw_info hash
31
177
 
32
- ## 0.9.0 (2012-02-14)
178
+ <a name="v0.9.0"></a>
179
+ ### v0.9.0 (2012-02-14)
33
180
 
34
181
  * initial release
35
182
  * extracts commits from omniauth 0-3-stable branch
data/LICENSE.md ADDED
@@ -0,0 +1,25 @@
1
+ # License
2
+
3
+ Copyright © 2016 Omniauth-SAML maintainers
4
+
5
+ Copyright © 2011-2014 [Practically Green, Inc.](http://www.practicallygreen.com/).
6
+
7
+ All rights reserved. Released under the MIT license.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,13 +1,26 @@
1
1
  # OmniAuth SAML
2
2
 
3
- A generic SAML strategy for OmniAuth.
3
+ [![Gem Version](http://img.shields.io/gem/v/omniauth-saml.svg)][gem]
4
+ [![Ruby](https://github.com/omniauth/omniauth-saml/actions/workflows/ruby.yml/badge.svg)](https://github.com/omniauth/omniauth-saml/actions/workflows/ruby.yml)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/749e17b553ea944522c1/maintainability)][codeclimate]
6
+ [![Coverage Status](http://img.shields.io/coveralls/omniauth/omniauth-saml.svg)][coveralls]
4
7
 
5
- https://github.com/PracticallyGreen/omniauth-saml
8
+ [gem]: https://rubygems.org/gems/omniauth-saml
9
+ [codeclimate]: https://codeclimate.com/github/omniauth/omniauth-saml/maintainability
10
+ [coveralls]: https://coveralls.io/r/omniauth/omniauth-saml
11
+
12
+ A generic SAML strategy for OmniAuth available under the [MIT License](LICENSE.md)
13
+
14
+ https://github.com/omniauth/omniauth-saml
6
15
 
7
16
  ## Requirements
8
17
 
9
- * [OmniAuth](http://www.omniauth.org/) 1.1+
10
- * Ruby 1.9.2
18
+ * [OmniAuth](http://www.omniauth.org/) 1.3+
19
+ * Ruby 2.4.x+
20
+
21
+ ## Versioning
22
+
23
+ We tag and release gems according to the [Semantic Versioning](http://semver.org/) principle. In addition to the guidelines of Semantic Versioning, we follow a further guideline that otherwise backwards-compatible dependency upgrades for security reasons should generally be cause for a MINOR version upgrade as opposed to a PATCH version upgrade. Backwards-incompatible dependency upgrades for security reasons should still result in a MAJOR version upgrade for this library.
11
24
 
12
25
  ## Usage
13
26
 
@@ -17,11 +30,16 @@ Use the SAML strategy as a middleware in your application:
17
30
  require 'omniauth'
18
31
  use OmniAuth::Strategies::SAML,
19
32
  :assertion_consumer_service_url => "consumer_service_url",
20
- :issuer => "issuer",
21
- :idp_sso_target_url => "idp_sso_target_url",
22
- :idp_sso_target_url_runtime_params => {:original_request_param => :mapped_idp_param},
33
+ :sp_entity_id => "sp_entity_id",
34
+ :idp_sso_service_url => "idp_sso_service_url",
35
+ :idp_sso_service_url_runtime_params => {:original_request_param => :mapped_idp_param},
23
36
  :idp_cert => "-----BEGIN CERTIFICATE-----\n...-----END CERTIFICATE-----",
37
+ :idp_cert_multi => {
38
+ :signing => ["-----BEGIN CERTIFICATE-----\n...-----END CERTIFICATE-----", "-----BEGIN CERTIFICATE-----\n...-----END CERTIFICATE-----", ...],
39
+ :encryption => []
40
+ }
24
41
  :idp_cert_fingerprint => "E7:91:B2:E1:...",
42
+ :idp_cert_fingerprint_validator => lambda { |fingerprint| fingerprint },
25
43
  :name_identifier_format => "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
26
44
  ```
27
45
 
@@ -39,16 +57,29 @@ and in `config/initializers/omniauth.rb`:
39
57
  Rails.application.config.middleware.use OmniAuth::Builder do
40
58
  provider :saml,
41
59
  :assertion_consumer_service_url => "consumer_service_url",
42
- :issuer => "rails-application",
43
- :idp_sso_target_url => "idp_sso_target_url",
44
- :idp_sso_target_url_runtime_params => {:original_request_param => :mapped_idp_param},
60
+ :sp_entity_id => "rails-application",
61
+ :idp_sso_service_url => "idp_sso_service_url",
62
+ :idp_sso_service_url_runtime_params => {:original_request_param => :mapped_idp_param},
45
63
  :idp_cert => "-----BEGIN CERTIFICATE-----\n...-----END CERTIFICATE-----",
64
+ :idp_cert_multi => {
65
+ :signing => ["-----BEGIN CERTIFICATE-----\n...-----END CERTIFICATE-----", "-----BEGIN CERTIFICATE-----\n...-----END CERTIFICATE-----", ...],
66
+ :encryption => []
67
+ }
46
68
  :idp_cert_fingerprint => "E7:91:B2:E1:...",
69
+ :idp_cert_fingerprint_validator => lambda { |fingerprint| fingerprint },
47
70
  :name_identifier_format => "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
48
71
  end
49
72
  ```
50
73
 
51
- For IdP-initiated SSO, users should directly access the IdP SSO target URL. Set the `href` of your application's login link to the value of `idp_sso_target_url`. For SP-initiated SSO, link to `/auth/saml`.
74
+ For IdP-initiated SSO, users should directly access the IdP SSO service URL. Set the `href` of your application's login link to the value of `idp_sso_service_url`. For SP-initiated SSO, link to `/auth/saml`.
75
+
76
+ A `OneLogin::RubySaml::Response` object is added to the `env['omniauth.auth']` extra attribute, so we can use it in the controller via `env['omniauth.auth'].extra.response_object`
77
+
78
+ ## SP Metadata
79
+
80
+ The service provider metadata used to ease configuration of the SAML SP in the IdP can be retrieved from `http://example.com/auth/saml/metadata`. Send this URL to the administrator of the IdP.
81
+
82
+ Note that when [integrating with Devise](#devise-integration), the URL path will be scoped according to the name of the Devise resource. For example, if the app's user model calls `devise_for :users`, the metadata URL will be `http://example.com/users/auth/saml/metadata`.
52
83
 
53
84
  ## Options
54
85
 
@@ -56,25 +87,45 @@ For IdP-initiated SSO, users should directly access the IdP SSO target URL. Set
56
87
  received. If not provided, defaults to the OmniAuth callback URL (typically
57
88
  `http://example.com/auth/saml/callback`). Optional.
58
89
 
59
- * `:issuer` - The name of your application. Some identity providers might need this
90
+ * `:sp_entity_id` - The name of your application. Some identity providers might need this
60
91
  to establish the identity of the service provider requesting the login. **Required**.
61
92
 
62
- * `:idp_sso_target_url` - The URL to which the authentication request should be sent.
93
+ * `:idp_sso_service_url` - The URL to which the authentication request should be sent.
63
94
  This would be on the identity provider. **Required**.
64
95
 
65
- * `:idp_sso_target_url_runtime_params` - A dynamic mapping of request params that exist
96
+ * `:idp_slo_service_url` - The URL to which the single logout request and response should
97
+ be sent. This would be on the identity provider. Optional.
98
+
99
+ * `:idp_slo_session_destroy` - A proc that accepts up to two parameters (the rack environment, and the session),
100
+ and performs whatever tasks are necessary to log out the current user from your application.
101
+ See the example listed under "Single Logout." Defaults to calling `#clear` on the session. Optional.
102
+
103
+ * `:slo_default_relay_state` - The value to use as default `RelayState` for single log outs. The
104
+ value can be a string, or a `Proc` (or other object responding to `call`). The `request`
105
+ instance will be passed to this callable if it has an arity of 1. If the value is a string,
106
+ the string will be returned, when the `RelayState` is called. Optional.
107
+
108
+ * `:idp_sso_service_url_runtime_params` - A dynamic mapping of request params that exist
66
109
  during the request phase of OmniAuth that should to be sent to the IdP after a specific
67
110
  mapping. So for example, a param `original_request_param` with value `original_param_value`,
68
111
  could be sent to the IdP on the login request as `mapped_idp_param` with value
69
112
  `original_param_value`. Optional.
70
113
 
71
114
  * `:idp_cert` - The identity provider's certificate in PEM format. Takes precedence
72
- over the fingerprint option below. This option or `:idp_cert_fingerprint` must
115
+ over the fingerprint option below. This option or `:idp_cert_multi` or `:idp_cert_fingerprint` or `:idp_cert_fingerprint_validator` must
73
116
  be present.
117
+
118
+ * `:idp_cert_multi` - Multiple identity provider certificates in PEM format. Takes precedence
119
+ over the fingerprint option below. This option `:idp_cert` or `:idp_cert_fingerprint` or `:idp_cert_fingerprint_validator` must
120
+ be present.
74
121
 
75
122
  * `:idp_cert_fingerprint` - The SHA1 fingerprint of the certificate, e.g.
76
123
  "90:CC:16:F0:8D:...". This is provided from the identity provider when setting up
77
- the relationship. This option or `:idp_cert` must be present.
124
+ the relationship. This option or `:idp_cert` or `:idp_cert_multi` or `:idp_cert_fingerprint_validator` MUST be present.
125
+
126
+ * `:idp_cert_fingerprint_validator` - A lambda that MUST accept one parameter
127
+ (the fingerprint), verify if it is valid and return it if successful. This option
128
+ or `:idp_cert` or `:idp_cert_multi` or `:idp_cert_fingerprint` MUST be present.
78
129
 
79
130
  * `:name_identifier_format` - Used during SP-initiated SSO. Describes the format of
80
131
  the username required by this application. If you need the email address, use
@@ -84,33 +135,117 @@ For IdP-initiated SSO, users should directly access the IdP SSO target URL. Set
84
135
  If not specified, the IdP is free to choose the name identifier format used
85
136
  in the response. Optional.
86
137
 
87
- * See the `Onelogin::Saml::Settings` class in the [Ruby SAML gem](https://github.com/onelogin/ruby-saml) for additional supported options.
138
+ * `:request_attributes` - Used to build the metadata file to inform the IdP to send certain attributes
139
+ along with the SAMLResponse messages. Defaults to requesting `name`, `first_name`, `last_name` and `email`
140
+ attributes. See the `OneLogin::RubySaml::AttributeService` class in the [Ruby SAML gem](https://github.com/onelogin/ruby-saml) for the available options for each attribute. Set to `{}` to disable this from metadata.
88
141
 
89
- ## Authors
142
+ * `:attribute_service_name` - Name for the attribute service. Defaults to `Required attributes`.
143
+
144
+ * `:attribute_statements` - Used to map Attribute Names in a SAMLResponse to
145
+ entries in the OmniAuth [info hash](https://github.com/intridea/omniauth/wiki/Auth-Hash-Schema#schema-10-and-later).
146
+ For example, if your SAMLResponse contains an Attribute called 'EmailAddress',
147
+ specify `{:email => ['EmailAddress']}` to map the Attribute to the
148
+ corresponding key in the info hash. URI-named Attributes are also supported, e.g.
149
+ `{:email => ['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress']}`.
150
+ *Note*: All attributes can also be found in an array under `auth_hash[:extra][:raw_info]`,
151
+ so this setting should only be used to map attributes that are part of the OmniAuth info hash schema.
152
+
153
+ * `:uid_attribute` - Attribute that uniquely identifies the user. If unset, the name identifier returned by the IdP is used.
154
+
155
+ * See the `OneLogin::RubySaml::Settings` class in the [Ruby SAML gem](https://github.com/onelogin/ruby-saml) for additional supported options.
156
+
157
+ ## IdP Metadata
158
+
159
+ You can use the `OneLogin::RubySaml::IdpMetadataParser` to configure some options:
90
160
 
91
- Authored by Raecoo Cao, Todd W Saxton, Ryan Wilcox, Rajiv Aaron Manglani, Steven Anderson, and Nikos Dimitrakopoulos.
161
+ ```ruby
162
+ require 'omniauth'
163
+ idp_metadata_parser = OneLogin::RubySaml::IdpMetadataParser.new
164
+ idp_metadata = idp_metadata_parser.parse_remote_to_hash("http://idp.example.com/saml/metadata")
165
+
166
+ # or, if you have the metadata in a String:
167
+ # idp_metadata = idp_metadata_parser.parse_to_hash(idp_metadata_xml)
168
+
169
+ use OmniAuth::Strategies::SAML,
170
+ idp_metadata.merge(
171
+ :assertion_consumer_service_url => "consumer_service_url",
172
+ :sp_entity_id => "sp_entity_id"
173
+ )
174
+ ```
92
175
 
93
- Maintained by [Rajiv Aaron Manglani](http://www.rajivmanglani.com/).
176
+ See the [Ruby SAML gem's README](https://github.com/onelogin/ruby-saml#metadata-based-configuration) for more details.
94
177
 
95
- ## License
178
+ ## Devise Integration
96
179
 
97
- Copyright (c) 2011-2013 [Practically Green, Inc.](http://www.practicallygreen.com/).
98
- All rights reserved. Released under the MIT license.
180
+ Straightforward integration with [Devise](https://github.com/plataformatec/devise), the widely-used authentication solution for Rails.
99
181
 
100
- Permission is hereby granted, free of charge, to any person obtaining a copy
101
- of this software and associated documentation files (the "Software"), to deal
102
- in the Software without restriction, including without limitation the rights
103
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
104
- copies of the Software, and to permit persons to whom the Software is
105
- furnished to do so, subject to the following conditions:
182
+ In `config/initializers/devise.rb`:
106
183
 
107
- The above copyright notice and this permission notice shall be included in
108
- all copies or substantial portions of the Software.
184
+ ```ruby
185
+ Devise.setup do |config|
186
+ config.omniauth :saml,
187
+ idp_cert_fingerprint: 'fingerprint',
188
+ idp_sso_service_url: 'idp_sso_service_url'
189
+ end
190
+ ```
191
+
192
+ Then follow Devise's general [OmniAuth tutorial](https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview), replacing references to `facebook` with `saml`.
193
+
194
+ ## Single Logout
195
+
196
+ Single Logout can be Service Provider initiated or Identity Provider initiated.
197
+
198
+ For SP initiated logout, the `idp_slo_service_url` option must be set to the logout url on the IdP,
199
+ and users directed to `user_saml_omniauth_authorize_path + '/spslo'` after logging out locally. For
200
+ IdP initiated logout, logout requests from the IdP should go to `/auth/saml/slo` (this can be
201
+ advertised in metadata by setting the `single_logout_service_url` config option).
202
+
203
+ When using Devise as an authentication solution, the SP initiated flow can be integrated
204
+ in the `SessionsController#destroy` action.
205
+
206
+ For this to work it is important to preserve the `saml_uid` and `saml_session_index` value before Devise
207
+ clears the session and redirect to the `/spslo` sub-path to initiate the single logout.
208
+
209
+ Example `destroy` action in `sessions_controller.rb`:
210
+
211
+ ```ruby
212
+ class SessionsController < Devise::SessionsController
213
+ # ...
214
+
215
+ def destroy
216
+ # Preserve the saml_uid and saml_session_index in the session
217
+ saml_uid = session['saml_uid']
218
+ saml_session_index = session['saml_session_index']
219
+ super do
220
+ session['saml_uid'] = saml_uid
221
+ session['saml_session_index'] = saml_session_index
222
+ end
223
+ end
224
+
225
+ # ...
226
+
227
+ def after_sign_out_path_for(_)
228
+ if session['saml_uid'] && session['saml_session_index'] && SAML_SETTINGS.idp_slo_service_url
229
+ user_saml_omniauth_authorize_path + "/spslo"
230
+ else
231
+ super
232
+ end
233
+ end
234
+ end
235
+ ```
236
+
237
+ By default, omniauth-saml attempts to log the current user out of your application by clearing the session.
238
+ This may not be enough for some authentication solutions (e.g. [Clearance](https://github.com/thoughtbot/clearance/)).
239
+ Instead, you may set the `:idp_slo_session_destroy` option to a proc that performs the necessary logout tasks.
240
+
241
+ Example `:idp_slo_session_destroy` setting for Clearance compatibility:
242
+
243
+ ```ruby
244
+ Rails.application.config.middleware.use OmniAuth::Builder do
245
+ provider :saml, idp_slo_session_destroy: proc { |env, _session| env[:clearance].sign_out }, ...
246
+ end
247
+ ```
248
+
249
+ ## Authors
109
250
 
110
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
111
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
112
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
113
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
114
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
115
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
116
- THE SOFTWARE.
251
+ Authored by [Rajiv Aaron Manglani](http://www.rajivmanglani.com/), Raecoo Cao, Todd W Saxton, Ryan Wilcox, Steven Anderson, Nikos Dimitrakopoulos, Rudolf Vriend and [Bruno Pedro](http://brunopedro.com/).