rack-cerberus 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.rdoc +17 -0
  2. data/cerberus.gemspec +1 -1
  3. data/cerberus.rb +2 -2
  4. data/spec.rb +1 -1
  5. 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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'rack-cerberus'
3
- s.version = "0.0.1"
3
+ s.version = "0.1.0"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.summary = "A Rack middleware for form-based authentication"
6
6
  s.description = "A Rack middleware for form-based authentication"
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="Log me &rarr;"></p>
37
+ <p><input type="submit" value="LOG ME &rarr;"></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') || (req.post? && @block.call(login, pass)))
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.post('/', :params => {'cerberus_login' => 'mario', 'cerberus_pass' => 'bros'})
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: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 0
9
8
  - 1
10
- version: 0.0.1
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-02 00:00:00 +01:00
18
+ date: 2010-06-07 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21