rack_warden 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +1 -0
- data/README.md +35 -10
- data/Rakefile +1 -1
- data/config.ru +6 -3
- data/lib/rack_warden.rb +3 -3
- data/lib/rack_warden/app.rb +213 -197
- data/lib/rack_warden/model.rb +1 -1
- data/lib/rack_warden/version.rb +2 -2
- data/lib/rack_warden/views/rack_warden_index.html.erb +1 -0
- data/lib/rack_warden/views/rack_warden_layout.html.erb +5 -1
- data/rack_warden.gemspec +4 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YmEzNjc1YzgzMjZmMzViZDIxNDliOTAzNDZlMzBkYmUzZTdlMDY4ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjhlZGE3ZWY4OWI2MzM2MWVhNzY2YTZiNjcxOGI2ZDZkMjRlZDcxZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmU0NTYxZjc0ZDhjMDhmYWFkMzIzMDU3M2ZjYWI1MDhlMmExNTZhYjY5Mzk3
|
10
|
+
Njk0ZjA5OTdiYjZmODFiMGVkNThkYjYxODEzZDlkNDZiNTEwMGQzNGFiZGJj
|
11
|
+
OTIxOTQ0YjJjZWU3ZjRjYmJiZDE2MmFlYmI4OWY1M2ZhYWM5MzU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MGVkMzY5ODI2ZGYwZDg4NzNmNzBjMzI3M2VmZDBkMzIzMmRmNDY1MWU1Mzg5
|
14
|
+
NDI0NzExODY3NjM1Y2E1MDljYzI3MGU2ZGFlMjgzZjU5Y2Q1ZDU2NzllNzhj
|
15
|
+
NzA4MDE3NjBhNGU2NzhhYWQzZDVhMDIzYmM5YjI4ZjQ2NzU4MWI=
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# RackWarden
|
2
2
|
|
3
|
-
RackWarden is a rack middleware mini-app that provides user authentication and management to any rack-based app
|
3
|
+
RackWarden is a rack middleware mini-app that provides user authentication and management to any rack-based app (currently supports Sinatra and Rails, with more on the way). This project is in its infancy. It is currently a great starter to get you going with plug-in authentication for your ruby app. Over time it will grow into a more fully featured package while maintaining a focus on simplicity, modularity, and transparency.
|
4
4
|
|
5
|
-
RackWarden
|
5
|
+
RackWarden uses Sinatra for the mini-app, Warden for authentication, and DataMapper for database connections. It is based on the sinatra-warden-example at https://github.com/sklise/sinatra-warden-example. If you are new to warden or Sinatra, I highly recommend downloading and experimenting with that example.
|
6
6
|
|
7
|
-
|
7
|
+
My goal in developing this software is to have drop-in authentication containing most of the features you see in user/account management sections of a typical web site. But I don't want to be strapped by this module in any of my projects, so it must be customizable. Or rather, overridable. The basics of this flexibility are already in place, and it will be a central theme throughout. See below for examples on overriding and customizing RackWarden.
|
8
8
|
|
9
9
|
|
10
10
|
## Installation
|
@@ -29,7 +29,7 @@ A few simple steps will have your entire app protected.
|
|
29
29
|
### Sinatra
|
30
30
|
|
31
31
|
class MySinatraApp < Sinatra::Base
|
32
|
-
use RackWarden
|
32
|
+
use RackWarden::App
|
33
33
|
|
34
34
|
before do
|
35
35
|
require_login
|
@@ -44,20 +44,45 @@ A few simple steps will have your entire app protected.
|
|
44
44
|
|
45
45
|
application.rb or environment.rb
|
46
46
|
|
47
|
-
config.middleware.use RackWarden
|
47
|
+
config.middleware.use RackWarden::App
|
48
48
|
|
49
49
|
application-controller.rb
|
50
50
|
|
51
51
|
before_filter :require_login
|
52
52
|
|
53
|
-
### Others...
|
54
53
|
|
55
|
-
## How it works
|
56
54
|
|
57
|
-
|
55
|
+
## Configuration
|
56
|
+
|
57
|
+
Pass configuration settings to RackWarden through your ``use`` method. The params hash will be translated directly to the app's settings. You can currently specify :database, :views, and :default_route. You can also specify any of the standard Sinatra settings, like :views.
|
58
|
+
|
59
|
+
If you pass a block with the ``use`` method, the block will be evaluated in the context of the RackWarden::App class. Anything you do in that block is just as if you were writing code in the app class itself. While in the block, you also have access to two relevant objects.
|
60
|
+
|
61
|
+
use RackWarden::App do |rack_warden_app_instance, parent_app_instance|
|
62
|
+
set :somesetting, 'some_value'
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
## Customization
|
67
|
+
|
68
|
+
To customize RackWarden for your specific project, you can set :views to point to a directory within your project. Then create templates that match the names of RackWarden templates, and they will be picked up and rendered. RackWarden looks for templates at the top level of your views directory as a default. You can change or add to this when you define the middleware in your project.
|
69
|
+
|
70
|
+
use RackWarden::App, :views => File.join(Dir.pwd, 'app/views/rack_warden')
|
71
|
+
|
72
|
+
Or if you simply want RackWarden to use your own custom layout, pass it a file path in the :layout parameter.
|
73
|
+
|
74
|
+
use RackWarden::App, :layout => :'layouts/rack_warden_layout.html'
|
75
|
+
|
76
|
+
Just remember that RackWarden is Sinatra, and any templates you pass must use Sinatra-specific code. For example, Sinatra uses ``url`` instead of Rails' ``url_for``. Also remember that template names in Sinatra must always be symbols.
|
77
|
+
|
78
|
+
Another way to customize RackWarden is to override its classes and methods, as you would with any other ruby code.
|
79
|
+
|
80
|
+
And if you want to customize RackWarden more extensively, you can always download the source from github and directly modify the app file and templates. Then point to this modified gem in your project Gemfile.
|
81
|
+
|
82
|
+
gem 'rack_warden', :path => "../RackWarden/"
|
83
|
+
|
84
|
+
|
58
85
|
|
59
|
-
## Customizing
|
60
86
|
|
61
|
-
...
|
62
87
|
|
63
88
|
|
data/Rakefile
CHANGED
data/config.ru
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
::RACK_WARDEN_STANDALONE = true
|
2
|
+
|
1
3
|
require 'bundler'
|
2
4
|
|
3
5
|
Bundler.require
|
4
6
|
|
7
|
+
require File.expand_path('../lib/rack_warden', __FILE__)
|
5
8
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
+
map ENV['BASE_URI'] || '/' do
|
10
|
+
run RackWarden::App
|
11
|
+
end
|
data/lib/rack_warden.rb
CHANGED
data/lib/rack_warden/app.rb
CHANGED
@@ -1,232 +1,248 @@
|
|
1
1
|
# require 'bundler'
|
2
2
|
# Bundler.require
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
module RackWarden
|
5
|
+
class App < Sinatra::Base
|
6
|
+
enable :sessions
|
7
|
+
register Sinatra::Flash
|
8
|
+
set :config_files, [ENV['RACK_WARDEN_CONFIG_FILE'], 'rack_warden.yml', 'rack_warden.yaml'].compact.uniq
|
9
|
+
set :layout, :'rack_warden_layout.html'
|
10
|
+
set :default_route, '/'
|
11
|
+
set :database, "sqlite://#{Dir.pwd}/rack_warden.sqlite.db"
|
12
|
+
|
13
|
+
# Load config from file, if any exist.
|
14
|
+
Hash.new.tap do |hash|
|
15
|
+
config_files.each {|c| hash.merge! Psych.load_file(c) rescue nil}
|
16
|
+
set hash
|
17
|
+
end
|
11
18
|
|
12
19
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
20
|
+
# WBR - This will receive params and a block from the parent "use" statement.
|
21
|
+
# This middleware app has been modified to process the parent use-block in
|
22
|
+
# the context of the RackWarden class. So you can set settings on RackWarden,
|
23
|
+
# when you call "use RackWarden::App"
|
24
|
+
# Example:
|
25
|
+
#
|
26
|
+
# use RackWarden::App :layout=>:'my_layout' do |rack_warden_instance, parent_app_instance|
|
27
|
+
# set :myvar, 'something'
|
28
|
+
# end
|
29
|
+
#
|
30
|
+
def initialize(parent_app=nil, *args, &block)
|
31
|
+
#puts "INITIALIZE RackWarden::App INSTANCE [parent_app, self, args, block]: #{[parent_app, self, args, block]}"
|
32
|
+
# extract options.
|
33
|
+
opts = args.last.is_a?(Hash) ? args.pop : {}
|
34
|
+
klass = self.class
|
35
|
+
if parent_app
|
36
|
+
# append views from opts.
|
37
|
+
klass.set(:original_views, opts.has_key?(:views) ? klass.views : nil)
|
38
|
+
#klass.set(:views => [Array(klass.views), opts.delete(:views)].flatten) if opts[:views]
|
39
|
+
# set app settings with remainder of opts.
|
40
|
+
klass.set opts if opts.any?
|
41
|
+
# eval the use-block from the parent app, in context of this app.
|
42
|
+
klass.instance_exec(self, parent_instance, &block) if block_given?
|
43
|
+
# do parent_app setup.
|
44
|
+
setup_parent_app(parent_app, args, opts)
|
45
|
+
#parent_app.class.helpers(RackWardenHelpers) rescue ApplicationController.send(:include, RackWardenHelpers)
|
46
|
+
end
|
47
|
+
# finally, send parent app to super, but don't send the use-block (thus the empty proc)
|
48
|
+
super(parent_app, &Proc.new{})
|
49
|
+
end
|
43
50
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
51
|
+
def setup_parent_app(parent_app, args, opts)
|
52
|
+
puts "RACKWARDEN initializing parent app: #{parent_app}"
|
53
|
+
#puts "RACKWARDEN parent app parents: #{parent_app.class.parents}"
|
54
|
+
#puts "RACKWARDEN parent app ancestors: #{parent_app.class.ancestors}"
|
55
|
+
klass = self.class
|
56
|
+
case
|
57
|
+
when parent_app.class.ancestors.find{|x| x.to_s=='Sinatra::Base'}
|
58
|
+
parent_app.class.helpers(RackWardenHelpers)
|
59
|
+
default_parent_views = File.join(Dir.pwd,"views")
|
60
|
+
when parent_app.class.parents.find{|x| x.to_s=='ActionDispatch'}
|
61
|
+
ApplicationController.send(:include, RackWardenHelpers)
|
62
|
+
default_parent_views = File.join(Dir.pwd, "app/views")
|
63
|
+
end
|
57
64
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
65
|
+
new_views = []
|
66
|
+
original_views = klass.original_views
|
67
|
+
# append parent rails views folder unless opts.has_key?(:views)
|
68
|
+
new_views << default_parent_views unless opts.has_key?(:views)
|
69
|
+
# append original_views, if original_views
|
70
|
+
new_views << original_views if original_views
|
71
|
+
klass.set(:views => [Array(klass.views), new_views].flatten.compact.uniq) if new_views.any?
|
72
|
+
puts "RACKWARDEN views: #{klass.views}"
|
73
|
+
end
|
67
74
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
|
-
Warden::Manager.before_failure do |env,opts|
|
91
|
-
env['REQUEST_METHOD'] = 'POST'
|
92
|
-
end
|
93
|
-
|
94
|
-
Warden::Strategies.add(:password) do
|
95
|
-
def valid?
|
96
|
-
params['user'] && params['user']['username'] && params['user']['password']
|
75
|
+
use Warden::Manager do |config|
|
76
|
+
# Tell Warden how to save our User info into a session.
|
77
|
+
# Sessions can only take strings, not Ruby code, we'll store
|
78
|
+
# the User's `id`
|
79
|
+
config.serialize_into_session{|user| user.id }
|
80
|
+
# Now tell Warden how to take what we've stored in the session
|
81
|
+
# and get a User from that information.
|
82
|
+
config.serialize_from_session{|id| User.get(id) }
|
83
|
+
|
84
|
+
config.scope_defaults :default,
|
85
|
+
# "strategies" is an array of named methods with which to
|
86
|
+
# attempt authentication. We have to define this later.
|
87
|
+
strategies: [:password],
|
88
|
+
# The action is a route to send the user to when
|
89
|
+
# warden.authenticate! returns a false answer. We'll show
|
90
|
+
# this route below.
|
91
|
+
action: 'auth/unauthenticated'
|
92
|
+
# When a user tries to log in and cannot, this specifies the
|
93
|
+
# app to send the user to.
|
94
|
+
config.failure_app = self
|
97
95
|
end
|
98
96
|
|
99
|
-
|
100
|
-
|
97
|
+
Warden::Manager.before_failure do |env,opts|
|
98
|
+
env['REQUEST_METHOD'] = 'POST'
|
99
|
+
end
|
101
100
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
101
|
+
Warden::Strategies.add(:password) do
|
102
|
+
def valid?
|
103
|
+
params['user'] && params['user']['username'] && params['user']['password']
|
104
|
+
end
|
105
|
+
|
106
|
+
def authenticate!
|
107
|
+
user = User.first(username: params['user']['username'])
|
108
|
+
|
109
|
+
if user.nil?
|
110
|
+
fail!("The username you entered does not exist.")
|
111
|
+
elsif user.authenticate(params['user']['password'])
|
112
|
+
success!(user)
|
113
|
+
else
|
114
|
+
fail!("Could not log in")
|
115
|
+
end
|
108
116
|
end
|
109
|
-
end
|
110
117
|
|
111
|
-
|
118
|
+
end
|
112
119
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
120
|
+
# Also bring these into your main app helpers.
|
121
|
+
module RackWardenHelpers
|
122
|
+
# WBR - override. This passes block to be rendered to first template that matches.
|
123
|
+
def find_template(views, name, engine, &block)
|
124
|
+
# puts "THE VIEWS: #{views}"
|
125
|
+
# puts "THE NAME: #{name}"
|
126
|
+
# puts "THE ENGINE: #{engine}"
|
127
|
+
# puts "THE BLOCK: #{block}"
|
128
|
+
Array(views).each { |v| super(v, name, engine, &block) }
|
129
|
+
end
|
123
130
|
|
124
|
-
|
125
|
-
|
126
|
-
|
131
|
+
def require_login
|
132
|
+
warden.authenticate!
|
133
|
+
end
|
127
134
|
|
128
|
-
|
129
|
-
|
130
|
-
|
135
|
+
def warden
|
136
|
+
env['warden']
|
137
|
+
end
|
131
138
|
|
132
|
-
|
133
|
-
|
134
|
-
|
139
|
+
def current_user
|
140
|
+
warden.user
|
141
|
+
end
|
135
142
|
|
136
|
-
|
137
|
-
|
138
|
-
|
143
|
+
def logged_in?
|
144
|
+
warden.authenticated?
|
145
|
+
end
|
139
146
|
|
140
147
|
|
141
|
-
|
148
|
+
# TODO: Shouldn't these be in warden block above? But they don't work there for some reason.
|
142
149
|
|
143
|
-
|
144
|
-
|
145
|
-
|
150
|
+
def valid_user_input?
|
151
|
+
params['user'] && params['user']['username'] && params['user']['password']
|
152
|
+
end
|
146
153
|
|
147
|
-
|
148
|
-
|
154
|
+
# TODO: This doesn't work.
|
155
|
+
def create_user
|
149
156
|
|
150
|
-
|
157
|
+
recaptcha
|
151
158
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
159
|
+
return unless valid_user_input?
|
160
|
+
user = User.create(username: params['user']['username'])
|
161
|
+
user.password = params['user']['password']
|
162
|
+
user.save && warden.set_user(user)
|
163
|
+
end
|
157
164
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
165
|
+
# reCAPTCHA. See https://www.google.com/recaptcha/admin#site/318693958?setup
|
166
|
+
def recaptcha(skip_redirect=false)
|
167
|
+
_recaptcha = ActiveSupport::JSON.decode(open("https://www.google.com/recaptcha/api/siteverify?secret=6LdG4v4SAAAAAJxwcS8pZRG371ZucyYg5yVUji_V&response=#{params['g-recaptcha-response']}&remoteip=#{request.ip}").read)
|
168
|
+
puts "RECAPTCHA", _recaptcha
|
169
|
+
#(render action and return) unless recaptcha['success']
|
170
|
+
unless _recaptcha['success'] || skip_redirect
|
171
|
+
flash(:rwarden)[:error] = "Please confirm you are human."
|
172
|
+
redirect back
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def default_page
|
177
|
+
erb :'rack_warden_index.html', :layout=>settings.layout
|
178
|
+
end
|
168
179
|
|
169
|
-
|
170
|
-
|
180
|
+
end # RackWardenHelpers
|
181
|
+
helpers RackWardenHelpers
|
171
182
|
|
183
|
+
if defined? ::RACK_WARDEN_STANDALONE
|
184
|
+
get '/?' do
|
185
|
+
default_page
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
get '/auth/?' do
|
190
|
+
default_page
|
191
|
+
end
|
192
|
+
|
193
|
+
get '/auth/login' do
|
194
|
+
erb :'login_user.html', :layout=>settings.layout
|
195
|
+
end
|
172
196
|
|
173
|
-
|
174
|
-
|
175
|
-
erb "Warden authentication for any rack based app", :layout=>settings.layout
|
176
|
-
end
|
197
|
+
post '/auth/login' do
|
198
|
+
warden.authenticate!
|
177
199
|
|
178
|
-
|
179
|
-
erb :'login_user.html', :layout=>settings.layout
|
180
|
-
end
|
200
|
+
flash(:rwarden)[:success] = warden.message || "Successful login"
|
181
201
|
|
182
|
-
|
183
|
-
|
202
|
+
puts "RETURN_TO #{session[:return_to]}"
|
203
|
+
if session[:return_to].nil?
|
204
|
+
redirect url(settings.default_route, false)
|
205
|
+
else
|
206
|
+
redirect session[:return_to]
|
207
|
+
end
|
208
|
+
end
|
184
209
|
|
185
|
-
|
210
|
+
get '/auth/logout' do
|
211
|
+
warden.raw_session.inspect
|
212
|
+
warden.logout
|
213
|
+
flash(:rwarden)[:success] = 'You have been logged out'
|
214
|
+
redirect url(settings.default_route, false)
|
215
|
+
end
|
186
216
|
|
187
|
-
|
188
|
-
|
189
|
-
redirect settings.default_route
|
190
|
-
else
|
191
|
-
redirect session[:return_to]
|
217
|
+
get '/auth/create' do
|
218
|
+
erb :'create_user.html', :layout=>settings.layout
|
192
219
|
end
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
puts warden
|
221
|
-
flash(:rwarden)[:error] = warden.message || "Please login to continue"
|
222
|
-
redirect url('/auth/login', false)
|
223
|
-
end
|
224
|
-
|
225
|
-
get '/auth/protected' do
|
226
|
-
warden.authenticate!
|
227
|
-
|
228
|
-
erb :'rack_warden_protected.html', :layout=>settings.layout
|
229
|
-
end
|
230
|
-
|
220
|
+
|
221
|
+
post '/auth/create' do
|
222
|
+
if create_user
|
223
|
+
flash(:rwarden)[:success] = warden.message || "Account created"
|
224
|
+
redirect session[:return_to] || url(settings.default_route, false)
|
225
|
+
else
|
226
|
+
flash(:rwarden)[:error] = warden.message || "Could not create account"
|
227
|
+
redirect url('/auth/create', false)
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
post '/auth/unauthenticated' do
|
232
|
+
# I had to remove the condition, since it was not updating return path when it should have.
|
233
|
+
session[:return_to] = env['warden.options'][:attempted_path] if !request.xhr? && !env['warden.options'][:attempted_path][/login/]
|
234
|
+
puts "WARDEN ATTEMPTED PATH: #{env['warden.options'][:attempted_path]}"
|
235
|
+
puts warden
|
236
|
+
flash(:rwarden)[:error] = warden.message || "Please login to continue"
|
237
|
+
redirect url('/auth/login', false)
|
238
|
+
end
|
239
|
+
|
240
|
+
get '/auth/protected' do
|
241
|
+
warden.authenticate!
|
242
|
+
|
243
|
+
erb :'rack_warden_protected.html', :layout=>settings.layout
|
244
|
+
end
|
245
|
+
|
246
|
+
end # App
|
231
247
|
end # RackWarden
|
232
248
|
|
data/lib/rack_warden/model.rb
CHANGED
data/lib/rack_warden/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = "0.0.
|
1
|
+
module RackWarden
|
2
|
+
VERSION = "0.0.3"
|
3
3
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<h2>Warden authentication for any rack based app<h2>
|
@@ -15,7 +15,11 @@
|
|
15
15
|
<body>
|
16
16
|
<h1>Rack Warden</h1>
|
17
17
|
|
18
|
-
<p
|
18
|
+
<p>
|
19
|
+
<a href="<%=url('/auth/login', false)%>">Log In</a> |
|
20
|
+
<a href="<%=url('/', false)%>">Home</a> |
|
21
|
+
<a href="<%=url('/auth/protected', false)%>">Protected Page</a> |
|
22
|
+
<a href="<%=url('/auth/logout', false)%>">Log Out</a></p>
|
19
23
|
|
20
24
|
<% if flash(:rwarden)[:success] %>
|
21
25
|
<div style="color:green;">
|
data/rack_warden.gemspec
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
|
4
|
+
# This breaks bundle-install
|
5
|
+
#require 'sinatra/base'
|
5
6
|
require 'rack_warden/version'
|
6
7
|
|
7
8
|
Gem::Specification.new do |spec|
|
@@ -9,8 +10,8 @@ Gem::Specification.new do |spec|
|
|
9
10
|
spec.version = RackWarden::VERSION
|
10
11
|
spec.authors = ["William Richardson"]
|
11
12
|
spec.email = ["wbr@mac.com"]
|
12
|
-
spec.summary = %q{A warden/sinatra
|
13
|
-
spec.description = %q{A warden/sinatra
|
13
|
+
spec.summary = %q{A warden/sinatra mini-app providing authentication and user management for any rack-based app}
|
14
|
+
spec.description = %q{A warden/sinatra mini-app providing authentication and user management for any rack-based app.}
|
14
15
|
spec.homepage = ""
|
15
16
|
spec.license = "MIT"
|
16
17
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack_warden
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Richardson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -150,8 +150,8 @@ dependencies:
|
|
150
150
|
- - ! '>='
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
-
description: A warden/sinatra
|
154
|
-
|
153
|
+
description: A warden/sinatra mini-app providing authentication and user management
|
154
|
+
for any rack-based app.
|
155
155
|
email:
|
156
156
|
- wbr@mac.com
|
157
157
|
executables: []
|
@@ -197,6 +197,6 @@ rubyforge_project:
|
|
197
197
|
rubygems_version: 2.2.2
|
198
198
|
signing_key:
|
199
199
|
specification_version: 4
|
200
|
-
summary: A warden/sinatra
|
200
|
+
summary: A warden/sinatra mini-app providing authentication and user management for
|
201
201
|
any rack-based app
|
202
202
|
test_files: []
|