wash_out 0.9.0 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +1 -0
- data/Appraisals +9 -1
- data/Gemfile +1 -1
- data/README.md +27 -1
- data/app/views/wash_with_soap/document/error.builder +1 -1
- data/app/views/wash_with_soap/document/response.builder +1 -3
- data/app/views/wash_with_soap/document/wsdl.builder +3 -3
- data/app/views/wash_with_soap/rpc/error.builder +1 -1
- data/app/views/wash_with_soap/rpc/response.builder +1 -3
- data/app/views/wash_with_soap/rpc/wsdl.builder +3 -3
- data/lib/wash_out.rb +2 -2
- data/lib/wash_out/dispatcher.rb +34 -18
- data/lib/wash_out/model.rb +1 -1
- data/lib/wash_out/param.rb +1 -0
- data/lib/wash_out/router.rb +12 -3
- data/lib/wash_out/soap.rb +4 -3
- data/lib/wash_out/soap_config.rb +2 -0
- data/lib/wash_out/version.rb +1 -1
- data/lib/wash_out/wsse.rb +24 -3
- data/spec/lib/wash_out/dispatcher_spec.rb +15 -0
- data/spec/lib/wash_out/router_spec.rb +22 -0
- data/spec/lib/wash_out_spec.rb +50 -0
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9149b2f9a1a04ad8d6ba859ef68f2dbf9db6d585
|
4
|
+
data.tar.gz: 55936871f904cf8d45517312b4479a39a5a5e5d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e2798c550e16322bb72de0dfa08c0e3a18ec3d292b481fc905d36f72d4b51a60bd889a583b723fc54081a484520c260a07e8b28dab1bb9babfa10f115e76e4b
|
7
|
+
data.tar.gz: 08821de12b76c9fc9f4c79ddc381279ebddfa7c42d6a197e9a7b7528f94044b46927edffab4bf9bb7dfcb090e4678effe80ef1e61cfd4cdee6c339dd0ed64090
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -94,7 +94,7 @@ WashOutSample::Application.routes.draw do
|
|
94
94
|
end
|
95
95
|
```
|
96
96
|
|
97
|
-
In such a setup, the generated WSDL may be queried at path `/
|
97
|
+
In such a setup, the generated WSDL may be queried at path `/rumbas/wsdl`. So, with a
|
98
98
|
gem like Savon, a request can be done using this path:
|
99
99
|
|
100
100
|
```ruby
|
@@ -137,6 +137,32 @@ To use defined type inside your inline declaration, pass the class instead of ty
|
|
137
137
|
Note that WashOut extends the `ActiveRecord` so every model you use is already a WashOut::Type and can be used
|
138
138
|
inside your interface declarations.
|
139
139
|
|
140
|
+
## WSSE Authentication
|
141
|
+
|
142
|
+
WashOut provides two mechanism for WSSE Authentication.
|
143
|
+
|
144
|
+
### Static Authentication
|
145
|
+
|
146
|
+
You can configure the service to validate against a username and password with the following configuration:
|
147
|
+
|
148
|
+
```ruby
|
149
|
+
soap_service namespace: "wash_out", wsse_username: "username", wsse_password: "password"
|
150
|
+
```
|
151
|
+
|
152
|
+
With this mechanism, all the actions in the controller will be authenticated against the specified username and password. If you need to authenticate different users, you can use the dynamic mechanism described below.
|
153
|
+
|
154
|
+
### Dynamic Authentication
|
155
|
+
|
156
|
+
Dynamic authentication allows you to process the username and password any way you want, with the most common case being authenticating against a database. The configuration option for this mechanism is called `wsse_auth_callback`:
|
157
|
+
|
158
|
+
```ruby
|
159
|
+
soap_service namespace: "wash_out", wsse_auth_callback: ->(username, password) {
|
160
|
+
return !User.find_by(username: username).authenticate(password).blank?
|
161
|
+
}
|
162
|
+
```
|
163
|
+
|
164
|
+
Keep in mind that the password may already be hashed by the SOAP client, so you would have to check against that condition too as per [spec](http://www.oasis-open.org/committees/download.php/16782/wss-v1.1-spec-os-UsernameTokenProfile.pdf)
|
165
|
+
|
140
166
|
## Configuration
|
141
167
|
|
142
168
|
Use `config.wash_out...` inside your environment configuration to setup WashOut globally.
|
@@ -3,9 +3,7 @@ xml.tag! "soap:Envelope", "xmlns:soap" => 'http://schemas.xmlsoap.org/soap/envel
|
|
3
3
|
"xmlns:xsd" => 'http://www.w3.org/2001/XMLSchema',
|
4
4
|
"xmlns:tns" => @namespace do
|
5
5
|
xml.tag! "soap:Body" do
|
6
|
-
|
7
|
-
|
8
|
-
xml.tag! @action_spec[:response_tag] do
|
6
|
+
xml.tag! "tns:#{@action_spec[:response_tag]}" do
|
9
7
|
wsdl_data xml, result
|
10
8
|
end
|
11
9
|
end
|
@@ -20,10 +20,10 @@ xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
|
|
20
20
|
end
|
21
21
|
|
22
22
|
xml.portType :name => "#{@name}_port" do
|
23
|
-
@map.
|
23
|
+
@map.each do |operation, formats|
|
24
24
|
xml.operation :name => operation do
|
25
25
|
xml.input :message => "tns:#{operation}"
|
26
|
-
xml.output :message => "tns:#{
|
26
|
+
xml.output :message => "tns:#{formats[:response_tag]}"
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -59,7 +59,7 @@ xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
|
|
59
59
|
xml.part wsdl_occurence(p, false, :name => p.name, :type => p.namespaced_type)
|
60
60
|
end
|
61
61
|
end
|
62
|
-
xml.message :name =>
|
62
|
+
xml.message :name => formats[:response_tag] do
|
63
63
|
formats[:out].each do |p|
|
64
64
|
xml.part wsdl_occurence(p, false, :name => p.name, :type => p.namespaced_type)
|
65
65
|
end
|
@@ -3,7 +3,7 @@ xml.tag! "soap:Envelope", "xmlns:soap" => 'http://schemas.xmlsoap.org/soap/envel
|
|
3
3
|
"xmlns:xsi" => 'http://www.w3.org/2001/XMLSchema-instance' do
|
4
4
|
xml.tag! "soap:Body" do
|
5
5
|
xml.tag! "soap:Fault", :encodingStyle => 'http://schemas.xmlsoap.org/soap/encoding/' do
|
6
|
-
xml.faultcode
|
6
|
+
xml.faultcode error_code, 'xsi:type' => 'xsd:QName'
|
7
7
|
xml.faultstring error_message, 'xsi:type' => 'xsd:string'
|
8
8
|
end
|
9
9
|
end
|
@@ -4,9 +4,7 @@ xml.tag! "soap:Envelope", "xmlns:soap" => 'http://schemas.xmlsoap.org/soap/envel
|
|
4
4
|
"xmlns:xsi" => 'http://www.w3.org/2001/XMLSchema-instance',
|
5
5
|
"xmlns:tns" => @namespace do
|
6
6
|
xml.tag! "soap:Body" do
|
7
|
-
|
8
|
-
|
9
|
-
xml.tag! @action_spec[:response_tag] do
|
7
|
+
xml.tag! "tns:#{@action_spec[:response_tag]}" do
|
10
8
|
wsdl_data xml, result
|
11
9
|
end
|
12
10
|
end
|
@@ -20,10 +20,10 @@ xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
|
|
20
20
|
end
|
21
21
|
|
22
22
|
xml.portType :name => "#{@name}_port" do
|
23
|
-
@map.
|
23
|
+
@map.each do |operation, formats|
|
24
24
|
xml.operation :name => operation do
|
25
25
|
xml.input :message => "tns:#{operation}"
|
26
|
-
xml.output :message => "tns:#{
|
26
|
+
xml.output :message => "tns:#{formats[:response_tag]}"
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -59,7 +59,7 @@ xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
|
|
59
59
|
xml.part wsdl_occurence(p, true, :name => p.name, :type => p.namespaced_type)
|
60
60
|
end
|
61
61
|
end
|
62
|
-
xml.message :name =>
|
62
|
+
xml.message :name => formats[:response_tag] do
|
63
63
|
formats[:out].each do |p|
|
64
64
|
xml.part wsdl_occurence(p, true, :name => p.name, :type => p.namespaced_type)
|
65
65
|
end
|
data/lib/wash_out.rb
CHANGED
@@ -15,7 +15,7 @@ module ActionDispatch::Routing
|
|
15
15
|
class Mapper
|
16
16
|
# Adds the routes for a SOAP endpoint at +controller+.
|
17
17
|
def wash_out(controller_name, options={})
|
18
|
-
options.
|
18
|
+
options.each_with_index { |key, value| @scope[key] = value } if @scope
|
19
19
|
controller_class_name = [options[:module], controller_name].compact.join("/")
|
20
20
|
|
21
21
|
match "#{controller_name}/wsdl" => "#{controller_name}#_generate_wsdl", :via => :get, :format => false
|
@@ -44,4 +44,4 @@ ActionController::Base.class_eval do
|
|
44
44
|
include WashOut::SOAP
|
45
45
|
self.soap_config = options
|
46
46
|
end
|
47
|
-
end
|
47
|
+
end
|
data/lib/wash_out/dispatcher.rb
CHANGED
@@ -5,7 +5,14 @@ module WashOut
|
|
5
5
|
module Dispatcher
|
6
6
|
# A SOAPError exception can be raised to return a correct SOAP error
|
7
7
|
# response.
|
8
|
-
class SOAPError < Exception
|
8
|
+
class SOAPError < Exception
|
9
|
+
attr_accessor :code
|
10
|
+
def initialize(message, code=nil)
|
11
|
+
super(message)
|
12
|
+
@code = code
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
9
16
|
class ProgrammerError < Exception; end
|
10
17
|
|
11
18
|
def _authenticate_wsse
|
@@ -25,19 +32,10 @@ module WashOut
|
|
25
32
|
end
|
26
33
|
|
27
34
|
def _map_soap_parameters
|
28
|
-
|
29
|
-
soap_action = request.env['wash_out.soap_action']
|
30
|
-
action_spec = self.class.soap_actions[soap_action]
|
31
|
-
|
32
|
-
xml_data = env['wash_out.soap_data'].values_at(:envelope, :Envelope).compact.first
|
33
|
-
xml_data = xml_data.values_at(:body, :Body).compact.first
|
34
|
-
xml_data = xml_data.values_at(soap_action.underscore.to_sym,
|
35
|
-
soap_action.to_sym).compact.first || {}
|
36
|
-
|
37
35
|
strip_empty_nodes = lambda{|hash|
|
38
36
|
hash.keys.each do |key|
|
39
37
|
if hash[key].is_a? Hash
|
40
|
-
value = hash[key].delete_if{|k, v|
|
38
|
+
value = hash[key].delete_if{|k, v| k.to_s[0] == '@'}
|
41
39
|
|
42
40
|
if value.length > 0
|
43
41
|
hash[key] = strip_empty_nodes.call(value)
|
@@ -49,8 +47,7 @@ module WashOut
|
|
49
47
|
|
50
48
|
hash
|
51
49
|
}
|
52
|
-
|
53
|
-
@_params = _load_params(action_spec[:in], xml_data)
|
50
|
+
@_params = _load_params(action_spec[:in], strip_empty_nodes.call(xml_data))
|
54
51
|
end
|
55
52
|
|
56
53
|
# Creates the final parameter hash based on the request spec and xml_data from the request
|
@@ -138,23 +135,25 @@ module WashOut
|
|
138
135
|
render_soap_error("Cannot find SOAP action mapping for #{request.env['wash_out.soap_action']}")
|
139
136
|
end
|
140
137
|
|
141
|
-
def
|
142
|
-
|
138
|
+
def _catch_soap_errors
|
139
|
+
yield
|
140
|
+
rescue SOAPError => error
|
141
|
+
render_soap_error(error.message, error.code)
|
143
142
|
end
|
144
143
|
|
145
144
|
# Render a SOAP error response.
|
146
145
|
#
|
147
146
|
# Rails do not support sequental rescue_from handling, that is, rescuing an
|
148
147
|
# exception from a rescue_from handler. Hence this function is a public API.
|
149
|
-
def render_soap_error(message)
|
148
|
+
def render_soap_error(message, code=nil)
|
150
149
|
render :template => "wash_with_soap/#{soap_config.wsdl_style}/error", :status => 500,
|
151
150
|
:layout => false,
|
152
|
-
:locals => { :error_message => message },
|
151
|
+
:locals => { :error_message => message, :error_code => (code || 'Server') },
|
153
152
|
:content_type => 'text/xml'
|
154
153
|
end
|
155
154
|
|
156
155
|
def self.included(controller)
|
157
|
-
controller.send :
|
156
|
+
controller.send :around_filter, :_catch_soap_errors
|
158
157
|
controller.send :helper, :wash_out
|
159
158
|
controller.send :before_filter, :_authenticate_wsse, :except => [
|
160
159
|
:_generate_wsdl, :_invalid_action ]
|
@@ -182,5 +181,22 @@ module WashOut
|
|
182
181
|
|
183
182
|
hash
|
184
183
|
end
|
184
|
+
|
185
|
+
private
|
186
|
+
|
187
|
+
def action_spec
|
188
|
+
self.class.soap_actions[soap_action]
|
189
|
+
end
|
190
|
+
|
191
|
+
def soap_action
|
192
|
+
request.env['wash_out.soap_action']
|
193
|
+
end
|
194
|
+
|
195
|
+
def xml_data
|
196
|
+
xml_data = env['wash_out.soap_data'].values_at(:envelope, :Envelope).compact.first
|
197
|
+
xml_data = xml_data.values_at(:body, :Body).compact.first
|
198
|
+
xml_data = xml_data.values_at(soap_action.underscore.to_sym, soap_action.to_sym).compact.first || {}
|
199
|
+
end
|
200
|
+
|
185
201
|
end
|
186
202
|
end
|
data/lib/wash_out/model.rb
CHANGED
data/lib/wash_out/param.rb
CHANGED
data/lib/wash_out/router.rb
CHANGED
@@ -15,10 +15,14 @@ module WashOut
|
|
15
15
|
def parse_soap_action(env)
|
16
16
|
return env['wash_out.soap_action'] if env['wash_out.soap_action']
|
17
17
|
|
18
|
-
soap_action = env['HTTP_SOAPACTION'].to_s.gsub(/^"(.*)"$/, '\1')
|
18
|
+
soap_action = controller.soap_config.soap_action_routing ? env['HTTP_SOAPACTION'].to_s.gsub(/^"(.*)"$/, '\1')
|
19
|
+
: ''
|
19
20
|
|
20
21
|
if soap_action.blank?
|
21
|
-
|
22
|
+
parsed_soap_body = nori(controller.soap_config.snakecase_input).parse(soap_body env)
|
23
|
+
return nil if parsed_soap_body.blank?
|
24
|
+
|
25
|
+
soap_action = parsed_soap_body
|
22
26
|
.values_at(:envelope, :Envelope).compact.first
|
23
27
|
.values_at(:body, :Body).compact.first
|
24
28
|
.keys.first.to_s
|
@@ -41,13 +45,16 @@ module WashOut
|
|
41
45
|
:strip_namespaces => true,
|
42
46
|
:advanced_typecasting => true,
|
43
47
|
:convert_tags_to => (
|
44
|
-
snakecase ? lambda { |tag| tag.snakecase.to_sym }
|
48
|
+
snakecase ? lambda { |tag| tag.snakecase.to_sym }
|
45
49
|
: lambda { |tag| tag.to_sym }
|
46
50
|
)
|
47
51
|
)
|
48
52
|
end
|
49
53
|
|
50
54
|
def soap_body(env)
|
55
|
+
# Don't let nobody intercept us ^_^
|
56
|
+
env['rack.input'].rewind if env['rack.input'].respond_to?(:rewind)
|
57
|
+
|
51
58
|
env['rack.input'].respond_to?(:string) ? env['rack.input'].string
|
52
59
|
: env['rack.input'].read
|
53
60
|
end
|
@@ -70,6 +77,8 @@ module WashOut
|
|
70
77
|
@controller = @controller_name.constantize
|
71
78
|
|
72
79
|
soap_action = parse_soap_action(env)
|
80
|
+
return [200, {}, ['OK']] if soap_action.blank?
|
81
|
+
|
73
82
|
soap_parameters = parse_soap_parameters(env)
|
74
83
|
|
75
84
|
action_spec = controller.soap_actions[soap_action]
|
data/lib/wash_out/soap.rb
CHANGED
@@ -26,20 +26,21 @@ module WashOut
|
|
26
26
|
end
|
27
27
|
|
28
28
|
default_response_tag = soap_config.camelize_wsdl ? 'Response' : '_response'
|
29
|
-
default_response_tag =
|
29
|
+
default_response_tag = action+default_response_tag
|
30
30
|
|
31
|
-
self.soap_actions[action] =
|
31
|
+
self.soap_actions[action] = options.merge(
|
32
32
|
:in => WashOut::Param.parse_def(soap_config, options[:args]),
|
33
33
|
:out => WashOut::Param.parse_def(soap_config, options[:return]),
|
34
34
|
:to => options[:to] || action,
|
35
35
|
:response_tag => options[:response_tag] || default_response_tag
|
36
|
-
|
36
|
+
)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
included do
|
41
41
|
include WashOut::Configurable
|
42
42
|
include WashOut::Dispatcher
|
43
|
+
include WashOut::WsseParams
|
43
44
|
self.soap_actions = {}
|
44
45
|
end
|
45
46
|
end
|
data/lib/wash_out/soap_config.rb
CHANGED
data/lib/wash_out/version.rb
CHANGED
data/lib/wash_out/wsse.rb
CHANGED
@@ -1,4 +1,13 @@
|
|
1
1
|
module WashOut
|
2
|
+
|
3
|
+
module WsseParams
|
4
|
+
def wsse_username
|
5
|
+
if request.env['WSSE_TOKEN']
|
6
|
+
request.env['WSSE_TOKEN'].values_at(:username, :Username).compact.first
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
2
11
|
class Wsse
|
3
12
|
attr_reader :soap_config
|
4
13
|
def self.authenticate(soap_config, token)
|
@@ -18,7 +27,15 @@ module WashOut
|
|
18
27
|
end
|
19
28
|
|
20
29
|
def required?
|
21
|
-
!soap_config.wsse_username.blank?
|
30
|
+
!soap_config.wsse_username.blank? || auth_callback?
|
31
|
+
end
|
32
|
+
|
33
|
+
def auth_callback?
|
34
|
+
return !!soap_config.wsse_auth_callback && soap_config.wsse_auth_callback.respond_to?(:call) && soap_config.wsse_auth_callback.arity == 2
|
35
|
+
end
|
36
|
+
|
37
|
+
def perform_auth_callback(user, password)
|
38
|
+
soap_config.wsse_auth_callback.call(user, password)
|
22
39
|
end
|
23
40
|
|
24
41
|
def expected_user
|
@@ -65,11 +82,15 @@ module WashOut
|
|
65
82
|
user = @username_token.values_at(:username, :Username).compact.first
|
66
83
|
password = @username_token.values_at(:password, :Password).compact.first
|
67
84
|
|
68
|
-
if (expected_user == user &&
|
85
|
+
if (expected_user == user && matches_expected_digest?(password))
|
69
86
|
return true
|
70
87
|
end
|
71
88
|
|
72
|
-
if
|
89
|
+
if auth_callback?
|
90
|
+
return perform_auth_callback(user, password)
|
91
|
+
end
|
92
|
+
|
93
|
+
if (expected_user == user && expected_password == password)
|
73
94
|
return true
|
74
95
|
end
|
75
96
|
|
@@ -52,6 +52,21 @@ describe WashOut::Dispatcher do
|
|
52
52
|
}
|
53
53
|
end
|
54
54
|
|
55
|
+
describe "#_map_soap_parameters" do
|
56
|
+
let(:dispatcher) { Dispatcher.new }
|
57
|
+
let(:soap_config) { WashOut::SoapConfig.new(camelize_wsdl: false) }
|
58
|
+
|
59
|
+
before do
|
60
|
+
allow(dispatcher).to receive(:action_spec).and_return(in: WashOut::Param.parse_def(soap_config, {:empty => :string } ))
|
61
|
+
allow(dispatcher).to receive(:xml_data).and_return(:empty => { :"@xsi:type" => "xsd:string" })
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should handle empty strings that have been parsed wrong by nori" do
|
65
|
+
dispatcher._map_soap_parameters
|
66
|
+
expect(dispatcher.params).to eq('empty' => nil)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
55
70
|
describe "#_load_params" do
|
56
71
|
let(:dispatcher) { Dispatcher.new }
|
57
72
|
let(:soap_config) { WashOut::SoapConfig.new({ camelize_wsdl: false }) }
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'wash_out/router'
|
3
|
+
|
4
|
+
describe WashOut::Router do
|
5
|
+
it 'returns a 200 with empty soap action' do
|
6
|
+
|
7
|
+
mock_controller do
|
8
|
+
# nothing
|
9
|
+
end
|
10
|
+
|
11
|
+
env = {}
|
12
|
+
env['REQUEST_METHOD'] = 'GET'
|
13
|
+
env['rack.input'] = double 'basic-rack-input', {:string => ''}
|
14
|
+
result = WashOut::Router.new('Api').call env
|
15
|
+
|
16
|
+
expect(result[0]).to eq(200)
|
17
|
+
#expect(result[1]['Content-Type']).to eq('text/xml')
|
18
|
+
|
19
|
+
msg = result[2][0]
|
20
|
+
expect(msg).to eq('OK')
|
21
|
+
end
|
22
|
+
end
|
data/spec/lib/wash_out_spec.rb
CHANGED
@@ -507,6 +507,19 @@ describe WashOut do
|
|
507
507
|
lambda { savon(:error, :need_error => true) }.should raise_exception(Savon::SOAPFault)
|
508
508
|
end
|
509
509
|
|
510
|
+
it "misses basic exceptions" do
|
511
|
+
mock_controller do
|
512
|
+
soap_action "error", :args => { :need_error => :boolean }, :return => nil
|
513
|
+
def error
|
514
|
+
raise self.class.const_get(:Exception), "you wanted one" if params[:need_error]
|
515
|
+
render :soap => nil
|
516
|
+
end
|
517
|
+
end
|
518
|
+
|
519
|
+
lambda { savon(:error, :need_error => false) }.should_not raise_exception
|
520
|
+
lambda { savon(:error, :need_error => true) }.should raise_exception(Exception)
|
521
|
+
end
|
522
|
+
|
510
523
|
it "raise for manual throws" do
|
511
524
|
mock_controller do
|
512
525
|
soap_action "error", :args => nil, :return => nil
|
@@ -668,6 +681,10 @@ describe WashOut do
|
|
668
681
|
end
|
669
682
|
|
670
683
|
# correct auth
|
684
|
+
lambda { savon(:check_auth, 42){ wsse_auth "gorilla", "secret" } }.
|
685
|
+
should_not raise_exception
|
686
|
+
|
687
|
+
# correct digest auth
|
671
688
|
lambda { savon(:check_auth, 42){ wsse_auth "gorilla", "secret", :digest } }.
|
672
689
|
should_not raise_exception
|
673
690
|
|
@@ -684,6 +701,39 @@ describe WashOut do
|
|
684
701
|
should raise_exception(Savon::SOAPFault)
|
685
702
|
end
|
686
703
|
|
704
|
+
it "handles auth callback" do
|
705
|
+
mock_controller(
|
706
|
+
wsse_auth_callback: lambda {|user, password|
|
707
|
+
return user == "gorilla" && password == "secret"
|
708
|
+
}
|
709
|
+
) do
|
710
|
+
soap_action "checkAuth", :args => :integer, :return => :boolean, :to => 'check_auth'
|
711
|
+
def check_auth
|
712
|
+
render :soap => (params[:value] == 42)
|
713
|
+
end
|
714
|
+
end
|
715
|
+
|
716
|
+
# correct auth
|
717
|
+
lambda { savon(:check_auth, 42){ wsse_auth "gorilla", "secret" } }.
|
718
|
+
should_not raise_exception
|
719
|
+
|
720
|
+
# correct digest auth
|
721
|
+
lambda { savon(:check_auth, 42){ wsse_auth "gorilla", "secret", :digest } }.
|
722
|
+
should raise_exception(Savon::SOAPFault)
|
723
|
+
|
724
|
+
# wrong user
|
725
|
+
lambda { savon(:check_auth, 42){ wsse_auth "chimpanzee", "secret", :digest } }.
|
726
|
+
should raise_exception(Savon::SOAPFault)
|
727
|
+
|
728
|
+
# wrong pass
|
729
|
+
lambda { savon(:check_auth, 42){ wsse_auth "gorilla", "nicetry", :digest } }.
|
730
|
+
should raise_exception(Savon::SOAPFault)
|
731
|
+
|
732
|
+
# no auth
|
733
|
+
lambda { savon(:check_auth, 42) }.
|
734
|
+
should raise_exception(Savon::SOAPFault)
|
735
|
+
end
|
736
|
+
|
687
737
|
end
|
688
738
|
|
689
739
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wash_out
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boris Staal
|
@@ -9,20 +9,20 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nori
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 2.0.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 2.0.0
|
28
28
|
description: Dead simple Rails 3 SOAP server library
|
@@ -31,9 +31,9 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
-
- .gitignore
|
35
|
-
- .rspec
|
36
|
-
- .travis.yml
|
34
|
+
- ".gitignore"
|
35
|
+
- ".rspec"
|
36
|
+
- ".travis.yml"
|
37
37
|
- Appraisals
|
38
38
|
- CHANGELOG.md
|
39
39
|
- Gemfile
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- spec/lib/wash_out/dispatcher_spec.rb
|
89
89
|
- spec/lib/wash_out/middleware_spec.rb
|
90
90
|
- spec/lib/wash_out/param_spec.rb
|
91
|
+
- spec/lib/wash_out/router_spec.rb
|
91
92
|
- spec/lib/wash_out/type_spec.rb
|
92
93
|
- spec/lib/wash_out_spec.rb
|
93
94
|
- spec/spec_helper.rb
|
@@ -103,17 +104,17 @@ require_paths:
|
|
103
104
|
- lib
|
104
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
105
106
|
requirements:
|
106
|
-
- -
|
107
|
+
- - ">="
|
107
108
|
- !ruby/object:Gem::Version
|
108
109
|
version: '0'
|
109
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
111
|
requirements:
|
111
|
-
- -
|
112
|
+
- - ">="
|
112
113
|
- !ruby/object:Gem::Version
|
113
114
|
version: '0'
|
114
115
|
requirements: []
|
115
116
|
rubyforge_project:
|
116
|
-
rubygems_version: 2.
|
117
|
+
rubygems_version: 2.2.2
|
117
118
|
signing_key:
|
118
119
|
specification_version: 4
|
119
120
|
summary: Dead simple Rails 3 SOAP server library
|