Skip to content

Commit 2322e16

Browse files
committed
fix visibility
1 parent 2fd71b1 commit 2322e16

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

lib/rack/openid.rb

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,7 @@ def initialize(app, store = nil)
9393
def call(env)
9494
req = Rack::Request.new(env)
9595

96-
# Stop the base64 encoded nonce and sig from having its +'s
97-
# transformed into spaces by Rack::Request.
98-
#
99-
# See https://github.com/openid/ruby-openid/pull/54
100-
#
101-
Rack::OpenID.sanitize_params!(req.params)
96+
sanitize_params!(req.params)
10297

10398
if req.params["openid.mode"]
10499
complete_authentication(env)
@@ -114,13 +109,14 @@ def call(env)
114109
end
115110
end
116111

117-
def self.sanitize_params!(params)
118-
['openid.sig', 'openid.response_nonce'].each do |param|
119-
(params[param] || '').gsub!(' ', '+')
112+
private
113+
114+
def sanitize_params!(params)
115+
['openid.sig', 'openid.response_nonce'].each do |param|
116+
(params[param] || '').gsub!(' ', '+')
117+
end
120118
end
121-
end
122119

123-
private
124120
def begin_authentication(env, qs)
125121
req = Rack::Request.new(env)
126122
params = self.class.parse_header(qs)

test/test_rack_openid.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
require File.expand_path("../helper", __FILE__)
22

33
describe Rack::OpenID do
4-
describe ".sanitize_request" do
5-
# https://github.com/grosser/rack-openid/pull/4
6-
it "fixes sig and nonce encoding issues" do
4+
describe ".sanitize_params!" do
5+
def call(*args)
6+
Rack::OpenID.new(nil, nil).send(:sanitize_params!, *args)
7+
end
8+
9+
# https://github.com/openid/ruby-openid/pull/54
10+
it "stops the base64 encoded nonce and sig from having its +'s transformed into spaces by Rack::Request" do
711
params = {
812
"openid.sig" => "a string with spaces",
913
"openid.response_nonce" => "again with spaces!",
1014
}
1115

12-
Rack::OpenID.sanitize_params!(params)
16+
call(params)
1317

1418
params["openid.sig"].must_equal "a+string+with+spaces"
1519
params["openid.response_nonce"].must_equal "again+with+spaces!"

0 commit comments

Comments
 (0)