File tree Expand file tree Collapse file tree 2 files changed +15
-15
lines changed Expand file tree Collapse file tree 2 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -93,12 +93,7 @@ def initialize(app, store = nil)
93
93
def call ( env )
94
94
req = Rack ::Request . new ( env )
95
95
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 )
102
97
103
98
if req . params [ "openid.mode" ]
104
99
complete_authentication ( env )
@@ -114,13 +109,14 @@ def call(env)
114
109
end
115
110
end
116
111
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
120
118
end
121
- end
122
119
123
- private
124
120
def begin_authentication ( env , qs )
125
121
req = Rack ::Request . new ( env )
126
122
params = self . class . parse_header ( qs )
Original file line number Diff line number Diff line change 1
1
require File . expand_path ( "../helper" , __FILE__ )
2
2
3
3
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
7
11
params = {
8
12
"openid.sig" => "a string with spaces" ,
9
13
"openid.response_nonce" => "again with spaces!" ,
10
14
}
11
15
12
- Rack :: OpenID . sanitize_params! ( params )
16
+ call ( params )
13
17
14
18
params [ "openid.sig" ] . must_equal "a+string+with+spaces"
15
19
params [ "openid.response_nonce" ] . must_equal "again+with+spaces!"
You can’t perform that action at this time.
0 commit comments