rack-cerberus 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -2
- data/cerberus.gemspec +2 -2
- data/cerberus.rb +4 -3
- data/spec.rb +6 -0
- metadata +5 -5
data/README.rdoc
CHANGED
@@ -50,8 +50,6 @@ logged out. Pretty simple.
|
|
50
50
|
|
51
51
|
=== Help
|
52
52
|
|
53
|
-
If you need some help, let's join my IRC channel: #mighub
|
54
|
-
|
55
53
|
If you want to help me, don't hesitate to fork that project on Github or send patches.
|
56
54
|
|
57
55
|
=== Changelog
|
@@ -59,6 +57,7 @@ If you want to help me, don't hesitate to fork that project on Github or send pa
|
|
59
57
|
0.0.1 Changed Everything somehow
|
60
58
|
0.1.0 Make it possible to authenticate through GET request (for restful APIs)
|
61
59
|
0.1.1 Documentation improvement
|
60
|
+
0.1.2 Raise message when using without session
|
62
61
|
|
63
62
|
=== Copyright
|
64
63
|
|
data/cerberus.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'rack-cerberus'
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.2"
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
s.summary = "A Rack middleware for form-based authentication"
|
6
|
-
s.description = "A Rack middleware for form-based authentication"
|
6
|
+
s.description = "A Rack middleware for form-based authentication. Aim is a compromise between fonctionality, beauty and customization."
|
7
7
|
s.files = `git ls-files`.split("\n").sort
|
8
8
|
s.test_files = ['spec.rb']
|
9
9
|
s.require_path = '.'
|
data/cerberus.rb
CHANGED
@@ -17,7 +17,7 @@ class Cerberus
|
|
17
17
|
}
|
18
18
|
div {
|
19
19
|
width: 400px;
|
20
|
-
margin:
|
20
|
+
margin: 30px auto;
|
21
21
|
padding: 10px;
|
22
22
|
border-radius: 5px;
|
23
23
|
-moz-border-radius: 5px;
|
@@ -30,11 +30,11 @@ class Cerberus
|
|
30
30
|
<h1>%s</h1>
|
31
31
|
%s
|
32
32
|
%s
|
33
|
-
<p>Please
|
33
|
+
<p>Please Sign In</p>
|
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="SIGN IN →"></p>
|
38
38
|
</form>
|
39
39
|
<script type="text/javascript" charset="utf-8">
|
40
40
|
var login = document.getElementById('login');
|
@@ -66,6 +66,7 @@ PAGE
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def _call(env)
|
69
|
+
raise 'Cerberus cannot work without Session' if env['rack.session'].nil?
|
69
70
|
req = Rack::Request.new(env)
|
70
71
|
login = req['cerberus_login']
|
71
72
|
pass = req['cerberus_pass']
|
data/spec.rb
CHANGED
@@ -13,6 +13,12 @@ describe 'cerberus' do
|
|
13
13
|
req = Rack::MockRequest.new(app)
|
14
14
|
cookie = ''
|
15
15
|
|
16
|
+
should 'Raise if there is no session' do
|
17
|
+
no_session_app = Cerberus.new(secret_app, {}) {|login,pass| [login,pass]==['mario','bros']}
|
18
|
+
no_session_req = Rack::MockRequest.new(no_session_app)
|
19
|
+
lambda { no_session_req.get('/') }.should.raise(RuntimeError).message.should=='Cerberus cannot work without Session'
|
20
|
+
end
|
21
|
+
|
16
22
|
should 'Stop request if you are not already logged in or currently successfully logging' do
|
17
23
|
res = req.get('/')
|
18
24
|
res.status.should==401
|
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: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mickael Riga
|
@@ -15,11 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-24 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
22
|
-
description: A Rack middleware for form-based authentication
|
22
|
+
description: A Rack middleware for form-based authentication. Aim is a compromise between fonctionality, beauty and customization.
|
23
23
|
email: mig@mypeplum.com
|
24
24
|
executables: []
|
25
25
|
|