prathe_devise_ldap_authenticatable 0.4.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +187 -0
  3. data/Rakefile +52 -0
  4. data/VERSION +1 -0
  5. data/devise_ldap_authenticatable.gemspec +133 -0
  6. data/lib/devise_ldap_authenticatable.rb +48 -0
  7. data/lib/devise_ldap_authenticatable/exception.rb +6 -0
  8. data/lib/devise_ldap_authenticatable/ldap_adapter.rb +242 -0
  9. data/lib/devise_ldap_authenticatable/logger.rb +11 -0
  10. data/lib/devise_ldap_authenticatable/model.rb +101 -0
  11. data/lib/devise_ldap_authenticatable/routes.rb +8 -0
  12. data/lib/devise_ldap_authenticatable/schema.rb +14 -0
  13. data/lib/devise_ldap_authenticatable/strategy.rb +36 -0
  14. data/lib/devise_ldap_authenticatable/version.rb +4 -0
  15. data/lib/generators/devise_ldap_authenticatable/install_generator.rb +62 -0
  16. data/lib/generators/devise_ldap_authenticatable/templates/ldap.yml +51 -0
  17. data/rails/init.rb +2 -0
  18. data/test/devise_ldap_authenticatable_test.rb +8 -0
  19. data/test/ldap/base.ldif +73 -0
  20. data/test/ldap/clear.ldif +26 -0
  21. data/test/ldap/local.schema +6 -0
  22. data/test/ldap/run-server.sh +10 -0
  23. data/test/ldap/server.pem +38 -0
  24. data/test/ldap/slapd-ssl-test.conf +107 -0
  25. data/test/ldap/slapd-test.conf +107 -0
  26. data/test/rails_app/Gemfile +22 -0
  27. data/test/rails_app/Gemfile.lock +159 -0
  28. data/test/rails_app/Rakefile +7 -0
  29. data/test/rails_app/app/controllers/application_controller.rb +4 -0
  30. data/test/rails_app/app/controllers/posts_controller.rb +15 -0
  31. data/test/rails_app/app/helpers/application_helper.rb +2 -0
  32. data/test/rails_app/app/helpers/posts_helper.rb +2 -0
  33. data/test/rails_app/app/models/post.rb +2 -0
  34. data/test/rails_app/app/models/user.rb +10 -0
  35. data/test/rails_app/app/views/layouts/application.html.erb +26 -0
  36. data/test/rails_app/app/views/posts/index.html.erb +2 -0
  37. data/test/rails_app/config.ru +4 -0
  38. data/test/rails_app/config/application.rb +46 -0
  39. data/test/rails_app/config/boot.rb +13 -0
  40. data/test/rails_app/config/cucumber.yml +8 -0
  41. data/test/rails_app/config/database.yml +25 -0
  42. data/test/rails_app/config/environment.rb +5 -0
  43. data/test/rails_app/config/environments/development.rb +22 -0
  44. data/test/rails_app/config/environments/production.rb +46 -0
  45. data/test/rails_app/config/environments/test.rb +34 -0
  46. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  47. data/test/rails_app/config/initializers/devise.rb +140 -0
  48. data/test/rails_app/config/initializers/inflections.rb +10 -0
  49. data/test/rails_app/config/initializers/mime_types.rb +5 -0
  50. data/test/rails_app/config/initializers/secret_token.rb +7 -0
  51. data/test/rails_app/config/initializers/session_store.rb +8 -0
  52. data/test/rails_app/config/ldap.yml +22 -0
  53. data/test/rails_app/config/ldap_with_erb.yml +23 -0
  54. data/test/rails_app/config/ldap_with_uid.yml +18 -0
  55. data/test/rails_app/config/locales/devise.en.yml +39 -0
  56. data/test/rails_app/config/locales/en.yml +5 -0
  57. data/test/rails_app/config/routes.rb +64 -0
  58. data/test/rails_app/config/ssl_ldap.yml +21 -0
  59. data/test/rails_app/config/ssl_ldap_with_erb.yml +23 -0
  60. data/test/rails_app/config/ssl_ldap_with_uid.yml +18 -0
  61. data/test/rails_app/db/migrate/20100708120302_create_posts.rb +14 -0
  62. data/test/rails_app/db/migrate/20100708120448_devise_create_users.rb +26 -0
  63. data/test/rails_app/db/schema.rb +41 -0
  64. data/test/rails_app/db/seeds.rb +7 -0
  65. data/test/rails_app/features/manage_logins.feature +35 -0
  66. data/test/rails_app/features/step_definitions/login_steps.rb +21 -0
  67. data/test/rails_app/features/step_definitions/web_steps.rb +219 -0
  68. data/test/rails_app/features/support/env.rb +58 -0
  69. data/test/rails_app/features/support/paths.rb +38 -0
  70. data/test/rails_app/lib/tasks/.gitkeep +0 -0
  71. data/test/rails_app/lib/tasks/cucumber.rake +53 -0
  72. data/test/rails_app/public/404.html +26 -0
  73. data/test/rails_app/public/422.html +26 -0
  74. data/test/rails_app/public/500.html +26 -0
  75. data/test/rails_app/public/images/rails.png +0 -0
  76. data/test/rails_app/public/javascripts/application.js +2 -0
  77. data/test/rails_app/public/javascripts/controls.js +965 -0
  78. data/test/rails_app/public/javascripts/dragdrop.js +974 -0
  79. data/test/rails_app/public/javascripts/effects.js +1123 -0
  80. data/test/rails_app/public/javascripts/prototype.js +4874 -0
  81. data/test/rails_app/public/javascripts/rails.js +118 -0
  82. data/test/rails_app/public/stylesheets/.gitkeep +0 -0
  83. data/test/rails_app/script/cucumber +10 -0
  84. data/test/rails_app/script/rails +6 -0
  85. data/test/rails_app/test/factories/users.rb +14 -0
  86. data/test/rails_app/test/functional/posts_controller_test.rb +58 -0
  87. data/test/rails_app/test/performance/browsing_test.rb +9 -0
  88. data/test/rails_app/test/test_helper.rb +36 -0
  89. data/test/rails_app/test/unit/helpers/posts_helper_test.rb +4 -0
  90. data/test/rails_app/test/unit/post_test.rb +4 -0
  91. data/test/rails_app/test/unit/user_test.rb +254 -0
  92. data/test/test_helper.rb +3 -0
  93. metadata +161 -0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Curtis Schiewek
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,187 @@
1
+ Devise LDAP Authenticatable
2
+ ===========================
3
+
4
+ **This fork honors a fix in net-ldap for the error [BerError: unsupported object type: id=139](https://github.com/ruby-ldap/ruby-net-ldap/issues/17).**
5
+
6
+ Devise LDAP Authenticatable is a LDAP based authentication strategy for the [Devise](http://github.com/plataformatec/devise) authentication framework.
7
+
8
+ If you are building applications for use within your organization which require authentication and you want to use LDAP, this plugin is for you.
9
+
10
+ For a screencast with an example application, please visit: [http://random-rails.blogspot.com/2010/07/ldap-authentication-with-devise.html](http://random-rails.blogspot.com/2010/07/ldap-authentication-with-devise.html)
11
+
12
+ **_Please Note_**
13
+
14
+ If you are using rails 2.x then use 0.1.x series of gem, and see the rails2 branch README for instructions.
15
+
16
+ Requirements
17
+ ------------
18
+
19
+ - An LDAP server (tested on OpenLDAP)
20
+ - Rails 3.0.0
21
+
22
+ These gems are dependencies of the gem:
23
+
24
+ - Devise ~> 1.4.0
25
+ - net-ldap ~> 0.2.2
26
+
27
+ Installation
28
+ ------------
29
+
30
+ **_Please Note_**
31
+
32
+ This will *only* work for Rails 3 applications.
33
+
34
+ In the Gemfile for your application:
35
+
36
+ gem "devise", "~> 1.4"
37
+ gem "devise_ldap_authenticatable"
38
+
39
+ To get the latest version, pull directly from github instead of the gem:
40
+
41
+ gem "devise_ldap_authenticatable", :git => "git://github.com/cschiewek/devise_ldap_authenticatable.git"
42
+
43
+
44
+ Setup
45
+ -----
46
+
47
+ Run the rails generators for devise (please check the [devise](http://github.com/plataformatec/devise) documents for further instructions)
48
+
49
+ rails generate devise:install
50
+ rails generate devise MODEL_NAME
51
+
52
+ Run the rails generator for devise_ldap_authenticatable
53
+
54
+ rails generate devise_ldap_authenticatable:install [options]
55
+
56
+ This will install the sample.yml, update the devise.rb initializer, and update your user model. There are some options you can pass to it:
57
+
58
+ Options:
59
+
60
+ [--user-model=USER_MODEL] # Model to update
61
+ # Default: user
62
+ [--update-model] # Update model to change from database_authenticatable to ldap_authenticatable
63
+ # Default: true
64
+ [--add-rescue] # Update Application Controller with resuce_from for DeviseLdapAuthenticatable::LdapException
65
+ # Default: true
66
+ [--advanced] # Add advanced config options to the devise initializer
67
+
68
+
69
+ Usage
70
+ -----
71
+
72
+ Devise LDAP Authenticatable works in replacement of Database Authenticatable
73
+
74
+ **_Please Note_**
75
+
76
+ This devise plugin has not been tested with DatabaseAuthenticatable enabled at the same time. This is meant as a drop in replacement for DatabaseAuthenticatable allowing for a semi single sign on approach.
77
+
78
+ The field that is used for logins is the first key that's configured in the `config/devise.rb` file under `config.authentication_keys`, which by default is email. For help changing this, please see the [Railscast](http://railscasts.com/episodes/210-customizing-devise) that goes through how to customize Devise.
79
+
80
+
81
+ Querying LDAP
82
+ ----------------
83
+
84
+ Given that ldap\_create\_user is set to true and you are authenticating with username, you can query an LDAP server for other attributes.
85
+
86
+ in your user model:
87
+
88
+ before_save :get_ldap_email
89
+
90
+ def get_ldap_email
91
+ self.email = Devise::LdapAdapter.get_ldap_param(self.username,"mail")
92
+ end
93
+
94
+
95
+ Configuration
96
+ -------------
97
+
98
+ In initializer `config/initializers/devise.rb` :
99
+
100
+ * ldap\_logger _(default: true)_
101
+ * If set to true, will log LDAP queries to the Rails logger.
102
+
103
+ * ldap\_create\_user _(default: false)_
104
+ * If set to true, all valid LDAP users will be allowed to login and an appropriate user record will be created.
105
+ If set to false, you will have to create the user record before they will be allowed to login.
106
+
107
+ * ldap\_config _(default: #{Rails.root}/config/ldap.yml)_
108
+ * Where to find the LDAP config file. Commented out to use the default, change if needed.
109
+
110
+ * ldap\_update\_password _(default: true)_
111
+ * When doing password resets, if true will update the LDAP server. Requires admin password in the ldap.yml
112
+
113
+ * ldap\_check\_group_membership _(default: false)_
114
+ * When set to true, the user trying to login will be checked to make sure they are in all of groups specified in the ldap.yml file.
115
+
116
+ * ldap\_check\_attributes _(default: false)_
117
+ * When set to true, the user trying to login will be checked to make sure they have all of the attributes in the ldap.yml file.
118
+
119
+ * ldap\_use\_admin\_to\_bind _(default: false)_
120
+ * When set to true, the admin user will be used to bind to the LDAP server during authentication.
121
+
122
+
123
+ Advanced Configuration
124
+ ----------------------
125
+
126
+ These parameters will be added to `config/initializers/devise.rb` when you pass the `--advanced` switch to the generator:
127
+
128
+ * ldap\_auth\_username\_builder _(default: `Proc.new() {|attribute, login, ldap| "#{attribute}=#{login},#{ldap.base}" }`)_
129
+ * You can pass a proc to the username option to explicitly specify the format that you search for a users' DN on your LDAP server.
130
+
131
+ Testing
132
+ -------
133
+
134
+ This has been tested using the following setup:
135
+
136
+ * Mac OSX 10.6
137
+ * OpenLDAP 2.4.11
138
+ * REE 1.8.7 (2010.02)
139
+
140
+ All unit and functional tests are part of a sample rails application under test/rails_app and requires a working LDAP sever.
141
+
142
+ Build / Start Instructions for Test LDAP Server
143
+ -----------------------------------------------
144
+
145
+ These instructions require the current directory context to be the `test/ldap` directory relative to the project root.
146
+
147
+ 1. To start the server, run `./run-server.sh`
148
+ 2. Add the basic structure: `ldapadd -x -h localhost -p 3389 -x -D "cn=admin,dc=test,dc=com" -w secret -f base.ldif`
149
+ * this creates the users / passwords:
150
+ * cn=admin,dc=test,com / secret
151
+ * cn=example.user@test.com,ou=people,dc=test,dc=com / secret
152
+ 3. You should now be able to run the tests in test/rails_app by running: `rake`
153
+
154
+ _For a LDAP server running SSL_
155
+
156
+ 1. To start the server, run: `./run-server.sh --ssl`
157
+ 2. Add the basic structure: `ldapadd -x -H ldaps://localhost:3389 -x -D "cn=admin,dc=test,dc=com" -w secret -f base.ldif`
158
+ * this creates the users / passwords:
159
+ * cn=admin,dc=test,com / secret
160
+ * cn=example.user@test.com,ou=people,dc=test,dc=com / secret
161
+ 3. You should now be able to run the tests in test/rails_app by running: `LDAP_SSL=true rake`
162
+
163
+ **_Please Note_**
164
+
165
+ In your system LDAP config file (on OSX it's /etc/openldap/ldap.conf) make sure you have the following setting:
166
+
167
+ TLS_REQCERT never
168
+
169
+ This will allow requests to go to the test LDAP server without being signed by a trusted root (it uses a self-signed cert)
170
+
171
+ References
172
+ ----------
173
+
174
+ * [OpenLDAP](http://www.openldap.org/)
175
+ * [Devise](http://github.com/plataformatec/devise)
176
+ * [Warden](http://github.com/hassox/warden)
177
+
178
+
179
+ TODO
180
+ ----
181
+
182
+ View on [Pivotal Tracker](http://www.pivotaltracker.com/projects/97318).
183
+
184
+ Released under the MIT license
185
+
186
+ Copyright (c) 2010 Curtis Schiewek, Daniel McNevin
187
+
data/Rakefile ADDED
@@ -0,0 +1,52 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
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
+ desc 'Generate documentation for the devise_ldap_authenticatable plugin.'
28
+ Rake::RDocTask.new(:rdoc) do |rdoc|
29
+ rdoc.rdoc_dir = 'rdoc'
30
+ rdoc.title = 'DeviseLDAPAuthenticatable'
31
+ rdoc.options << '--line-numbers' << '--inline-source'
32
+ rdoc.rdoc_files.include('README')
33
+ 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 "prathe_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
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.4.10
@@ -0,0 +1,133 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{prathe_devise_ldap_authenticatable}
8
+ s.version = "0.4.10"
9
+
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}
113
+ 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<prathe_net-ldap>, ["~> 0.2.2"])
124
+ else
125
+ s.add_dependency(%q<devise>, ["~> 1.4.0"])
126
+ s.add_dependency(%q<prathe_net-ldap>, ["~> 0.2.2"])
127
+ end
128
+ else
129
+ s.add_dependency(%q<devise>, ["~> 1.4.0"])
130
+ s.add_dependency(%q<prathe_net-ldap>, ["~> 0.2.2"])
131
+ end
132
+ end
133
+
@@ -0,0 +1,48 @@
1
+ # encoding: utf-8
2
+ require 'devise'
3
+
4
+ require 'devise_ldap_authenticatable/exception'
5
+ require 'devise_ldap_authenticatable/logger'
6
+ require 'devise_ldap_authenticatable/schema'
7
+ require 'devise_ldap_authenticatable/ldap_adapter'
8
+ require 'devise_ldap_authenticatable/routes'
9
+
10
+ # Get ldap information from config/ldap.yml now
11
+ module Devise
12
+ # Allow logging
13
+ mattr_accessor :ldap_logger
14
+ @@ldap_logger = true
15
+
16
+ # Add valid users to database
17
+ mattr_accessor :ldap_create_user
18
+ @@ldap_create_user = false
19
+
20
+ mattr_accessor :ldap_config
21
+ # @@ldap_config = "#{Rails.root}/config/ldap.yml"
22
+
23
+ mattr_accessor :ldap_update_password
24
+ @@ldap_update_password = true
25
+
26
+ mattr_accessor :ldap_check_group_membership
27
+ @@ldap_check_group_membership = false
28
+
29
+ mattr_accessor :ldap_check_attributes
30
+ @@ldap_check_role_attribute = false
31
+
32
+ mattr_accessor :ldap_use_admin_to_bind
33
+ @@ldap_use_admin_to_bind = false
34
+
35
+ mattr_accessor :ldap_auth_username_builder
36
+ @@ldap_auth_username_builder = Proc.new() {|attribute, login, ldap| "#{attribute}=#{login},#{ldap.base}" }
37
+
38
+ mattr_accessor :ldap_ad_group_check
39
+ @@ldap_ad_group_check = false
40
+ end
41
+
42
+ # Add ldap_authenticatable strategy to defaults.
43
+ #
44
+ Devise.add_module(:ldap_authenticatable,
45
+ :route => :session, ## This will add the routes, rather than in the routes.rb
46
+ :strategy => true,
47
+ :controller => :sessions,
48
+ :model => 'devise_ldap_authenticatable/model')