Permalink
Browse files

Added a flag whether to escape the service url or not

  • Loading branch information...
David Blankenship
David Blankenship committed May 25, 2011
1 parent 2917ffe commit 7442bab0bccdcd3c692e5700772e5a076a37bb19
Showing with 11 additions and 3 deletions.
  1. +11 −3 lib/casclient/client.rb
View
@@ -4,7 +4,8 @@ class Client
attr_reader :cas_base_url
attr_reader :log, :username_session_key, :extra_attributes_session_key
attr_writer :login_url, :validate_url, :proxy_url, :logout_url, :service_url,
- :ticket_param_key, :extra_login_query_params, :service_param_key
+ :ticket_param_key, :extra_login_query_params, :service_param_key,
+ :escape_service_url
attr_accessor :proxy_callback_url, :proxy_retrieval_url
def initialize(conf = nil)
@@ -34,6 +35,8 @@ def configure(conf)
@extra_login_query_params = conf[:extra_login_query_params] || {}
@service_param_key = conf[:service_param_key] || "service"
+ @escape_service_url = conf[:escape_service_url] || true
+
@log = CASClient::LoggerWrapper.new
@log.set_real_logger(conf[:logger]) if conf[:logger]
end
@@ -220,8 +223,13 @@ def add_service_to_login_url(service_url)
uri.query += @extra_login_query_params.map { |key, value| "#{key}=#{value}" }.join('&')
uri.query += "&"
end
-
- uri.query += "#{@service_param_key}=#{CGI.escape(service_url)}"
+
+ if @escape_service_url
+ uri.query += "#{@service_param_key}=#{service_url}"
+ else
+ uri.query += "#{@service_param_key}=#{CGI.escape(service_url)}"
+ end
+
uri.to_s
end

0 comments on commit 7442bab

Please sign in to comment.