intridea/omniauth — pull request #554 by toyokazu (2011-12-13 06:02:40+00:00)
Title: A request to insert env['SCRIPT_NAME'] before on_failure new_path

Hi,

Current implementation of on_failure seems not to consider application prefix like 'sub URI' in Passenger. If possible, would you insert env['SCRIPT_NAME'] into new_path?

% vi lib/omniauth.rb
...
:on_failure => Proc.new do |env|
message_key = env['omniauth.error.type']
new_path = "#{env['SCRIPT_NAME']}#{OmniAuth.config.path_prefix}/failure?message=#{message_key}"
[302, {'Location' => new_path, 'Content-Type'=> 'text/html'}, []]
end,
...

The failure message is important for the frontend module base authentication systems like Shibboleth, OpenSSO. Before configuring frontend authentication, only the failure message can give users a hint to fix the issue why then can not log in.

I am not sure that the test code should be written in spec/omniauth/strategy_spec.rb or not. However, the most of sub_uri tests are located here. So thus, I added test code of on_failure into strategy_spec.rb 'test mode' context.

Best Regards