Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/casserver/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,11 @@ def self.init_database!
end

get /^#{uri_path}\/?$/ do
redirect "#{config['uri_path']}/login", 303
service = if params['service']
"?service=#{clean_service_url(params['service'])}"
end

redirect "#{config['uri_path']}/login#{service}", 303
end


Expand Down
15 changes: 14 additions & 1 deletion spec/casserver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@
@target_service = 'http://my.app.test'
end

describe "/" do
it "redirects to /login" do
visit "/"
page.current_url.should =~ %r{/login$}
end

it "redirects to /login preserving the ?service= parameter" do
visit "/?service=http://foo.bar"

page.current_url.should =~ %r{/login\?service=http://foo\.bar$}
end
end

describe "/login" do
before do
load_server("default_config")
Expand Down Expand Up @@ -217,4 +230,4 @@
end
end
end
end
end