merb-auth-more 1.1.0.rc1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,26 +1,23 @@
1
- require 'merb-auth-core'
1
+ require "merb-auth-core"
2
2
 
3
- # make sure we're running inside Merb
4
- if defined?(Merb::Plugins)
5
- # Merb gives you a Merb::Plugins.config hash...feel free to put your stuff in your piece of it
6
- Merb::Plugins.config[:"merb-auth_more"] = {
7
- :chickens => false
8
- }
9
-
10
- # Register the strategies so that plugins and apps may utilize them
11
- basic_path = File.expand_path(File.dirname(__FILE__)) / "merb-auth-more" / "strategies" / "basic"
12
-
13
- Merb::Authentication.register(:default_basic_auth, basic_path / "basic_auth.rb")
14
- Merb::Authentication.register(:default_openid, basic_path / "openid.rb")
15
- Merb::Authentication.register(:default_password_form, basic_path / "password_form.rb")
16
-
17
- Merb::BootLoader.before_app_loads do
18
- # require code that must be loaded before the application
19
- end
20
-
21
- Merb::BootLoader.after_app_loads do
22
- # code that can be required after the application loads
23
- end
24
-
25
- Merb::Plugins.add_rakefiles "merb-auth-more/merbtasks"
3
+ # Merb gives you a Merb::Plugins.config hash...feel free to put your stuff in your piece of it
4
+ Merb::Plugins.config[:"merb-auth_more"] = {
5
+ :chickens => false
6
+ }
7
+
8
+ # Register the strategies so that plugins and apps may utilize them
9
+ basic_path = File.expand_path(File.dirname(__FILE__)) / "merb-auth-more" / "strategies" / "basic"
10
+
11
+ Merb::Authentication.register(:default_basic_auth, basic_path / "basic_auth.rb")
12
+ Merb::Authentication.register(:default_openid, basic_path / "openid.rb")
13
+ Merb::Authentication.register(:default_password_form, basic_path / "password_form.rb")
14
+
15
+ Merb::BootLoader.before_app_loads do
16
+ # require code that must be loaded before the application
26
17
  end
18
+
19
+ Merb::BootLoader.after_app_loads do
20
+ # code that can be required after the application loads
21
+ end
22
+
23
+ Merb::Plugins.add_rakefiles "merb-auth-more/merbtasks"
@@ -29,6 +29,9 @@ class Merb::Authentication
29
29
  if defined?(DataMapper) && DataMapper::Resource > self
30
30
  require "#{path}/dm_salted_user"
31
31
  extend(Merb::Authentication::Mixins::SaltedUser::DMClassMethods)
32
+ elsif defined?(Mongoid) && Mongoid::Document > self
33
+ require "#{path}/mongoid_salted_user"
34
+ extend(Merb::Authentication::Mixins::SaltedUser::MongoidClassMethods)
32
35
  elsif defined?(ActiveRecord) && ancestors.include?(ActiveRecord::Base)
33
36
  require "#{path}/ar_salted_user"
34
37
  extend(Merb::Authentication::Mixins::SaltedUser::ARClassMethods)
@@ -0,0 +1,29 @@
1
+ class Merb::Authentication
2
+ module Mixins
3
+ module SaltedUser
4
+ module MongoidClassMethods
5
+ def self.extended(base)
6
+ base.class_eval do
7
+
8
+ field :crypted_password, :type => String
9
+
10
+ if Merb::Authentication::Mixins::SaltedUser > base
11
+ field :salt, :type => String
12
+ end
13
+
14
+ validates_presence_of :password, :if => proc{|m| m.password_required?}
15
+ validates_confirmation_of :password, :if => proc{|m| m.password_required?}
16
+
17
+ before_save :encrypt_password
18
+ end # base.class_eval
19
+
20
+ end # self.extended
21
+
22
+ def authenticate(login, password)
23
+ @u = first(:conditions => { Merb::Authentication::Strategies::Basic::Base.login_param => login })
24
+ @u && @u.authenticated?(password) ? @u : nil
25
+ end
26
+ end # MongoidClassMethods
27
+ end # SaltedUser
28
+ end # Mixins
29
+ end # Merb::Authentication
@@ -1,7 +1,7 @@
1
1
  module Merb
2
2
  module Auth
3
3
  module More
4
- VERSION = '1.1.0.rc1'.freeze
4
+ VERSION = '1.1.0'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb-auth-more
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: true
4
+ prerelease: false
5
5
  segments:
6
6
  - 1
7
7
  - 1
8
8
  - 0
9
- - rc1
10
- version: 1.1.0.rc1
9
+ version: 1.1.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Daniel Neighman
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-03-15 00:00:00 +00:00
17
+ date: 2010-03-22 00:00:00 +00:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -29,8 +28,7 @@ dependencies:
29
28
  - 1
30
29
  - 1
31
30
  - 0
32
- - rc1
33
- version: 1.1.0.rc1
31
+ version: 1.1.0
34
32
  type: :runtime
35
33
  version_requirements: *id001
36
34
  - !ruby/object:Gem::Dependency
@@ -69,6 +67,7 @@ files:
69
67
  - lib/merb-auth-more/mixins/salted_user.rb
70
68
  - lib/merb-auth-more/mixins/salted_user/ar_salted_user.rb
71
69
  - lib/merb-auth-more/mixins/salted_user/dm_salted_user.rb
70
+ - lib/merb-auth-more/mixins/salted_user/mongoid_salted_user.rb
72
71
  - lib/merb-auth-more/mixins/salted_user/relaxdb_salted_user.rb
73
72
  - lib/merb-auth-more/mixins/salted_user/sq_salted_user.rb
74
73
  - lib/merb-auth-more/strategies/abstract_password.rb
@@ -102,13 +101,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
101
  version: "0"
103
102
  required_rubygems_version: !ruby/object:Gem::Requirement
104
103
  requirements:
105
- - - ">"
104
+ - - ">="
106
105
  - !ruby/object:Gem::Version
107
106
  segments:
108
- - 1
109
- - 3
110
- - 1
111
- version: 1.3.1
107
+ - 0
108
+ version: "0"
112
109
  requirements: []
113
110
 
114
111
  rubyforge_project: