Browse files

Modifying #read_service_url to support passing the desired service UR…

…L as a request parameter. If client website Foo uses ActiveResource and wants to proxy for web service Bar, the service URL Foo generates using ActiveResource (say, won't necessarily be the same as the service URL Bar generates using #url_for (say,  Because these URLs need to be identical, and because ActiveResource can't know for sure what URL ActionController will generate, it needs to be specified in the request.
  • Loading branch information...
1 parent 47a3495 commit f13235a624416bcef0d08ff30747efd86f05caa2 @zbrimhall zbrimhall committed with gunark May 19, 2009
Showing with 11 additions and 6 deletions.
  1. +11 −6 lib/casclient/frameworks/rails/filter.rb
@@ -296,15 +296,20 @@ def returning_from_gateway?(controller)
def read_service_url(controller)
- if config[:service_url]
+ params = controller.params.dup
+ params.delete(:ticket)
+ service_url = if config[:service_url]
log.debug("Using explicitly set service url: #{config[:service_url]}")
- return config[:service_url]
+ config[:service_url]
+ elsif params[:service_url]
+ log.debug("Using provided service url: #{params[:service_url]}")
+ params[:service_url]
+ else
+ log.debug("Guessed service url: #{service_url.inspect}")
+ controller.url_for(params)
- params = controller.params.dup
- params.delete(:ticket)
- service_url = controller.url_for(params)
- log.debug("Guessed service url: #{service_url.inspect}")
return service_url

0 comments on commit f13235a

Please sign in to comment.