merb-auth 0.9.9 → 0.9.10
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.textile +33 -30
- data/Rakefile +1 -3
- metadata +7 -7
data/README.textile
CHANGED
@@ -2,7 +2,6 @@ h1. MerbAuth - Merb Merb::Authentication
|
|
2
2
|
|
3
3
|
h2. An extensible architecture for authentication
|
4
4
|
|
5
|
-
* Stupidly Simple
|
6
5
|
* Speaks fluent HTTP, even the errors
|
7
6
|
* Pluggable Architecture (so that you can use any authentication algorithms you like)
|
8
7
|
* Cascading Merb::Authentication (if one method fails, another is attempted, then another. When no methods succeed, authentication fails)
|
@@ -18,7 +17,7 @@ h2. What is it
|
|
18
17
|
The merb-auth gem is the default implementation of merb-auth-core and merb-auth-more for
|
19
18
|
the default Merb Stack. Included are:
|
20
19
|
|
21
|
-
merb-auth-slice-password # A basic slice that provides
|
20
|
+
merb-auth-slice-password # A basic slice that provides login and logout functionality
|
22
21
|
|
23
22
|
Strategies:
|
24
23
|
:default_password_form # Form based login via a "login" field and "password" field
|
@@ -37,54 +36,58 @@ Gem Style
|
|
37
36
|
|
38
37
|
From Source
|
39
38
|
<pre><code>
|
40
|
-
git clone http://github.com/wycats/merb
|
41
|
-
cd merb
|
39
|
+
git clone http://github.com/wycats/merb.git
|
40
|
+
cd merb/merb-auth
|
42
41
|
sudo rake install
|
43
42
|
</code></pre>
|
44
43
|
|
45
44
|
h2. Basic Setup
|
46
45
|
|
47
|
-
h3. Application Setup
|
46
|
+
h3. Application Setup (Stack)
|
48
47
|
|
49
|
-
|
48
|
+
When you generate your application with @merb-gen app my_app@ your almost ready to go.
|
50
49
|
|
51
|
-
|
52
|
-
$ merb-gen resource users
|
50
|
+
You'll need something to protect @merb-gen resource foos@
|
53
51
|
|
54
|
-
|
55
|
-
property :login, String
|
52
|
+
You'll need to make your database: @rake db:automigrate@
|
56
53
|
|
57
|
-
|
58
|
-
crypted_password - String
|
59
|
-
salt - String
|
60
|
-
|
61
|
-
|
62
|
-
h4. Setup your configuration
|
63
|
-
|
64
|
-
Include merb-auth in your application config/init.rb
|
54
|
+
Also you need a user
|
65
55
|
<pre><code>
|
66
|
-
|
56
|
+
$ merb -i
|
57
|
+
>> u = User.new(:login => "homer")
|
58
|
+
>> u.password = u.password_confirmation = "sekrit"
|
59
|
+
>> u.save
|
67
60
|
</code></pre>
|
68
61
|
|
69
|
-
|
62
|
+
No you should setup authentication for the things you want to protect:
|
70
63
|
|
71
64
|
<pre><code>
|
72
|
-
|
73
|
-
|
65
|
+
# config/router.rb
|
66
|
+
authenticate do
|
67
|
+
resources :foos
|
74
68
|
end
|
75
|
-
</code
|
69
|
+
</pre></code>
|
70
|
+
|
71
|
+
You can protect your controller at an action level also
|
76
72
|
|
77
|
-
Protect Your Controller
|
78
73
|
<pre><code>
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
</pre></code>
|
74
|
+
# app/controllers/foos.rb
|
75
|
+
before :ensure_authenticated
|
76
|
+
</code></pre>
|
77
|
+
|
78
|
+
Fire It Up!
|
85
79
|
|
80
|
+
@merb@
|
86
81
|
|
82
|
+
h3. Customize your setup
|
87
83
|
|
84
|
+
In the Merb.root/merb/merb-auth directory there are a couple of files that
|
85
|
+
are generated for you by the stack generator. These are @setup.rb@ and @strategies.rb@
|
88
86
|
|
87
|
+
By default these setup merb-auth to work with the default stack. To customize it,
|
88
|
+
modify these two files to get the results you want. Serialize in and out of the session,
|
89
|
+
change the user model for use with the default strategies.
|
89
90
|
|
91
|
+
You can of course not use the default strategies and declare your own, or mix and match them.
|
90
92
|
|
93
|
+
Configure your routes in the config/router.rb file.
|
data/Rakefile
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), "../merb-core/lib/merb-core/version.rb")
|
2
2
|
|
3
|
-
GEM_VERSION = Merb::VERSION
|
4
|
-
GEM_NAME = "merb-auth"
|
5
3
|
require "rake/clean"
|
6
4
|
require "rake/gempackagetask"
|
7
5
|
require 'rubygems/specification'
|
@@ -88,4 +86,4 @@ task :spec do
|
|
88
86
|
gems.each do |gem|
|
89
87
|
Dir.chdir(gem) { sh "#{Gem.ruby} -S rake spec" }
|
90
88
|
end
|
91
|
-
end
|
89
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merb-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Neighman
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-10-
|
12
|
+
date: 2008-10-21 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.9.
|
23
|
+
version: 0.9.10
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: merb-auth-core
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.9.
|
33
|
+
version: 0.9.10
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: merb-auth-more
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.9.
|
43
|
+
version: 0.9.10
|
44
44
|
version:
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: merb-auth-slice-password
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.9.
|
53
|
+
version: 0.9.10
|
54
54
|
version:
|
55
55
|
description: merb-auth. The official authentication plugin for merb. Setup for the default stack
|
56
56
|
email: has.sox@gmail.com
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
requirements: []
|
89
89
|
|
90
90
|
rubyforge_project: merb-auth
|
91
|
-
rubygems_version: 1.
|
91
|
+
rubygems_version: 1.3.0
|
92
92
|
signing_key:
|
93
93
|
specification_version: 2
|
94
94
|
summary: merb-auth. The official authentication plugin for merb. Setup for the default stack
|