devise_ldap_authenticatable 0.4.10 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ .bundle
2
+ log
3
+ *.sqlite3
4
+ test/ldap/openldap-data/*
5
+ !test/ldap/openldap-data/run
6
+ test/ldap/openldap-data/run/slapd.*
7
+ test/rails_app/tmp
8
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem 'devise', '~> 1.5.0'
6
+ gem 'net-ldap', '~> 0.2.2'
7
+
8
+ platforms :mri_18 do
9
+ group :test do
10
+ gem 'ruby-debug', '>= 0.10.3'
11
+ end
12
+ end
data/Rakefile CHANGED
@@ -5,25 +5,6 @@ require 'rake/rdoctask'
5
5
  desc 'Default: run unit tests.'
6
6
  task :default => :test
7
7
 
8
- desc 'Test the devise_imapable plugin.'
9
- Rake::TestTask.new(:test) do |t|
10
- # t.libs << 'lib'
11
- # t.libs << 'test'
12
- # t.pattern = 'test/**/*_test.rb'
13
- # t.verbose = true
14
- puts <<-eof
15
-
16
- *** NOTICE ***
17
-
18
- All tests are done in the sample Rails app.
19
-
20
- Please go to test/rails_app and run the tests there.
21
-
22
- Make sure to bundle install and rake db:migrate
23
-
24
- eof
25
- end
26
-
27
8
  desc 'Generate documentation for the devise_ldap_authenticatable plugin.'
28
9
  Rake::RDocTask.new(:rdoc) do |rdoc|
29
10
  rdoc.rdoc_dir = 'rdoc'
@@ -31,22 +12,4 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
31
12
  rdoc.options << '--line-numbers' << '--inline-source'
32
13
  rdoc.rdoc_files.include('README')
33
14
  rdoc.rdoc_files.include('lib/**/*.rb')
34
- end
35
-
36
-
37
- begin
38
- require 'jeweler'
39
- Jeweler::Tasks.new do |gemspec|
40
- gemspec.name = "devise_ldap_authenticatable"
41
- gemspec.summary = "LDAP authentication module for Devise"
42
- gemspec.description = "LDAP authentication module for Devise"
43
- gemspec.email = "curtis.schiewek@gmail.com"
44
- gemspec.homepage = "http://github.com/cschiewek/devise_ldap_authenticatable"
45
- gemspec.authors = ["Curtis Schiewek", "Daniel McNevin"]
46
- gemspec.add_runtime_dependency "devise", "~> 1.4.0"
47
- gemspec.add_runtime_dependency "net-ldap", "~> 0.2.2"
48
- end
49
- Jeweler::GemcutterTasks.new
50
- rescue LoadError
51
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
52
- end
15
+ end
@@ -1,133 +1,22 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "devise_ldap_authenticatable/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{devise_ldap_authenticatable}
8
- s.version = "0.4.10"
6
+ s.name = 'devise_ldap_authenticatable'
7
+ s.version = DeviseLdapAuthenticatable::VERSION.dup
8
+ s.platform = Gem::Platform::RUBY
9
+ s.summary = 'Devise extension to allow authentication via LDAP'
10
+ s.email = 'curtis.schiewek@gmail.com'
11
+ s.homepage = 'https://github.com/cschiewek/devise_ldap_authenticatable'
12
+ s.description = s.summary
13
+ s.authors = ['Curtis Schiewek', 'Daniel McNevin', 'Steven Xu']
9
14
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Curtis Schiewek", "Daniel McNevin", "Steven Xu"]
12
- s.date = %q{2011-10-17}
13
- s.description = %q{LDAP authentication module for Devise}
14
- s.email = %q{curtis.schiewek@gmail.com}
15
- s.extra_rdoc_files = [
16
- "README.md"
17
- ]
18
- s.files = [
19
- "MIT-LICENSE",
20
- "README.md",
21
- "Rakefile",
22
- "VERSION",
23
- "devise_ldap_authenticatable.gemspec",
24
- "lib/devise_ldap_authenticatable.rb",
25
- "lib/devise_ldap_authenticatable/exception.rb",
26
- "lib/devise_ldap_authenticatable/ldap_adapter.rb",
27
- "lib/devise_ldap_authenticatable/logger.rb",
28
- "lib/devise_ldap_authenticatable/model.rb",
29
- "lib/devise_ldap_authenticatable/routes.rb",
30
- "lib/devise_ldap_authenticatable/schema.rb",
31
- "lib/devise_ldap_authenticatable/strategy.rb",
32
- "lib/devise_ldap_authenticatable/version.rb",
33
- "lib/generators/devise_ldap_authenticatable/install_generator.rb",
34
- "lib/generators/devise_ldap_authenticatable/templates/ldap.yml",
35
- "rails/init.rb",
36
- "test/devise_ldap_authenticatable_test.rb",
37
- "test/ldap/base.ldif",
38
- "test/ldap/clear.ldif",
39
- "test/ldap/local.schema",
40
- "test/ldap/run-server.sh",
41
- "test/ldap/server.pem",
42
- "test/ldap/slapd-ssl-test.conf",
43
- "test/ldap/slapd-test.conf",
44
- "test/rails_app/Gemfile",
45
- "test/rails_app/Gemfile.lock",
46
- "test/rails_app/Rakefile",
47
- "test/rails_app/app/controllers/application_controller.rb",
48
- "test/rails_app/app/controllers/posts_controller.rb",
49
- "test/rails_app/app/helpers/application_helper.rb",
50
- "test/rails_app/app/helpers/posts_helper.rb",
51
- "test/rails_app/app/models/post.rb",
52
- "test/rails_app/app/models/user.rb",
53
- "test/rails_app/app/views/layouts/application.html.erb",
54
- "test/rails_app/app/views/posts/index.html.erb",
55
- "test/rails_app/config.ru",
56
- "test/rails_app/config/application.rb",
57
- "test/rails_app/config/boot.rb",
58
- "test/rails_app/config/cucumber.yml",
59
- "test/rails_app/config/database.yml",
60
- "test/rails_app/config/environment.rb",
61
- "test/rails_app/config/environments/development.rb",
62
- "test/rails_app/config/environments/production.rb",
63
- "test/rails_app/config/environments/test.rb",
64
- "test/rails_app/config/initializers/backtrace_silencers.rb",
65
- "test/rails_app/config/initializers/devise.rb",
66
- "test/rails_app/config/initializers/inflections.rb",
67
- "test/rails_app/config/initializers/mime_types.rb",
68
- "test/rails_app/config/initializers/secret_token.rb",
69
- "test/rails_app/config/initializers/session_store.rb",
70
- "test/rails_app/config/ldap.yml",
71
- "test/rails_app/config/ldap_with_erb.yml",
72
- "test/rails_app/config/ldap_with_uid.yml",
73
- "test/rails_app/config/locales/devise.en.yml",
74
- "test/rails_app/config/locales/en.yml",
75
- "test/rails_app/config/routes.rb",
76
- "test/rails_app/config/ssl_ldap.yml",
77
- "test/rails_app/config/ssl_ldap_with_erb.yml",
78
- "test/rails_app/config/ssl_ldap_with_uid.yml",
79
- "test/rails_app/db/migrate/20100708120302_create_posts.rb",
80
- "test/rails_app/db/migrate/20100708120448_devise_create_users.rb",
81
- "test/rails_app/db/schema.rb",
82
- "test/rails_app/db/seeds.rb",
83
- "test/rails_app/features/manage_logins.feature",
84
- "test/rails_app/features/step_definitions/login_steps.rb",
85
- "test/rails_app/features/step_definitions/web_steps.rb",
86
- "test/rails_app/features/support/env.rb",
87
- "test/rails_app/features/support/paths.rb",
88
- "test/rails_app/lib/tasks/.gitkeep",
89
- "test/rails_app/lib/tasks/cucumber.rake",
90
- "test/rails_app/public/404.html",
91
- "test/rails_app/public/422.html",
92
- "test/rails_app/public/500.html",
93
- "test/rails_app/public/images/rails.png",
94
- "test/rails_app/public/javascripts/application.js",
95
- "test/rails_app/public/javascripts/controls.js",
96
- "test/rails_app/public/javascripts/dragdrop.js",
97
- "test/rails_app/public/javascripts/effects.js",
98
- "test/rails_app/public/javascripts/prototype.js",
99
- "test/rails_app/public/javascripts/rails.js",
100
- "test/rails_app/public/stylesheets/.gitkeep",
101
- "test/rails_app/script/cucumber",
102
- "test/rails_app/script/rails",
103
- "test/rails_app/test/factories/users.rb",
104
- "test/rails_app/test/functional/posts_controller_test.rb",
105
- "test/rails_app/test/performance/browsing_test.rb",
106
- "test/rails_app/test/test_helper.rb",
107
- "test/rails_app/test/unit/helpers/posts_helper_test.rb",
108
- "test/rails_app/test/unit/post_test.rb",
109
- "test/rails_app/test/unit/user_test.rb",
110
- "test/test_helper.rb"
111
- ]
112
- s.homepage = %q{http://github.com/cschiewek/devise_ldap_authenticatable}
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
113
18
  s.require_paths = ["lib"]
114
- s.rubygems_version = %q{1.3.7}
115
- s.summary = %q{LDAP authentication module for Devise}
116
-
117
- if s.respond_to? :specification_version then
118
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
119
- s.specification_version = 3
120
-
121
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
122
- s.add_runtime_dependency(%q<devise>, ["~> 1.4.0"])
123
- s.add_runtime_dependency(%q<net-ldap>, ["~> 0.2.2"])
124
- else
125
- s.add_dependency(%q<devise>, ["~> 1.4.0"])
126
- s.add_dependency(%q<net-ldap>, ["~> 0.2.2"])
127
- end
128
- else
129
- s.add_dependency(%q<devise>, ["~> 1.4.0"])
130
- s.add_dependency(%q<net-ldap>, ["~> 0.2.2"])
131
- end
132
- end
133
19
 
20
+ s.add_dependency('devise', '~> 1.5.0')
21
+ s.add_dependency('net-ldap', '~> 0.2.2')
22
+ end
@@ -5,30 +5,17 @@ module Devise
5
5
  # Strategy for signing in a user based on his login and password using LDAP.
6
6
  # Redirects to sign_in page if it's not authenticated
7
7
  class LdapAuthenticatable < Authenticatable
8
- def valid?
9
- valid_controller? && valid_params? && mapping.to.respond_to?(:authenticate_with_ldap)
10
- end
11
-
12
8
  # Authenticate a user based on login and password params, returning to warden
13
9
  # success and the authenticated user if everything is okay. Otherwise redirect
14
10
  # to sign in page.
15
11
  def authenticate!
16
- if resource = mapping.to.authenticate_with_ldap(params[scope])
12
+ resource = valid_password? && mapping.to.authenticate_with_ldap(params[scope])
13
+ if validate(resource)
17
14
  success!(resource)
18
15
  else
19
16
  fail(:invalid)
20
17
  end
21
- end
22
-
23
- protected
24
-
25
- def valid_controller?
26
- params[:controller] == mapping.controllers[:sessions]
27
- end
28
-
29
- def valid_params?
30
- params[scope] && params[scope][:password].present?
31
- end
18
+ end
32
19
  end
33
20
  end
34
21
  end
@@ -1,4 +1,3 @@
1
1
  module DeviseLdapAuthenticatable
2
- VERSION = "0.4.6"
3
- end
4
-
2
+ VERSION = "0.5.0".freeze
3
+ end
File without changes
@@ -0,0 +1,22 @@
1
+ authorizations: &AUTHORIZATIONS
2
+ ## Authorization
3
+ group_base: ou=groups,dc=test,dc=com
4
+ required_groups:
5
+ - cn=admins,ou=groups,dc=test,dc=com
6
+ - ["authorizationRole", "cn=users,ou=groups,dc=test,dc=com"]
7
+ require_attribute:
8
+ objectClass: inetOrgPerson
9
+ authorizationRole: blogAdmin
10
+
11
+ test: &TEST
12
+ host: localhost
13
+ port: 3389
14
+ attribute: cn
15
+ base: ou=people,dc=test,dc=com
16
+ admin_user: cn=admin,dc=test,dc=com
17
+ admin_password: secret
18
+ ssl: true
19
+ <<: *AUTHORIZATIONS
20
+
21
+ development:
22
+ <<: *TEST
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_ldap_authenticatable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.10
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,22 +11,22 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-10-17 00:00:00.000000000Z
14
+ date: 2011-11-25 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: devise
18
- requirement: &14061140 !ruby/object:Gem::Requirement
18
+ requirement: &13886720 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ~>
22
22
  - !ruby/object:Gem::Version
23
- version: 1.4.0
23
+ version: 1.5.0
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *14061140
26
+ version_requirements: *13886720
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: net-ldap
29
- requirement: &14060660 !ruby/object:Gem::Requirement
29
+ requirement: &13884260 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ~>
@@ -34,18 +34,18 @@ dependencies:
34
34
  version: 0.2.2
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *14060660
38
- description: LDAP authentication module for Devise
37
+ version_requirements: *13884260
38
+ description: Devise extension to allow authentication via LDAP
39
39
  email: curtis.schiewek@gmail.com
40
40
  executables: []
41
41
  extensions: []
42
- extra_rdoc_files:
43
- - README.md
42
+ extra_rdoc_files: []
44
43
  files:
44
+ - .gitignore
45
+ - Gemfile
45
46
  - MIT-LICENSE
46
47
  - README.md
47
48
  - Rakefile
48
- - VERSION
49
49
  - devise_ldap_authenticatable.gemspec
50
50
  - lib/devise_ldap_authenticatable.rb
51
51
  - lib/devise_ldap_authenticatable/exception.rb
@@ -63,6 +63,7 @@ files:
63
63
  - test/ldap/base.ldif
64
64
  - test/ldap/clear.ldif
65
65
  - test/ldap/local.schema
66
+ - test/ldap/openldap-data/run/.gitkeep
66
67
  - test/ldap/run-server.sh
67
68
  - test/ldap/server.pem
68
69
  - test/ldap/slapd-ssl-test.conf
@@ -94,6 +95,7 @@ files:
94
95
  - test/rails_app/config/initializers/secret_token.rb
95
96
  - test/rails_app/config/initializers/session_store.rb
96
97
  - test/rails_app/config/ldap.yml
98
+ - test/rails_app/config/ldap_with_boolean_ssl.yml
97
99
  - test/rails_app/config/ldap_with_erb.yml
98
100
  - test/rails_app/config/ldap_with_uid.yml
99
101
  - test/rails_app/config/locales/devise.en.yml
@@ -134,7 +136,7 @@ files:
134
136
  - test/rails_app/test/unit/post_test.rb
135
137
  - test/rails_app/test/unit/user_test.rb
136
138
  - test/test_helper.rb
137
- homepage: http://github.com/cschiewek/devise_ldap_authenticatable
139
+ homepage: https://github.com/cschiewek/devise_ldap_authenticatable
138
140
  licenses: []
139
141
  post_install_message:
140
142
  rdoc_options: []
@@ -154,8 +156,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
156
  version: '0'
155
157
  requirements: []
156
158
  rubyforge_project:
157
- rubygems_version: 1.8.10
159
+ rubygems_version: 1.8.11
158
160
  signing_key:
159
161
  specification_version: 3
160
- summary: LDAP authentication module for Devise
162
+ summary: Devise extension to allow authentication via LDAP
161
163
  test_files: []
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.4.10