sinatra_warden 0.3.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/Gemfile +3 -1
- data/Rakefile +17 -14
- data/lib/sinatra_warden/sinatra.rb +18 -18
- data/lib/sinatra_warden/version.rb +1 -1
- data/sinatra_warden.gemspec +5 -6
- data/spec/sinatra_warden_spec.rb +31 -34
- data/spec/spec_helper.rb +12 -6
- metadata +171 -224
- data/Gemfile.lock +0 -64
- data/VERSION +0 -1
- data/spec/fixtures/basic_strategy.rb +0 -15
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8c9460ff8ec48358f0f57d9fa6e4b7de293a5145
|
4
|
+
data.tar.gz: 4878d66986725803c2e43a29c8d4485c82cb009b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: af7b941121988f606fa8e6d3d64b0f2e4a4f88e16723a8106e2974d5787d27f02f9b6addda21cb9247033029af1eb9588ead14302ee81fa0161d87e2da2cb9d7
|
7
|
+
data.tar.gz: d1b48f8beaead40b0d1f2287f5e3d296e635447d8cb191850476ad348581e62243d4ef336efb228823cca2b35c588bd73cc4c4b8b8bed0c5363fe949028b0bbe
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,21 +1,24 @@
|
|
1
|
-
require
|
2
|
-
Bundler::GemHelper.install_tasks
|
3
|
-
Bundler.setup :development
|
1
|
+
require "bundler/gem_tasks"
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
9
|
-
end
|
3
|
+
begin
|
4
|
+
# require 'rspec/core/rake_task'
|
5
|
+
require 'spec/rake/spectask'
|
10
6
|
|
11
|
-
Spec::Rake::SpecTask.new(
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
7
|
+
Spec::Rake::SpecTask.new('coverage') do |spec|
|
8
|
+
spec.libs << 'lib' << 'spec'
|
9
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
10
|
+
ENV['COVERAGE'] = "true"
|
11
|
+
end
|
16
12
|
|
17
|
-
|
13
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
14
|
+
spec.libs << 'lib' << 'spec'
|
15
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
16
|
+
end
|
18
17
|
|
18
|
+
task default: :spec
|
19
|
+
rescue LoadError
|
20
|
+
# no rspec available
|
21
|
+
end
|
19
22
|
begin
|
20
23
|
require 'yard'
|
21
24
|
YARD::Rake::YardocTask.new
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'sinatra/base'
|
2
|
-
|
3
2
|
module Sinatra
|
4
3
|
module Warden
|
5
4
|
module Helpers
|
@@ -18,7 +17,7 @@ module Sinatra
|
|
18
17
|
|
19
18
|
# Check the current session is authenticated to a given scope
|
20
19
|
def authenticated?(scope=nil)
|
21
|
-
scope ? warden.authenticated?(scope) : warden.authenticated?
|
20
|
+
scope ? warden.authenticated?(:scope => scope) : warden.authenticated?
|
22
21
|
end
|
23
22
|
alias_method :logged_in?, :authenticated?
|
24
23
|
|
@@ -59,8 +58,8 @@ module Sinatra
|
|
59
58
|
# @param [String] path to redirect to if user is unauthenticated
|
60
59
|
def authorize!(failure_path=nil)
|
61
60
|
unless authenticated?
|
62
|
-
session[:return_to] = request.path if
|
63
|
-
redirect(failure_path ? failure_path :
|
61
|
+
session[:return_to] = request.path if settings.auth_use_referrer
|
62
|
+
redirect(failure_path ? failure_path : settings.auth_failure_path)
|
64
63
|
end
|
65
64
|
end
|
66
65
|
|
@@ -70,7 +69,9 @@ module Sinatra
|
|
70
69
|
app.helpers Warden::Helpers
|
71
70
|
|
72
71
|
# Enable Sessions
|
73
|
-
|
72
|
+
unless defined?(Rack::Session::Cookie)
|
73
|
+
app.set :sessions, true
|
74
|
+
end
|
74
75
|
|
75
76
|
app.set :auth_failure_path, '/'
|
76
77
|
app.set :auth_success_path, '/'
|
@@ -90,42 +91,41 @@ module Sinatra
|
|
90
91
|
app.post '/unauthenticated/?' do
|
91
92
|
status 401
|
92
93
|
warden.custom_failure! if warden.config.failure_app == self.class
|
93
|
-
env['x-rack.flash'][:error] =
|
94
|
-
self.send(
|
94
|
+
env['x-rack.flash'][:error] = settings.auth_error_message if defined?(Rack::Flash)
|
95
|
+
self.send(settings.auth_template_renderer, settings.auth_login_template)
|
95
96
|
end
|
96
97
|
|
97
98
|
app.get '/login/?' do
|
98
|
-
if
|
99
|
+
if settings.auth_use_oauth && !@auth_oauth_request_token.nil?
|
99
100
|
session[:request_token] = @auth_oauth_request_token.token
|
100
101
|
session[:request_token_secret] = @auth_oauth_request_token.secret
|
101
102
|
redirect @auth_oauth_request_token.authorize_url
|
102
103
|
else
|
103
|
-
self.send(
|
104
|
+
self.send(settings.auth_template_renderer, settings.auth_login_template)
|
104
105
|
end
|
105
106
|
end
|
106
107
|
|
107
108
|
app.get '/oauth_callback/?' do
|
108
|
-
if
|
109
|
+
if settings.auth_use_oauth
|
109
110
|
authenticate
|
110
|
-
env['x-rack.flash'][:success] =
|
111
|
-
redirect
|
111
|
+
env['x-rack.flash'][:success] = settings.auth_success_message if defined?(Rack::Flash)
|
112
|
+
redirect settings.auth_success_path
|
112
113
|
else
|
113
|
-
redirect
|
114
|
+
redirect settings.auth_failure_path
|
114
115
|
end
|
115
116
|
end
|
116
117
|
|
117
118
|
app.post '/login/?' do
|
118
119
|
authenticate
|
119
|
-
env['x-rack.flash'][:success] =
|
120
|
-
redirect
|
121
|
-
options.auth_success_path
|
120
|
+
env['x-rack.flash'][:success] = settings.auth_success_message if defined?(Rack::Flash)
|
121
|
+
redirect settings.auth_use_referrer && session[:return_to] ? session.delete(:return_to) : settings.auth_success_path
|
122
122
|
end
|
123
123
|
|
124
124
|
app.get '/logout/?' do
|
125
125
|
authorize!
|
126
126
|
logout
|
127
|
-
env['x-rack.flash'][:success] =
|
128
|
-
redirect
|
127
|
+
env['x-rack.flash'][:success] = settings.auth_success_message if defined?(Rack::Flash)
|
128
|
+
redirect settings.auth_success_path
|
129
129
|
end
|
130
130
|
end
|
131
131
|
end # Warden
|
data/sinatra_warden.gemspec
CHANGED
@@ -18,14 +18,13 @@ Gem::Specification.new do |s|
|
|
18
18
|
|
19
19
|
s.rdoc_options = ["--charset=UTF-8"]
|
20
20
|
|
21
|
-
s.add_dependency 'sinatra', '
|
22
|
-
s.add_dependency 'warden', '~> 1.
|
21
|
+
s.add_dependency 'sinatra', '~> 1.4.6'
|
22
|
+
s.add_dependency 'warden', '~> 1.2.3'
|
23
23
|
|
24
24
|
s.add_development_dependency 'rspec', '~> 1.2.9'
|
25
25
|
s.add_development_dependency 'yard', '>= 0.5.4'
|
26
|
-
s.add_development_dependency 'rack-test', '~> 0.
|
27
|
-
s.add_development_dependency '
|
28
|
-
s.add_development_dependency 'rake'
|
26
|
+
s.add_development_dependency 'rack-test', '~> 0.6.2'
|
27
|
+
s.add_development_dependency 'simplecov'
|
29
28
|
|
30
29
|
s.add_development_dependency 'do_sqlite3', '~> 0.10.0'
|
31
30
|
s.add_development_dependency 'dm-core', '~> 1.0'
|
@@ -33,7 +32,7 @@ Gem::Specification.new do |s|
|
|
33
32
|
s.add_development_dependency 'dm-migrations'
|
34
33
|
s.add_development_dependency 'bcrypt-ruby'
|
35
34
|
s.add_development_dependency 'haml'
|
36
|
-
s.add_development_dependency 'rack-
|
35
|
+
s.add_development_dependency 'rack-flash3', '~> 1.0.1'
|
37
36
|
|
38
37
|
s.files = `git ls-files`.split("\n")
|
39
38
|
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
data/spec/sinatra_warden_spec.rb
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
2
|
describe "Sinatra::Warden" do
|
3
|
+
include Warden::Test::Helpers
|
4
4
|
|
5
5
|
before(:each) do
|
6
6
|
@user = User.create(:email => 'justin.smestad@gmail.com', :password => 'thedude')
|
7
7
|
end
|
8
8
|
|
9
|
+
after{ Warden.test_reset! }
|
10
|
+
|
11
|
+
def registered_user
|
12
|
+
User.first(:email => 'justin.smestad@gmail.com')
|
13
|
+
end
|
14
|
+
|
9
15
|
it "should be a valid user" do
|
10
16
|
@user.new?.should be_false
|
11
17
|
end
|
@@ -27,14 +33,14 @@ describe "Sinatra::Warden" do
|
|
27
33
|
get '/logout'
|
28
34
|
last_request.env['warden'].authenticated?.should == false
|
29
35
|
end
|
30
|
-
|
36
|
+
|
31
37
|
context "auth_use_referrer is disabled" do
|
32
38
|
it "should not store :return_to" do
|
33
39
|
get '/dashboard'
|
34
40
|
follow_redirect!
|
35
41
|
last_request.session[:return_to].should be_nil
|
36
42
|
end
|
37
|
-
|
43
|
+
|
38
44
|
it "should redirect to a default success URL" do
|
39
45
|
get '/dashboard'
|
40
46
|
follow_redirect!
|
@@ -43,24 +49,22 @@ describe "Sinatra::Warden" do
|
|
43
49
|
last_request.path.should == '/welcome'
|
44
50
|
end
|
45
51
|
end
|
46
|
-
|
52
|
+
|
47
53
|
context "when auth_use_referrer is set to true" do
|
48
54
|
def app; app_with_referrer; end
|
49
|
-
|
55
|
+
|
50
56
|
it "should store referrer in user's session" do
|
51
57
|
get '/dashboard'
|
52
|
-
follow_redirect!
|
53
58
|
last_request.session[:return_to].should == "/dashboard"
|
54
59
|
end
|
55
|
-
|
60
|
+
|
56
61
|
it "should redirect to stored return_to URL" do
|
57
62
|
get '/dashboard'
|
58
|
-
|
59
|
-
|
60
|
-
follow_redirect!
|
63
|
+
last_request.session[:return_to].should == '/dashboard'
|
64
|
+
login_as registered_user
|
61
65
|
last_request.path.should == '/dashboard'
|
62
66
|
end
|
63
|
-
|
67
|
+
|
64
68
|
it "should remove :return_to from session" do
|
65
69
|
get '/dashboard'
|
66
70
|
follow_redirect!
|
@@ -68,22 +72,22 @@ describe "Sinatra::Warden" do
|
|
68
72
|
follow_redirect!
|
69
73
|
last_request.session[:return_to].should be_nil
|
70
74
|
end
|
71
|
-
|
75
|
+
|
72
76
|
it "should default to :auth_success_path if there wasn't a return_to" do
|
73
77
|
post '/login', 'email' => 'justin.smestad@gmail.com', 'password' => 'thedude'
|
74
78
|
follow_redirect!
|
75
79
|
last_request.path.should == '/welcome'
|
76
80
|
end
|
77
81
|
end
|
78
|
-
|
82
|
+
|
79
83
|
context "TestingLoginAsRackApp" do
|
80
84
|
def app; @app ||= TestingLoginAsRackApp; end
|
81
|
-
|
85
|
+
|
82
86
|
# what happens here is you'll eventually get
|
83
87
|
# "stack too deep" error if the following test fails
|
84
88
|
it "should not get in a loop" do
|
85
89
|
post '/login', :email => 'bad', :password => 'password'
|
86
|
-
last_request.
|
90
|
+
last_request.env['warden.options'][:action].should == 'unauthenticated'
|
87
91
|
end
|
88
92
|
end
|
89
93
|
end
|
@@ -104,8 +108,7 @@ describe "Sinatra::Warden" do
|
|
104
108
|
end
|
105
109
|
|
106
110
|
it "should allow access if user is logged in" do
|
107
|
-
|
108
|
-
last_request.env['warden'].authenticated?.should be_true
|
111
|
+
login_as registered_user
|
109
112
|
get '/dashboard'
|
110
113
|
last_response.body.should == "My Dashboard"
|
111
114
|
end
|
@@ -113,24 +116,25 @@ describe "Sinatra::Warden" do
|
|
113
116
|
|
114
117
|
context "the user helper" do
|
115
118
|
|
116
|
-
before(:each) do
|
117
|
-
post '/login', 'email' => 'justin.smestad@gmail.com', 'password' => 'thedude'
|
118
|
-
last_request.env['warden'].authenticated?.should be_true
|
119
|
-
end
|
120
|
-
|
121
119
|
it "should be aliased to current_user" do
|
120
|
+
login_as registered_user
|
122
121
|
get '/admin'
|
123
122
|
last_response.body.should == "Welcome #{@user.email}"
|
124
123
|
end
|
125
124
|
|
126
125
|
it "should allow assignment of the user (user=)" do
|
127
|
-
|
126
|
+
login_as registered_user
|
127
|
+
get '/dashboard'
|
128
128
|
last_request.env['warden'].user.should == @user
|
129
|
-
|
129
|
+
|
130
|
+
john = User.create(:email => 'john.doe@hotmail.com', :password => 'secret')
|
131
|
+
login_as john
|
132
|
+
get '/dashboard'
|
130
133
|
last_request.env['warden'].user.should == john
|
131
134
|
end
|
132
135
|
|
133
136
|
it "should return the current logged in user" do
|
137
|
+
login_as registered_user
|
134
138
|
get '/account'
|
135
139
|
last_response.body.should == "#{@user.email}'s account page"
|
136
140
|
end
|
@@ -139,17 +143,15 @@ describe "Sinatra::Warden" do
|
|
139
143
|
|
140
144
|
context "the logged_in/authenticated? helper" do
|
141
145
|
|
142
|
-
before(:each) do
|
143
|
-
post '/login', 'email' => 'justin.smestad@gmail.com', 'password' => 'thedude'
|
144
|
-
last_request.env['warden'].authenticated?.should be_true
|
145
|
-
end
|
146
|
-
|
147
146
|
it "should be aliased as logged_in?" do
|
147
|
+
login_as registered_user
|
148
148
|
get '/check_login'
|
149
149
|
last_response.body.should == "Hello Moto"
|
150
150
|
end
|
151
151
|
|
152
152
|
it "should return false when a user is not authenticated" do
|
153
|
+
login_as registered_user
|
154
|
+
|
153
155
|
get '/logout'
|
154
156
|
last_request.env['warden'].authenticated?.should be_false
|
155
157
|
|
@@ -161,11 +163,6 @@ describe "Sinatra::Warden" do
|
|
161
163
|
|
162
164
|
context "the warden helper" do
|
163
165
|
|
164
|
-
before(:each) do
|
165
|
-
post '/login', 'email' => 'justin.smestad@gmail.com', 'password' => 'thedude'
|
166
|
-
last_request.env['warden'].authenticated?.should be_true
|
167
|
-
end
|
168
|
-
|
169
166
|
it "returns the environment variables from warden" do
|
170
167
|
get '/warden'
|
171
168
|
last_response.body.should_not be_nil
|
data/spec/spec_helper.rb
CHANGED
@@ -8,6 +8,12 @@ require 'spec'
|
|
8
8
|
require 'spec/autorun'
|
9
9
|
require 'dm-core'
|
10
10
|
require 'dm-migrations'
|
11
|
+
|
12
|
+
if ENV['COVERAGE']
|
13
|
+
require 'simplecov'
|
14
|
+
SimpleCov.start
|
15
|
+
end
|
16
|
+
|
11
17
|
DataMapper.setup(:default, 'sqlite3::memory:')
|
12
18
|
|
13
19
|
%w(fixtures support).each do |path|
|
@@ -27,21 +33,21 @@ Spec::Runner.configure do |config|
|
|
27
33
|
def app
|
28
34
|
@app ||= define_app TestingLogin
|
29
35
|
end
|
30
|
-
|
36
|
+
|
31
37
|
# app with auth_use_referrer enabled
|
32
38
|
def app_with_referrer
|
33
39
|
@app ||= define_app TestingLoginWithReferrer
|
34
40
|
end
|
35
|
-
|
36
|
-
|
37
|
-
|
41
|
+
|
42
|
+
private
|
43
|
+
|
38
44
|
# :which should be a sinatra app
|
39
45
|
def define_app(which)
|
40
|
-
Rack::Builder.
|
46
|
+
Rack::Builder.new do
|
41
47
|
use Rack::Session::Cookie
|
42
48
|
use Warden::Manager do |manager|
|
43
49
|
manager.default_strategies :password
|
44
|
-
manager.failure_app =
|
50
|
+
manager.failure_app = which
|
45
51
|
manager.serialize_into_session { |user| user.id }
|
46
52
|
manager.serialize_from_session { |id| User.get(id) }
|
47
53
|
end
|
metadata
CHANGED
@@ -1,297 +1,244 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra_warden
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease: false
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
- 2
|
10
|
-
version: 0.3.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Justin Smestad
|
14
8
|
- Daniel Neighman
|
15
9
|
autorequire:
|
16
10
|
bindir: bin
|
17
11
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
dependencies:
|
22
|
-
- !ruby/object:Gem::Dependency
|
23
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
|
-
requirements:
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 23
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 0
|
32
|
-
- 0
|
33
|
-
version: 1.0.0
|
34
|
-
requirement: *id001
|
35
|
-
type: :runtime
|
12
|
+
date: 2015-09-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
36
15
|
name: sinatra
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 15
|
45
|
-
segments:
|
46
|
-
- 1
|
47
|
-
- 0
|
48
|
-
version: "1.0"
|
49
|
-
requirement: *id002
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 1.4.6
|
50
21
|
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 1.4.6
|
28
|
+
- !ruby/object:Gem::Dependency
|
51
29
|
name: warden
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 1.2.3
|
35
|
+
type: :runtime
|
52
36
|
prerelease: false
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 1.2.3
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rspec
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
64
48
|
version: 1.2.9
|
65
|
-
requirement: *id003
|
66
49
|
type: :development
|
67
|
-
name: rspec
|
68
50
|
prerelease: false
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.2.9
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: yard
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
73
60
|
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
hash: 3
|
76
|
-
segments:
|
77
|
-
- 0
|
78
|
-
- 5
|
79
|
-
- 4
|
61
|
+
- !ruby/object:Gem::Version
|
80
62
|
version: 0.5.4
|
81
|
-
requirement: *id004
|
82
|
-
type: :development
|
83
|
-
name: yard
|
84
|
-
prerelease: false
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
version_requirements: &id005 !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
|
-
requirements:
|
89
|
-
- - ~>
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
hash: 11
|
92
|
-
segments:
|
93
|
-
- 0
|
94
|
-
- 5
|
95
|
-
- 0
|
96
|
-
version: 0.5.0
|
97
|
-
requirement: *id005
|
98
63
|
type: :development
|
99
|
-
name: rack-test
|
100
64
|
prerelease: false
|
101
|
-
|
102
|
-
|
103
|
-
none: false
|
104
|
-
requirements:
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
105
67
|
- - ">="
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.5.4
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rack-test
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.6.2
|
112
77
|
type: :development
|
113
|
-
name: rcov
|
114
78
|
prerelease: false
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 0.6.2
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: simplecov
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
119
88
|
- - ">="
|
120
|
-
- !ruby/object:Gem::Version
|
121
|
-
|
122
|
-
segments:
|
123
|
-
- 0
|
124
|
-
version: "0"
|
125
|
-
requirement: *id007
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
126
91
|
type: :development
|
127
|
-
name: rake
|
128
92
|
prerelease: false
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: do_sqlite3
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
140
104
|
version: 0.10.0
|
141
|
-
requirement: *id008
|
142
105
|
type: :development
|
143
|
-
name: do_sqlite3
|
144
106
|
prerelease: false
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
hash: 15
|
152
|
-
segments:
|
153
|
-
- 1
|
154
|
-
- 0
|
155
|
-
version: "1.0"
|
156
|
-
requirement: *id009
|
157
|
-
type: :development
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 0.10.0
|
112
|
+
- !ruby/object:Gem::Dependency
|
158
113
|
name: dm-core
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '1.0'
|
119
|
+
type: :development
|
159
120
|
prerelease: false
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '1.0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: dm-sqlite-adapter
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
164
130
|
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
|
167
|
-
segments:
|
168
|
-
- 0
|
169
|
-
version: "0"
|
170
|
-
requirement: *id010
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
171
133
|
type: :development
|
172
|
-
name: dm-sqlite-adapter
|
173
134
|
prerelease: false
|
174
|
-
|
175
|
-
|
176
|
-
none: false
|
177
|
-
requirements:
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
178
137
|
- - ">="
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
|
181
|
-
|
182
|
-
- 0
|
183
|
-
version: "0"
|
184
|
-
requirement: *id011
|
185
|
-
type: :development
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
- !ruby/object:Gem::Dependency
|
186
141
|
name: dm-migrations
|
187
|
-
|
188
|
-
|
189
|
-
version_requirements: &id012 !ruby/object:Gem::Requirement
|
190
|
-
none: false
|
191
|
-
requirements:
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
192
144
|
- - ">="
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
|
195
|
-
segments:
|
196
|
-
- 0
|
197
|
-
version: "0"
|
198
|
-
requirement: *id012
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
199
147
|
type: :development
|
200
|
-
name: bcrypt-ruby
|
201
148
|
prerelease: false
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: bcrypt-ruby
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
206
158
|
- - ">="
|
207
|
-
- !ruby/object:Gem::Version
|
208
|
-
|
209
|
-
segments:
|
210
|
-
- 0
|
211
|
-
version: "0"
|
212
|
-
requirement: *id013
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
213
161
|
type: :development
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
- !ruby/object:Gem::Dependency
|
214
169
|
name: haml
|
170
|
+
requirement: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
type: :development
|
215
176
|
prerelease: false
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
version: 0.1
|
228
|
-
requirement: *id014
|
177
|
+
version_requirements: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
- !ruby/object:Gem::Dependency
|
183
|
+
name: rack-flash3
|
184
|
+
requirement: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - "~>"
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: 1.0.1
|
229
189
|
type: :development
|
230
|
-
name: rack-flash
|
231
190
|
prerelease: false
|
232
|
-
|
191
|
+
version_requirements: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - "~>"
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: 1.0.1
|
196
|
+
description: basic helpers and authentication methods for using warden with sinatra
|
197
|
+
also providing some hooks into Rack::Flash
|
233
198
|
email: justin.smestad@gmail.com
|
234
199
|
executables: []
|
235
|
-
|
236
200
|
extensions: []
|
237
|
-
|
238
201
|
extra_rdoc_files: []
|
239
|
-
|
240
|
-
|
241
|
-
- .
|
242
|
-
- .gitignore
|
202
|
+
files:
|
203
|
+
- ".document"
|
204
|
+
- ".gitignore"
|
243
205
|
- Gemfile
|
244
|
-
- Gemfile.lock
|
245
206
|
- LICENSE
|
246
207
|
- README.rdoc
|
247
208
|
- Rakefile
|
248
|
-
- VERSION
|
249
209
|
- lib/sinatra_warden.rb
|
250
210
|
- lib/sinatra_warden/sinatra.rb
|
251
211
|
- lib/sinatra_warden/version.rb
|
252
212
|
- sinatra_warden.gemspec
|
253
|
-
- spec/fixtures/basic_strategy.rb
|
254
213
|
- spec/fixtures/testing_login.rb
|
255
214
|
- spec/fixtures/user.rb
|
256
215
|
- spec/fixtures/views/login.haml
|
257
216
|
- spec/sinatra_warden_spec.rb
|
258
217
|
- spec/spec.opts
|
259
218
|
- spec/spec_helper.rb
|
260
|
-
has_rdoc: true
|
261
219
|
homepage:
|
262
220
|
licenses: []
|
263
|
-
|
221
|
+
metadata: {}
|
264
222
|
post_install_message:
|
265
|
-
rdoc_options:
|
266
|
-
- --charset=UTF-8
|
267
|
-
require_paths:
|
223
|
+
rdoc_options:
|
224
|
+
- "--charset=UTF-8"
|
225
|
+
require_paths:
|
268
226
|
- lib
|
269
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
270
|
-
|
271
|
-
requirements:
|
227
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
228
|
+
requirements:
|
272
229
|
- - ">="
|
273
|
-
- !ruby/object:Gem::Version
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
version: "0"
|
278
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
279
|
-
none: false
|
280
|
-
requirements:
|
230
|
+
- !ruby/object:Gem::Version
|
231
|
+
version: '0'
|
232
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
281
234
|
- - ">="
|
282
|
-
- !ruby/object:Gem::Version
|
283
|
-
hash: 23
|
284
|
-
segments:
|
285
|
-
- 1
|
286
|
-
- 3
|
287
|
-
- 6
|
235
|
+
- !ruby/object:Gem::Version
|
288
236
|
version: 1.3.6
|
289
237
|
requirements: []
|
290
|
-
|
291
238
|
rubyforge_project:
|
292
|
-
rubygems_version:
|
239
|
+
rubygems_version: 2.4.5.1
|
293
240
|
signing_key:
|
294
|
-
specification_version:
|
241
|
+
specification_version: 4
|
295
242
|
summary: authentication system for using warden with sinatra
|
296
243
|
test_files: []
|
297
|
-
|
244
|
+
has_rdoc:
|
data/Gemfile.lock
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
sinatra_warden (0.3.2)
|
5
|
-
sinatra (>= 1.0.0)
|
6
|
-
warden (~> 1.0)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: http://rubygems.org/
|
10
|
-
specs:
|
11
|
-
addressable (2.2.2)
|
12
|
-
bcrypt-ruby (2.1.2)
|
13
|
-
data_objects (0.10.2)
|
14
|
-
addressable (~> 2.1)
|
15
|
-
dm-core (1.0.2)
|
16
|
-
addressable (~> 2.2)
|
17
|
-
extlib (~> 0.9.15)
|
18
|
-
dm-do-adapter (1.0.2)
|
19
|
-
data_objects (~> 0.10.2)
|
20
|
-
dm-core (~> 1.0.2)
|
21
|
-
dm-migrations (1.0.2)
|
22
|
-
dm-core (~> 1.0.2)
|
23
|
-
dm-sqlite-adapter (1.0.2)
|
24
|
-
dm-do-adapter (~> 1.0.2)
|
25
|
-
do_sqlite3 (~> 0.10.2)
|
26
|
-
do_sqlite3 (0.10.2)
|
27
|
-
data_objects (= 0.10.2)
|
28
|
-
extlib (0.9.15)
|
29
|
-
haml (3.0.23)
|
30
|
-
rack (1.2.1)
|
31
|
-
rack-flash (0.1.1)
|
32
|
-
rack
|
33
|
-
rack-test (0.5.6)
|
34
|
-
rack (>= 1.0)
|
35
|
-
rake (0.8.7)
|
36
|
-
rcov (0.9.9)
|
37
|
-
rspec (1.2.9)
|
38
|
-
sinatra (1.1.0)
|
39
|
-
rack (~> 1.1)
|
40
|
-
tilt (~> 1.1)
|
41
|
-
tilt (1.1)
|
42
|
-
warden (1.0.1)
|
43
|
-
rack (>= 1.0.0)
|
44
|
-
yard (0.6.1)
|
45
|
-
|
46
|
-
PLATFORMS
|
47
|
-
ruby
|
48
|
-
|
49
|
-
DEPENDENCIES
|
50
|
-
bcrypt-ruby
|
51
|
-
dm-core (~> 1.0)
|
52
|
-
dm-migrations
|
53
|
-
dm-sqlite-adapter
|
54
|
-
do_sqlite3 (~> 0.10.0)
|
55
|
-
haml
|
56
|
-
rack-flash (~> 0.1.1)
|
57
|
-
rack-test (~> 0.5.0)
|
58
|
-
rake
|
59
|
-
rcov
|
60
|
-
rspec (~> 1.2.9)
|
61
|
-
sinatra (>= 1.0.0)
|
62
|
-
sinatra_warden!
|
63
|
-
warden (~> 1.0)
|
64
|
-
yard (>= 0.5.4)
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.3.2
|
@@ -1,15 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
Warden::Strategies.add(:password) do
|
5
|
-
def valid?
|
6
|
-
# params['email'] && params['password']
|
7
|
-
# p params
|
8
|
-
true
|
9
|
-
end
|
10
|
-
|
11
|
-
def authenticate!
|
12
|
-
u = User.authenticate(params['email'], params['password'])
|
13
|
-
u.nil? ? fail!("Could not log you in.") : success!(u)
|
14
|
-
end
|
15
|
-
end
|