From 8e9dea2f5402094e9d3c632eff908ed09077f03e Mon Sep 17 00:00:00 2001 From: Christian Becker Date: Mon, 24 Oct 2016 01:40:20 +0200 Subject: [PATCH] Added on_metadata_path? for v1.4.2 See https://github.com/salsify/omniauth-multi-provider-saml/issues/3 --- lib/omniauth/strategies/saml.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/omniauth/strategies/saml.rb b/lib/omniauth/strategies/saml.rb index b43e56d..1a36e52 100644 --- a/lib/omniauth/strategies/saml.rb +++ b/lib/omniauth/strategies/saml.rb @@ -80,8 +80,17 @@ def response_fingerprint Digest::SHA1.hexdigest(cert.to_der).upcase.scan(/../).join(':') end + def on_metadata_path? + if options[:metadata_path].respond_to?(:call) + options[:metadata_path].call(env) + else + metadata_path = options[:metadata_path] || "#{request_path}/metadata" + on_path?(metadata_path) + end + end + def other_phase - if on_path?("#{request_path}/metadata") + if on_metadata_path? # omniauth does not set the strategy on the other_phase @env['omniauth.strategy'] ||= self setup_phase