dm-is-authenticatable 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +11 -0
- data/ChangeLog.md +4 -0
- data/README.md +29 -1
- data/dm-is-authenticatable.gemspec +1 -1
- data/gemspec.yml +2 -2
- metadata +25 -22
data/.gitignore
ADDED
data/ChangeLog.md
CHANGED
data/README.md
CHANGED
@@ -22,11 +22,14 @@ your DataMapper models. Ideal for use with
|
|
22
22
|
include DataMapper::Resource
|
23
23
|
|
24
24
|
is :authenticatable
|
25
|
+
|
26
|
+
property :id, Serial
|
25
27
|
|
26
28
|
# Name of the Licence
|
27
29
|
property :name, String
|
28
30
|
|
29
31
|
end
|
32
|
+
DataMapper.finalize
|
30
33
|
|
31
34
|
user = User.new(:name => 'bob')
|
32
35
|
user.password = 'secret'
|
@@ -56,9 +59,34 @@ Handles finding and authenticating resources in the database:
|
|
56
59
|
User.authenticate(:name => 'bob', :password => 'secret')
|
57
60
|
# => #<User: ...>
|
58
61
|
|
62
|
+
Using dm-is-authenticatable with [Warden](http://github.com/hassox/warden#readme):
|
63
|
+
|
64
|
+
Warden::Manager.serialize_into_session { |user| user.id }
|
65
|
+
Warden::Manager.serialize_from_session { |id| User.get(id) }
|
66
|
+
|
67
|
+
Warden::Strategies.add(:password) do
|
68
|
+
def valid?
|
69
|
+
# must specify both name and password
|
70
|
+
params['name'] && params['password']
|
71
|
+
end
|
72
|
+
|
73
|
+
def authenticate!
|
74
|
+
attributes = {
|
75
|
+
:name => params['name'],
|
76
|
+
:password => params['password']
|
77
|
+
}
|
78
|
+
|
79
|
+
if (user = User.authenticate(attributes))
|
80
|
+
success! user
|
81
|
+
else
|
82
|
+
fail! 'Invalid user name or password'
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
59
87
|
## Requirements
|
60
88
|
|
61
|
-
* [bcrypt-ruby](http://rubygems.org/gems/bcrypt-ruby) ~> 2.1
|
89
|
+
* [bcrypt-ruby](http://rubygems.org/gems/bcrypt-ruby) ~> 3.0, >= 2.1.0
|
62
90
|
* [dm-core](http://github.com/datamapper/dm-core/) ~> 1.0
|
63
91
|
* [dm-types](http://github.com/datamapper/dm-types/) ~> 1.0
|
64
92
|
* [dm-validations](http://github.com/datamapper/dm-validations/) ~> 1.0
|
@@ -95,7 +95,7 @@ Gem::Specification.new do |gemspec|
|
|
95
95
|
end
|
96
96
|
|
97
97
|
if gemspec.respond_to?(:required_rubygems_version=)
|
98
|
-
gemspec.required_rubygems_version = metadata['
|
98
|
+
gemspec.required_rubygems_version = metadata['required_rubygems_version']
|
99
99
|
end
|
100
100
|
|
101
101
|
parse_versions = lambda { |versions|
|
data/gemspec.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
name: dm-is-authenticatable
|
2
|
-
version: 0.1.
|
2
|
+
version: 0.1.2
|
3
3
|
summary: DataMapper plugin for adding authentication to models.
|
4
4
|
description:
|
5
5
|
A DataMapper plugin for adding authentication and encrypted passwords to
|
@@ -12,7 +12,7 @@ homepage: http://github.com/postmodern/dm-is-authenticatable
|
|
12
12
|
has_yard: true
|
13
13
|
|
14
14
|
dependencies:
|
15
|
-
bcrypt-ruby: ~> 2.1
|
15
|
+
bcrypt-ruby: ~> 3.0, >= 2.1.0
|
16
16
|
dm-core: ~> 1.0
|
17
17
|
dm-types: ~> 1.0
|
18
18
|
dm-validations: ~> 1.0
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-is-authenticatable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,23 +9,25 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
13
|
-
default_executable:
|
12
|
+
date: 2011-10-26 00:00:00.000000000Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: bcrypt-ruby
|
17
|
-
requirement: &
|
16
|
+
requirement: &16898840 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
19
|
- - ~>
|
21
20
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
21
|
+
version: '3.0'
|
22
|
+
- - ! '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 2.1.0
|
23
25
|
type: :runtime
|
24
26
|
prerelease: false
|
25
|
-
version_requirements: *
|
27
|
+
version_requirements: *16898840
|
26
28
|
- !ruby/object:Gem::Dependency
|
27
29
|
name: dm-core
|
28
|
-
requirement: &
|
30
|
+
requirement: &16896440 !ruby/object:Gem::Requirement
|
29
31
|
none: false
|
30
32
|
requirements:
|
31
33
|
- - ~>
|
@@ -33,10 +35,10 @@ dependencies:
|
|
33
35
|
version: '1.0'
|
34
36
|
type: :runtime
|
35
37
|
prerelease: false
|
36
|
-
version_requirements: *
|
38
|
+
version_requirements: *16896440
|
37
39
|
- !ruby/object:Gem::Dependency
|
38
40
|
name: dm-types
|
39
|
-
requirement: &
|
41
|
+
requirement: &16895180 !ruby/object:Gem::Requirement
|
40
42
|
none: false
|
41
43
|
requirements:
|
42
44
|
- - ~>
|
@@ -44,10 +46,10 @@ dependencies:
|
|
44
46
|
version: '1.0'
|
45
47
|
type: :runtime
|
46
48
|
prerelease: false
|
47
|
-
version_requirements: *
|
49
|
+
version_requirements: *16895180
|
48
50
|
- !ruby/object:Gem::Dependency
|
49
51
|
name: dm-validations
|
50
|
-
requirement: &
|
52
|
+
requirement: &16893980 !ruby/object:Gem::Requirement
|
51
53
|
none: false
|
52
54
|
requirements:
|
53
55
|
- - ~>
|
@@ -55,10 +57,10 @@ dependencies:
|
|
55
57
|
version: '1.0'
|
56
58
|
type: :runtime
|
57
59
|
prerelease: false
|
58
|
-
version_requirements: *
|
60
|
+
version_requirements: *16893980
|
59
61
|
- !ruby/object:Gem::Dependency
|
60
62
|
name: bundler
|
61
|
-
requirement: &
|
63
|
+
requirement: &16893000 !ruby/object:Gem::Requirement
|
62
64
|
none: false
|
63
65
|
requirements:
|
64
66
|
- - ~>
|
@@ -66,10 +68,10 @@ dependencies:
|
|
66
68
|
version: '1.0'
|
67
69
|
type: :development
|
68
70
|
prerelease: false
|
69
|
-
version_requirements: *
|
71
|
+
version_requirements: *16893000
|
70
72
|
- !ruby/object:Gem::Dependency
|
71
73
|
name: yard
|
72
|
-
requirement: &
|
74
|
+
requirement: &16891120 !ruby/object:Gem::Requirement
|
73
75
|
none: false
|
74
76
|
requirements:
|
75
77
|
- - ~>
|
@@ -77,16 +79,18 @@ dependencies:
|
|
77
79
|
version: '0.7'
|
78
80
|
type: :development
|
79
81
|
prerelease: false
|
80
|
-
version_requirements: *
|
82
|
+
version_requirements: *16891120
|
81
83
|
description: A DataMapper plugin for adding authentication and encrypted passwords
|
82
84
|
to your DataMapper models.
|
83
|
-
email:
|
84
|
-
- postmodern.mod3@gmail.com
|
85
|
+
email: postmodern.mod3@gmail.com
|
85
86
|
executables: []
|
86
87
|
extensions: []
|
87
88
|
extra_rdoc_files:
|
89
|
+
- ChangeLog.md
|
90
|
+
- LICENSE.txt
|
88
91
|
- README.md
|
89
92
|
files:
|
93
|
+
- .gitignore
|
90
94
|
- .rspec
|
91
95
|
- .yardopts
|
92
96
|
- ChangeLog.md
|
@@ -101,7 +105,6 @@ files:
|
|
101
105
|
- spec/integration/authenticatable_spec.rb
|
102
106
|
- spec/integration/models/user.rb
|
103
107
|
- spec/spec_helper.rb
|
104
|
-
has_rdoc: yard
|
105
108
|
homepage: http://github.com/postmodern/dm-is-authenticatable
|
106
109
|
licenses:
|
107
110
|
- MIT
|
@@ -120,10 +123,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
123
|
requirements:
|
121
124
|
- - ! '>='
|
122
125
|
- !ruby/object:Gem::Version
|
123
|
-
version:
|
126
|
+
version: '0'
|
124
127
|
requirements: []
|
125
|
-
rubyforge_project:
|
126
|
-
rubygems_version: 1.
|
128
|
+
rubyforge_project:
|
129
|
+
rubygems_version: 1.8.10
|
127
130
|
signing_key:
|
128
131
|
specification_version: 3
|
129
132
|
summary: DataMapper plugin for adding authentication to models.
|