devise_ldap_authenticatable 0.8.6 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +15 -11
- data/lib/devise_ldap_authenticatable/ldap/connection.rb +3 -0
- data/lib/devise_ldap_authenticatable/version.rb +1 -1
- data/spec/rails_app/db/migrate/20100708120448_devise_create_users.rb +1 -1
- data/spec/rails_app/db/schema.rb +12 -14
- data/spec/unit/connection_spec.rb +18 -0
- metadata +4 -76
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7044550949ddebd6ea7cc11cf8ed2256b892f2c27dd2fc316a7c5a2b4bdcf685
|
4
|
+
data.tar.gz: ba36af309f585a37a6e2775810b62bc95a4c5d4203e9b2f7d174418c20a39e07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d076e9ed84c61fc77dfd9f7006b594a2c841a600491d3b0c92d5bde42832b4df3324ebbb6df447221078f3d0dd5b91540d2882cec2c1e9d41bc5c84117a019e6
|
7
|
+
data.tar.gz: 9f2f642e37bf8a51db04a01aa58d93f96ceea8daf91ef7b0af3e0357c5289962c4e583aef57fb10a1f496b55d54012176b42086a3e417e482932733ace47b40f
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
Devise LDAP Authenticatable
|
2
2
|
===========================
|
3
|
-
|
4
|
-
[![
|
5
|
-
[![
|
3
|
+
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/devise_ldap_authenticatable.svg)](http://badge.fury.io/rb/devise_ldap_authenticatable)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/cschiewek/devise_ldap_authenticatable.svg)](https://codeclimate.com/github/cschiewek/devise_ldap_authenticatable)
|
6
6
|
|
7
7
|
Devise LDAP Authenticatable is a LDAP based authentication strategy for the [Devise](http://github.com/plataformatec/devise) authentication framework.
|
8
8
|
|
@@ -25,12 +25,14 @@ Usage
|
|
25
25
|
-----
|
26
26
|
In the Gemfile for your application:
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
```ruby
|
29
|
+
gem "devise_ldap_authenticatable"
|
30
|
+
```
|
30
31
|
To get the latest version, pull directly from github instead of the gem:
|
31
32
|
|
32
|
-
|
33
|
-
|
33
|
+
```ruby
|
34
|
+
gem "devise_ldap_authenticatable", :git => "git://github.com/cschiewek/devise_ldap_authenticatable.git"
|
35
|
+
```
|
34
36
|
|
35
37
|
Setup
|
36
38
|
-----
|
@@ -61,9 +63,11 @@ Given that `ldap_create_user` is set to true and you are authenticating with use
|
|
61
63
|
|
62
64
|
in your user model you have to simply define `ldap_before_save` method:
|
63
65
|
|
64
|
-
|
65
|
-
|
66
|
-
|
66
|
+
```ruby
|
67
|
+
def ldap_before_save
|
68
|
+
self.email = Devise::LDAP::Adapter.get_ldap_param(self.username,"mail").first
|
69
|
+
end
|
70
|
+
```
|
67
71
|
|
68
72
|
Configuration
|
69
73
|
-------------
|
@@ -99,7 +103,7 @@ These parameters will be added to `config/initializers/devise.rb` when you pass
|
|
99
103
|
|
100
104
|
Troubleshooting
|
101
105
|
--------------
|
102
|
-
**Using a "username" instead of an "email":** The field that is used for logins is the first key that's configured in the `config/initializers/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. Also, this [documentation](https://github.com/plataformatec/devise/wiki/How-To%3a-Allow-users-to-sign-in-using-their-username-or-email-address) from Devise can very helpful.
|
106
|
+
**Using a "username" instead of an "email":** The field that is used for logins is the first key that's configured in the `config/initializers/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. Also, this [documentation](https://github.com/plataformatec/devise/wiki/How-To%3a-Allow-users-to-sign-in-using-their-username-or-email-address) from Devise can be very helpful.
|
103
107
|
|
104
108
|
**SSL certificate invalid:** If you're using a test LDAP server running a self-signed SSL certificate, make sure the appropriate root certificate is installed on your system. Alternately, you may temporarily disable certificate checking for SSL by modifying your system LDAP configuration (e.g., `/etc/openldap/ldap.conf` or `/etc/ldap/ldap.conf`) to read `TLS_REQCERT never`.
|
105
109
|
|
@@ -10,8 +10,11 @@ module Devise
|
|
10
10
|
ldap_config = YAML.load(ERB.new(File.read(::Devise.ldap_config || "#{Rails.root}/config/ldap.yml")).result)[Rails.env]
|
11
11
|
end
|
12
12
|
ldap_options = params
|
13
|
+
|
14
|
+
# Allow `ssl: true` shorthand in YAML, but enable more control with `encryption`
|
13
15
|
ldap_config["ssl"] = :simple_tls if ldap_config["ssl"] === true
|
14
16
|
ldap_options[:encryption] = ldap_config["ssl"].to_sym if ldap_config["ssl"]
|
17
|
+
ldap_options[:encryption] = ldap_config["encryption"] if ldap_config["encryption"]
|
15
18
|
|
16
19
|
@ldap = Net::LDAP.new(ldap_options)
|
17
20
|
@ldap.host = ldap_config["host"]
|
data/spec/rails_app/db/schema.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
# This file is auto-generated from the current state of the database. Instead
|
3
2
|
# of editing this file, please use the migrations feature of Active Record to
|
4
3
|
# incrementally modify your database, and then regenerate this schema definition.
|
@@ -13,23 +12,22 @@
|
|
13
12
|
|
14
13
|
ActiveRecord::Schema.define(version: 20100708120448) do
|
15
14
|
|
16
|
-
create_table "users", force:
|
17
|
-
t.string
|
18
|
-
t.string
|
19
|
-
t.string
|
15
|
+
create_table "users", force: :cascade do |t|
|
16
|
+
t.string "email", default: "", null: false
|
17
|
+
t.string "encrypted_password", default: "", null: false
|
18
|
+
t.string "reset_password_token"
|
20
19
|
t.datetime "reset_password_sent_at"
|
21
20
|
t.datetime "remember_created_at"
|
22
|
-
t.integer
|
21
|
+
t.integer "sign_in_count", default: 0
|
23
22
|
t.datetime "current_sign_in_at"
|
24
23
|
t.datetime "last_sign_in_at"
|
25
|
-
t.string
|
26
|
-
t.string
|
27
|
-
t.string
|
28
|
-
t.datetime "created_at"
|
29
|
-
t.datetime "updated_at"
|
24
|
+
t.string "current_sign_in_ip"
|
25
|
+
t.string "last_sign_in_ip"
|
26
|
+
t.string "uid"
|
27
|
+
t.datetime "created_at", null: false
|
28
|
+
t.datetime "updated_at", null: false
|
29
|
+
t.index ["email"], name: "index_users_on_email", unique: true
|
30
|
+
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
30
31
|
end
|
31
32
|
|
32
|
-
add_index "users", ["email"], name: "index_users_on_email", unique: true
|
33
|
-
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
34
|
-
|
35
33
|
end
|
@@ -12,6 +12,24 @@ describe 'Connection' do
|
|
12
12
|
expect(connection.ldap.base).to eq('ou=testbase,dc=test,dc=com')
|
13
13
|
end
|
14
14
|
|
15
|
+
it 'allows encryption options to be set in ldap_config' do
|
16
|
+
::Devise.ldap_config = Proc.new() {{
|
17
|
+
'host' => 'localhost',
|
18
|
+
'port' => 3389,
|
19
|
+
'base' => 'ou=testbase,dc=test,dc=com',
|
20
|
+
'attribute' => 'cn',
|
21
|
+
'encryption' => {
|
22
|
+
:method => :simple_tls,
|
23
|
+
:tls_options => OpenSSL::SSL::SSLContext::DEFAULT_PARAMS
|
24
|
+
}
|
25
|
+
}}
|
26
|
+
connection = Devise::LDAP::Connection.new()
|
27
|
+
expect(connection.ldap.instance_variable_get(:@encryption)).to eq({
|
28
|
+
:method => :simple_tls,
|
29
|
+
:tls_options => OpenSSL::SSL::SSLContext::DEFAULT_PARAMS
|
30
|
+
})
|
31
|
+
end
|
32
|
+
|
15
33
|
class TestOpResult
|
16
34
|
attr_accessor :error_message
|
17
35
|
end
|
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.8.
|
4
|
+
version: 0.8.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Curtis Schiewek
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-07-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: devise
|
@@ -293,80 +293,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
293
293
|
- !ruby/object:Gem::Version
|
294
294
|
version: '0'
|
295
295
|
requirements: []
|
296
|
-
|
297
|
-
rubygems_version: 2.6.11
|
296
|
+
rubygems_version: 3.1.2
|
298
297
|
signing_key:
|
299
298
|
specification_version: 4
|
300
299
|
summary: Devise extension to allow authentication via LDAP
|
301
|
-
test_files:
|
302
|
-
- spec/ldap/.gitignore
|
303
|
-
- spec/ldap/base.ldif
|
304
|
-
- spec/ldap/clear.ldif
|
305
|
-
- spec/ldap/local.schema
|
306
|
-
- spec/ldap/openldap-data/.gitignore
|
307
|
-
- spec/ldap/openldap-data/run/.gitignore
|
308
|
-
- spec/ldap/openldap-data/run/.gitkeep
|
309
|
-
- spec/ldap/run-server
|
310
|
-
- spec/ldap/server.pem
|
311
|
-
- spec/ldap/slapd-test.conf.erb
|
312
|
-
- spec/rails_app/Rakefile
|
313
|
-
- spec/rails_app/app/controllers/application_controller.rb
|
314
|
-
- spec/rails_app/app/controllers/posts_controller.rb
|
315
|
-
- spec/rails_app/app/helpers/application_helper.rb
|
316
|
-
- spec/rails_app/app/helpers/posts_helper.rb
|
317
|
-
- spec/rails_app/app/models/post.rb
|
318
|
-
- spec/rails_app/app/models/user.rb
|
319
|
-
- spec/rails_app/app/views/layouts/application.html.erb
|
320
|
-
- spec/rails_app/app/views/posts/index.html.erb
|
321
|
-
- spec/rails_app/config.ru
|
322
|
-
- spec/rails_app/config/application.rb
|
323
|
-
- spec/rails_app/config/boot.rb
|
324
|
-
- spec/rails_app/config/cucumber.yml
|
325
|
-
- spec/rails_app/config/database.yml
|
326
|
-
- spec/rails_app/config/environment.rb
|
327
|
-
- spec/rails_app/config/environments/development.rb
|
328
|
-
- spec/rails_app/config/environments/production.rb
|
329
|
-
- spec/rails_app/config/environments/test.rb
|
330
|
-
- spec/rails_app/config/initializers/backtrace_silencers.rb
|
331
|
-
- spec/rails_app/config/initializers/devise.rb
|
332
|
-
- spec/rails_app/config/initializers/inflections.rb
|
333
|
-
- spec/rails_app/config/initializers/mime_types.rb
|
334
|
-
- spec/rails_app/config/initializers/secret_token.rb
|
335
|
-
- spec/rails_app/config/initializers/session_store.rb
|
336
|
-
- spec/rails_app/config/ldap.yml
|
337
|
-
- spec/rails_app/config/ldap_with_boolean_ssl.yml
|
338
|
-
- spec/rails_app/config/ldap_with_erb.yml
|
339
|
-
- spec/rails_app/config/ldap_with_uid.yml
|
340
|
-
- spec/rails_app/config/locales/devise.en.yml
|
341
|
-
- spec/rails_app/config/locales/en.yml
|
342
|
-
- spec/rails_app/config/routes.rb
|
343
|
-
- spec/rails_app/config/ssl_ldap.yml
|
344
|
-
- spec/rails_app/config/ssl_ldap_with_erb.yml
|
345
|
-
- spec/rails_app/config/ssl_ldap_with_uid.yml
|
346
|
-
- spec/rails_app/db/migrate/20100708120448_devise_create_users.rb
|
347
|
-
- spec/rails_app/db/schema.rb
|
348
|
-
- spec/rails_app/features/manage_logins.feature
|
349
|
-
- spec/rails_app/features/step_definitions/login_steps.rb
|
350
|
-
- spec/rails_app/features/step_definitions/web_steps.rb
|
351
|
-
- spec/rails_app/features/support/env.rb
|
352
|
-
- spec/rails_app/features/support/paths.rb
|
353
|
-
- spec/rails_app/lib/tasks/.gitkeep
|
354
|
-
- spec/rails_app/lib/tasks/cucumber.rake
|
355
|
-
- spec/rails_app/public/404.html
|
356
|
-
- spec/rails_app/public/422.html
|
357
|
-
- spec/rails_app/public/500.html
|
358
|
-
- spec/rails_app/public/images/rails.png
|
359
|
-
- spec/rails_app/public/javascripts/application.js
|
360
|
-
- spec/rails_app/public/javascripts/controls.js
|
361
|
-
- spec/rails_app/public/javascripts/dragdrop.js
|
362
|
-
- spec/rails_app/public/javascripts/effects.js
|
363
|
-
- spec/rails_app/public/javascripts/prototype.js
|
364
|
-
- spec/rails_app/public/javascripts/rails.js
|
365
|
-
- spec/rails_app/public/stylesheets/.gitkeep
|
366
|
-
- spec/rails_app/script/cucumber
|
367
|
-
- spec/rails_app/script/rails
|
368
|
-
- spec/spec_helper.rb
|
369
|
-
- spec/support/factories.rb
|
370
|
-
- spec/unit/adapter_spec.rb
|
371
|
-
- spec/unit/connection_spec.rb
|
372
|
-
- spec/unit/user_spec.rb
|
300
|
+
test_files: []
|