hassox-warden 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -1 +1,2 @@
1
- Please see the "Warden Wiki":http://wiki.github.com/hassox/warden for overview documentation.
1
+ Please see the "Warden Wiki":http://wiki.github.com/hassox/warden for overview documentation.
2
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
data/lib/warden/proxy.rb CHANGED
@@ -14,7 +14,7 @@ module Warden
14
14
  alias_method :_session, :session
15
15
 
16
16
  # :api: private
17
- def_delegators :winning_strategy, :headers, :message, :_status, :custom_response
17
+ def_delegators :winning_strategy, :headers, :_status, :custom_response
18
18
 
19
19
  def initialize(env, config = {}) # :nodoc:
20
20
  @env = env
@@ -155,6 +155,12 @@ module Warden
155
155
  winning_strategy.nil? ? nil : winning_strategy.result
156
156
  end
157
157
 
158
+ # Proxy through to the authentication strategy to find out the message that was generated.
159
+ # :api: public
160
+ def message
161
+ winning_strategy.nil? ? "" : winning_strategy.message
162
+ end
163
+
158
164
  # Provides a way to return a 401 without warden defering to the failure app
159
165
  # The result is a direct passthrough of your own response
160
166
  # :api: public
@@ -13,7 +13,7 @@ module Warden::Spec
13
13
  def setup_rack(app = nil, opts = {}, &block)
14
14
  app ||= block if block_given?
15
15
  # opts[:default_strategies] ||= [:password]
16
- # opts[:failure_app] ||= failure_app
16
+ opts[:failure_app] ||= Warden::Spec::Helpers::FAILURE_APP
17
17
  Rack::Builder.new do
18
18
  use Warden::Spec::Helpers::Session
19
19
  use Warden::Manager, opts do |manager|
@@ -174,7 +174,7 @@ describe Warden::Manager do
174
174
  result[0].should == 200
175
175
  result[2].should == ["Foo Is A Winna"]
176
176
  end
177
- end
177
+ end
178
178
  end # integrated strategies
179
179
 
180
180
  end
@@ -251,7 +251,7 @@ describe Warden::Proxy do
251
251
  @env['warden'].user.should be_nil
252
252
 
253
253
  end
254
- require 'ruby-debug'
254
+
255
255
  it "should clear the session data when logging out" do
256
256
  @env['rack.session'].should_not be_nil
257
257
  app = lambda do |e|
@@ -265,6 +265,28 @@ describe Warden::Proxy do
265
265
  end
266
266
  end
267
267
 
268
+ describe "messages" do
269
+
270
+ it "should allow access to the failure message" do
271
+ failure = lambda do |e|
272
+ [401, {"Content-Type" => "text/plain"}, [e['warden'].message]]
273
+ end
274
+ app = lambda do |e|
275
+ e['warden'].authenticate! :failz
276
+ end
277
+ result = setup_rack(app, :failure_app => failure).call(env_with_params)
278
+ result.last.should == ["The Fails Strategy Has Failed You"]
279
+ end
280
+
281
+ it "should not die when accessing a message from a source where no authentication has occured" do
282
+ app = lambda do |e|
283
+ [200, {"Content-Type" => "text/plain"}, [e['warden'].message]]
284
+ end
285
+ result = setup_rack(app).call(env_with_params)
286
+ result[2].should == [""]
287
+ end
288
+ end
289
+
268
290
  describe "when all strategies are not valid?" do
269
291
  it "should return false for authenticated when there are no valid? strategies" do
270
292
  @env['rack.session'] = {}
data/warden.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{warden}
5
- s.version = "0.3.0"
5
+ s.version = "0.3.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Daniel Neighman"]
9
- s.date = %q{2009-07-12}
9
+ s.date = %q{2009-08-10}
10
10
  s.email = %q{has.sox@gmail.com}
11
11
  s.extra_rdoc_files = [
12
12
  "LICENSE",
@@ -50,7 +50,7 @@ Gem::Specification.new do |s|
50
50
  s.rdoc_options = ["--charset=UTF-8"]
51
51
  s.require_paths = ["lib"]
52
52
  s.rubyforge_project = %q{warden}
53
- s.rubygems_version = %q{1.3.3}
53
+ s.rubygems_version = %q{1.3.4}
54
54
  s.summary = %q{Rack middleware that provides authentication for rack applications}
55
55
  s.test_files = [
56
56
  "spec/helpers/request_helper.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hassox-warden
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Neighman
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-12 00:00:00 -07:00
12
+ date: 2009-08-10 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -66,6 +66,7 @@ files:
66
66
  - warden.gemspec
67
67
  has_rdoc: false
68
68
  homepage: http://github.com/hassox/warden
69
+ licenses:
69
70
  post_install_message:
70
71
  rdoc_options:
71
72
  - --charset=UTF-8
@@ -86,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
87
  requirements: []
87
88
 
88
89
  rubyforge_project: warden
89
- rubygems_version: 1.2.0
90
+ rubygems_version: 1.3.5
90
91
  signing_key:
91
92
  specification_version: 3
92
93
  summary: Rack middleware that provides authentication for rack applications