rack-cerberus 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +17 -0
- data/cerberus.gemspec +1 -1
- data/cerberus.rb +2 -2
- data/spec.rb +1 -1
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -4,8 +4,14 @@
|
|
4
4
|
|
5
5
|
Cerberus is a Rack middleware for form-based authentication. Its purpose is only
|
6
6
|
to offer a nicer (or more actual) replacement for Basic HTTP authentication.
|
7
|
+
|
8
|
+
Install with:
|
9
|
+
|
10
|
+
# sudo gem install rack-cerberus
|
11
|
+
|
7
12
|
You can use it almost the same way you use <tt>Rack::Auth::Basic</tt>:
|
8
13
|
|
14
|
+
require 'cerberus'
|
9
15
|
use Rack::Session::Cookie
|
10
16
|
use Cerberus do |login, pass|
|
11
17
|
pass=='secret'
|
@@ -36,6 +42,17 @@ If you want to see a concrete example, go into the Cerberus directory and run:
|
|
36
42
|
|
37
43
|
It's gonna start the example at http://localhost:9292
|
38
44
|
|
45
|
+
=== Help
|
46
|
+
|
47
|
+
If you need some help, let's join my IRC channel: #mighub
|
48
|
+
|
49
|
+
If you want to help me, don't hesitate to fork that project on Github or send patches.
|
50
|
+
|
51
|
+
=== Changelog
|
52
|
+
|
53
|
+
0.0.1 Changed Everything somehow
|
54
|
+
0.1.0 Make it possible to authenticate through GET request (for restful APIs)
|
55
|
+
|
39
56
|
=== Copyright
|
40
57
|
|
41
58
|
(c) 2010 Mickael Riga - see MIT_LICENCE for details
|
data/cerberus.gemspec
CHANGED
data/cerberus.rb
CHANGED
@@ -34,7 +34,7 @@ class Cerberus
|
|
34
34
|
<form action="%s" method="post" accept-charset="utf-8">
|
35
35
|
<input type="text" name="cerberus_login" value="login" id='login'><br />
|
36
36
|
<input type="password" name="cerberus_pass" value="pass" id='pass'>
|
37
|
-
<p><input type="submit" value="
|
37
|
+
<p><input type="submit" value="LOG ME →"></p>
|
38
38
|
</form>
|
39
39
|
<script type="text/javascript" charset="utf-8">
|
40
40
|
var login = document.getElementById('login');
|
@@ -70,7 +70,7 @@ PAGE
|
|
70
70
|
login = req['cerberus_login']
|
71
71
|
pass = req['cerberus_pass']
|
72
72
|
err = req.post? ? "<p class='err'>Wrong login or password</p>" : ''
|
73
|
-
if ((env['rack.session']['cerberus_user']!=nil && env['PATH_INFO']!='/logout') || (
|
73
|
+
if ((env['rack.session']['cerberus_user']!=nil && env['PATH_INFO']!='/logout') || (login && pass && @block.call(login, pass)))
|
74
74
|
env['rack.session']['cerberus_user'] ||= login
|
75
75
|
@app.call(env)
|
76
76
|
else
|
data/spec.rb
CHANGED
@@ -21,7 +21,7 @@ describe 'cerberus' do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
should 'Give access with the appropriate login and pass' do
|
24
|
-
res = req.
|
24
|
+
res = req.get('/', :params => {'cerberus_login' => 'mario', 'cerberus_pass' => 'bros'})
|
25
25
|
cookie = res["Set-Cookie"]
|
26
26
|
res.status.should==200
|
27
27
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-cerberus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mickael Riga
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-07 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|