Module: Warden::Mixins::Urls

Included in:
Devise::Strategies::WindAuthenticatable
Defined in:
lib/devise_wind/mixins/urls.rb

Instance Method Summary collapse

Instance Method Details

#realm_urlObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/devise_wind/mixins/urls.rb', line 19

def realm_url
  url = request.scheme + "://"
  url << request.host

  scheme, port = request.scheme, request.port
  if scheme == "https" && port != 443 ||
      scheme == "http" && port != 80
    url << ":#{port}"
  end

  url
end

#request_urlObject



32
33
34
35
36
37
38
# File 'lib/devise_wind/mixins/urls.rb', line 32

def request_url
  url = realm_url
  url << request.script_name
  url << request.path_info
  url << "?#{request.query_string}" if request.query_string.to_s.length > 0
  url
end

#sanitize_query_stringObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/devise_wind/mixins/urls.rb', line 3

def sanitize_query_string
  query_hash = env["rack.request.query_hash"]
  query_hash.delete("_method")
  query_hash.delete_if do |key, value|
    key =~ /^openid\./
  end

  env["QUERY_STRING"] = env["rack.request.query_string"] =
    Rack::Utils.build_query(env["rack.request.query_hash"])

  qs = env["QUERY_STRING"]
  request_uri = (env["PATH_INFO"] || "").dup
  request_uri << "?" + qs unless qs == ""
  env["REQUEST_URI"] = request_uri
end