A generic SAML strategy for OmniAuth.
Use the SAML strategy as a middleware in your application:
require 'omniauth' use OmniAuth::Strategies::SAML, :assertion_consumer_service_url => "consumer_service_url", :issuer => "issuer", :idp_sso_target_url => "idp_sso_target_url", :idp_cert_fingerprint => "E7:91:B2:E1:...", :name_identifier_format => "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
or in your Rails application:
Rails.application.config.middleware.use OmniAuth::Builder do provider :saml, :assertion_consumer_service_url => "consumer_service_url", :issuer => "rails-application", :idp_sso_target_url => "idp_sso_target_url", :idp_cert_fingerprint => "E7:91:B2:E1:...", :name_identifier_format => "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress" end
:assertion_consumer_service_url- The URL at which the SAML assertion should be received. With OmniAuth this is typically
:issuer- The name of your application. Some identity providers might need this to establish the identity of the service provider requesting the login. Required.
:idp_sso_target_url- The URL to which the authentication request should be sent. This would be on the identity provider. Required.
:idp_cert_fingerprint- The certificate fingerprint, e.g. "90:CC:16:F0:8D:...". This is provided from the identity provider when setting up the relationship. Optional.
:name_identifier_format- Describes the format of the username required by this application. If you need the email address, use "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress". See http://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf section 8.3 for other options. Note that the identity provider might not support all options. Optional.
Portions Copyright (c) 2007 Sun Microsystems Inc.
Portions Copyright (c) 2007 Todd W Saxton.
Portions Copyright (c) 2011 Raecoo Cao.
Portions Copyright (c) 2011 Ryan Wilcox.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.