devise_ldap_authenticatable 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -7,15 +7,19 @@ If you are building applications for use within your organization which require
7
7
 
8
8
  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)
9
9
 
10
+ **_Please Note_**
11
+
12
+ If you are using rails 2.x then use 0.1.x series of gem, and see the rails2 branch README for instructions.
13
+
10
14
  Requirements
11
15
  ------------
12
16
 
13
17
  - An LDAP server (tested on OpenLDAP)
14
- - Rails 3.0.0.beta4
18
+ - Rails 3.0.0.rc
15
19
 
16
20
  These gems are dependencies of the gem:
17
21
 
18
- - Devise 1.1.rc2
22
+ - Devise 1.1.1
19
23
  - net-ldap 0.1.1
20
24
 
21
25
  Installation
@@ -27,12 +31,12 @@ This will *only* work for Rails 3 applications.
27
31
 
28
32
  In the Gemfile for your application:
29
33
 
30
- gem "devise", "1.1.rc2"
31
- gem "devise_ldap_authenticatable", "0.4.2"
34
+ gem "devise", "1.1.1"
35
+ gem "devise_ldap_authenticatable", "0.4.3"
32
36
 
33
37
  To get the latest version, pull directly from github instead of the gem:
34
38
 
35
- gem "devise_ldap_authenticatable", :git => "git://github.com/cschiewek/devise_ldap_authenticatable.git", :branch => "rails3"
39
+ gem "devise_ldap_authenticatable", :git => "git://github.com/cschiewek/devise_ldap_authenticatable.git"
36
40
 
37
41
 
38
42
  Setup
@@ -101,7 +105,36 @@ This has been tested using the following setup:
101
105
  * OpenLDAP 2.4.11
102
106
  * REE 1.8.7 (2010.02)
103
107
 
104
- All unit and functional tests are part of a sample rails application under test/rails_app and requires a working LDAP sever. There are config files and setup instructions under test/ldap
108
+ All unit and functional tests are part of a sample rails application under test/rails_app and requires a working LDAP sever.
109
+
110
+ Build / Start Instructions for Test LDAP Server
111
+ -----------------------------------------------
112
+
113
+ Make sure that directories test/ldap/openldap-data and test/ldap/openldap-data/run exist.
114
+
115
+ 1. To start the server, run `./run_server.sh`
116
+ 2. Add the basic structure: `ldapadd -x -h localhost -p 3389 -x -D "cn=admin,dc=test,dc=com" -w secret -f base.ldif`
117
+ * this creates the users / passwords:
118
+ * cn=admin,dc=test,com / secret
119
+ * cn=example.user@test.com,ou=people,dc=test,dc=com / secret
120
+ 3. You should now be able to run the tests in test/rails_app by running: `rake`
121
+
122
+ _For a LDAP server running SSL_
123
+
124
+ 1. To start the server, run: `./run_server.sh --ssl`
125
+ 2. Add the basic structure: `ldapadd -x -H ldaps://localhost:3389 -x -D "cn=admin,dc=test,dc=com" -w secret -f base.ldif`
126
+ * this creates the users / passwords:
127
+ * cn=admin,dc=test,com / secret
128
+ * cn=example.user@test.com,ou=people,dc=test,dc=com / secret
129
+ 3. You should now be able to run the tests in test/rails_app by running: `LDAP_SSL=true rake`
130
+
131
+ **_Please Note_**
132
+
133
+ In your system LDAP config file (on OSX it's /etc/openldap/ldap.conf) make sure you have the following setting:
134
+
135
+ TLS_REQCERT never
136
+
137
+ This will allow requests to go to the test LDAP server without being signed by a trusted root (it uses a self-signed cert)
105
138
 
106
139
  References
107
140
  ----------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.2
1
+ 0.4.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{devise_ldap_authenticatable}
8
- s.version = "0.4.2"
8
+ s.version = "0.4.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Curtis Schiewek", "Daniel McNevin"]
12
- s.date = %q{2010-08-03}
12
+ s.date = %q{2010-08-05}
13
13
  s.description = %q{LDAP authentication module for Devise}
14
14
  s.email = %q{curtis.schiewek@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -39,8 +39,11 @@ Gem::Specification.new do |s|
39
39
  "test/ldap/clear.ldif",
40
40
  "test/ldap/local.schema",
41
41
  "test/ldap/run-server.sh",
42
+ "test/ldap/server.pem",
43
+ "test/ldap/slapd-ssl-test.conf",
42
44
  "test/ldap/slapd-test.conf",
43
45
  "test/rails_app/Gemfile",
46
+ "test/rails_app/Gemfile.lock",
44
47
  "test/rails_app/Rakefile",
45
48
  "test/rails_app/app/controllers/application_controller.rb",
46
49
  "test/rails_app/app/controllers/posts_controller.rb",
@@ -66,10 +69,14 @@ Gem::Specification.new do |s|
66
69
  "test/rails_app/config/initializers/secret_token.rb",
67
70
  "test/rails_app/config/initializers/session_store.rb",
68
71
  "test/rails_app/config/ldap.yml",
72
+ "test/rails_app/config/ldap_with_erb.yml",
69
73
  "test/rails_app/config/ldap_with_uid.yml",
70
74
  "test/rails_app/config/locales/devise.en.yml",
71
75
  "test/rails_app/config/locales/en.yml",
72
76
  "test/rails_app/config/routes.rb",
77
+ "test/rails_app/config/ssl_ldap.yml",
78
+ "test/rails_app/config/ssl_ldap_with_erb.yml",
79
+ "test/rails_app/config/ssl_ldap_with_uid.yml",
73
80
  "test/rails_app/db/migrate/20100708120302_create_posts.rb",
74
81
  "test/rails_app/db/migrate/20100708120448_devise_create_users.rb",
75
82
  "test/rails_app/db/schema.rb",
@@ -26,10 +26,11 @@ module Devise
26
26
  attr_reader :ldap, :login
27
27
 
28
28
  def initialize(params = {})
29
- ldap_config = YAML.load_file(::Devise.ldap_config || "#{Rails.root}/config/ldap.yml")[Rails.env]
29
+ ldap_config = YAML.load(ERB.new(File.read(::Devise.ldap_config || "#{Rails.root}/config/ldap.yml")).result)[Rails.env]
30
+ ldap_options = params
30
31
  ldap_options[:encryption] = :simple_tls if ldap_config["ssl"]
31
32
 
32
- @ldap = Net::LDAP.new # (ldap_options)
33
+ @ldap = Net::LDAP.new(ldap_options)
33
34
  @ldap.host = ldap_config["host"]
34
35
  @ldap.port = ldap_config["port"]
35
36
  @ldap.base = ldap_config["base"]
@@ -40,7 +41,7 @@ module Devise
40
41
  @required_attributes = ldap_config["require_attribute"]
41
42
 
42
43
  @ldap.auth ldap_config["admin_user"], ldap_config["admin_password"] if params[:admin]
43
-
44
+
44
45
  @login = params[:login]
45
46
  @password = params[:password]
46
47
  @new_password = params[:new_password]
@@ -1,4 +1,4 @@
1
1
  module DeviseLdapAuthenticatable
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
4
4
 
@@ -1,4 +1,10 @@
1
+ #!/usr/bin/env bash
2
+
1
3
  ## For OSX:
2
4
  PATH=$PATH:/usr/libexec
3
5
 
4
- slapd -d 1 -f slapd-test.conf -h ldap://localhost:3389
6
+ if [[ $1 == "--ssl" ]]; then
7
+ slapd -d 1 -f slapd-ssl-test.conf -h ldaps://localhost:3389
8
+ else
9
+ slapd -d 1 -f slapd-test.conf -h ldap://localhost:3389
10
+ fi
@@ -0,0 +1,38 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIICXQIBAAKBgQC/hxFetCTh++3sEwchxuscH5TID0Wj2S/heBjY6RuK5rPrAcUg
3
+ rA7jFEFilEQYpfGe3LIMBkr5pP4aR1NrLuvKZaHuBvRLwOcU7SbuFQ3FQLaJA3UK
4
+ E2IOH9wMg1BMcG1WbzB1nKc650omKo7KqOAIYFFVq3gzlDRUmHF6dCAnvwIDAQAB
5
+ AoGAcOBJfGbu1cCEF/2e1mlFZu214bIeeNInRdphynSXpuUQZBBG/Vpp66qkXlTD
6
+ TUN/gwDObgfHaBm1KAehQioFC9ys1Iymlt8IeRYXH9Tkl7URe30QGAGjdIPohWpZ
7
+ xl/aMrpQVvQukaStRNoJXA32j+tuR2KbxAK6bu9iLzXvCQECQQD6AOzHVDB06ZjF
8
+ iJYB1/CyZBg0Q2aIOwGXwle1t1O7q6nJ6UWkurQF/inBdJdE5SWNEzYsI1tEP0n2
9
+ 1ZBIWQxtAkEAxB8WgFjRqYdmUYGQ1k8yxMUTLbZFd6t2UZyB/LAw9CtjH9lrU0z9
10
+ 81UK/ywVHkoDDPHbFyvd1jludqbz+suRWwJBAPEL9UCXfwUquf8zm5b5cv09n0y8
11
+ 895ELlv5qQHvWg+oC1Q/08NptOvWTMJXPQbTfepQ7LmP+Y6LCzCwZ6YqHd0CQFiW
12
+ flB9Tj9YhNQ+RVE4twMAzhfw5FIY5joZCvI8F/DDBGRnjj4zYeafPHdkzyk+X0Bi
13
+ owdFblAM4yO/aCeZ+k8CQQDdBi+WnpaaSL0NXmAb6+7aQRZ/Gc2O9S2JL/Fxw4EQ
14
+ i7KTRdH/d6Db9SeQEc/uCbJW7fM4KbZcjFdncHFytakt
15
+ -----END RSA PRIVATE KEY-----
16
+ -----BEGIN CERTIFICATE-----
17
+ MIIDwjCCAyugAwIBAgIJAP+plC/uCHKkMA0GCSqGSIb3DQEBBQUAMIGdMQswCQYD
18
+ VQQGEwJVUzERMA8GA1UECBMIVmlyZ2luaWExEzARBgNVBAcTCkFsZXhhbmRyaWEx
19
+ DTALBgNVBAoTBFRlc3QxDTALBgNVBAsTBFRlc3QxJDAiBgNVBAMUG2RldmlzZV9s
20
+ ZGFwX2F1dGhlbnRpY2F0YWJsZTEiMCAGCSqGSIb3DQEJARYTZHBtY25ldmluQGdt
21
+ YWlsLmNvbTAeFw0xMDA4MDUyMTU1MDVaFw0xMTA4MDUyMTU1MDVaMIGdMQswCQYD
22
+ VQQGEwJVUzERMA8GA1UECBMIVmlyZ2luaWExEzARBgNVBAcTCkFsZXhhbmRyaWEx
23
+ DTALBgNVBAoTBFRlc3QxDTALBgNVBAsTBFRlc3QxJDAiBgNVBAMUG2RldmlzZV9s
24
+ ZGFwX2F1dGhlbnRpY2F0YWJsZTEiMCAGCSqGSIb3DQEJARYTZHBtY25ldmluQGdt
25
+ YWlsLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAv4cRXrQk4fvt7BMH
26
+ IcbrHB+UyA9Fo9kv4XgY2Okbiuaz6wHFIKwO4xRBYpREGKXxntyyDAZK+aT+GkdT
27
+ ay7rymWh7gb0S8DnFO0m7hUNxUC2iQN1ChNiDh/cDINQTHBtVm8wdZynOudKJiqO
28
+ yqjgCGBRVat4M5Q0VJhxenQgJ78CAwEAAaOCAQYwggECMB0GA1UdDgQWBBRcCNxq
29
+ 0PNXgMfYN2RQ2uIrBY03ADCB0gYDVR0jBIHKMIHHgBRcCNxq0PNXgMfYN2RQ2uIr
30
+ BY03AKGBo6SBoDCBnTELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMRMw
31
+ EQYDVQQHEwpBbGV4YW5kcmlhMQ0wCwYDVQQKEwRUZXN0MQ0wCwYDVQQLEwRUZXN0
32
+ MSQwIgYDVQQDFBtkZXZpc2VfbGRhcF9hdXRoZW50aWNhdGFibGUxIjAgBgkqhkiG
33
+ 9w0BCQEWE2RwbWNuZXZpbkBnbWFpbC5jb22CCQD/qZQv7ghypDAMBgNVHRMEBTAD
34
+ AQH/MA0GCSqGSIb3DQEBBQUAA4GBABjztpAgr6QxVCNxhgklrILH+RLxww3dgdra
35
+ J6C6pXl9lbM+XIWiUtzD3Y8z2+tkJtjWCCN7peM2OYFvdChIvRz8XoxHqNB9W8wj
36
+ xZOqBHN8MdI1g6PCD5Z8lK1TDvchTeskqCulE6tMHKaslByhfZS94uWY+NG5JY/Z
37
+ traWmtWh
38
+ -----END CERTIFICATE-----
@@ -0,0 +1,107 @@
1
+ #
2
+ # See slapd.conf(5) for details on configuration options.
3
+ # This file should NOT be world readable.
4
+ #
5
+ include /etc/openldap/schema/core.schema
6
+ include /etc/openldap/schema/cosine.schema
7
+ include /etc/openldap/schema/inetorgperson.schema
8
+ include /etc/openldap/schema/nis.schema
9
+
10
+ ## Local definitions
11
+ # include /etc/openldap/schema/local.schema
12
+ include local.schema
13
+
14
+ # Allow LDAPv2 client connections. This is NOT the default.
15
+ allow bind_v2
16
+
17
+ # Do not enable referrals until AFTER you have a working directory
18
+ # service AND an understanding of referrals.
19
+ #referral ldap://root.openldap.org
20
+
21
+ pidfile openldap-data/run/slapd.pid
22
+ argsfile openldap-data/run/slapd.args
23
+
24
+ # Load dynamic backend modules:
25
+ modulepath /usr/lib/openldap
26
+
27
+ # modules available in openldap-servers-overlays RPM package:
28
+ # moduleload accesslog.la
29
+ # moduleload auditlog.la
30
+ # moduleload denyop.la
31
+ # moduleload dyngroup.la
32
+ # moduleload dynlist.la
33
+ # moduleload lastmod.la
34
+ # moduleload pcache.la
35
+ # moduleload ppolicy.la
36
+ # moduleload refint.la
37
+ # moduleload retcode.la
38
+ # moduleload rwm.la
39
+ # moduleload smbk5pwd.la
40
+ # moduleload syncprov.la
41
+ # moduleload translucent.la
42
+ # moduleload unique.la
43
+ # moduleload valsort.la
44
+
45
+ # modules available in openldap-servers-sql RPM package:
46
+ # moduleload back_sql.la
47
+
48
+ # The next three lines allow use of TLS for encrypting connections using a
49
+ # dummy test certificate which you can generate by changing to
50
+ # /etc/pki/tls/certs, running "make slapd.pem", and fixing permissions on
51
+ # slapd.pem so that the ldap user or group can read it. Your client software
52
+ # may balk at self-signed certificates, however.
53
+
54
+ ## For LDAPS
55
+ TLSCACertificateFile server.pem
56
+ TLSCertificateFile server.pem
57
+ TLSCertificateKeyFile server.pem
58
+
59
+ # TLSVerifyClient never
60
+
61
+ # Sample security restrictions
62
+ # Require integrity protection (prevent hijacking)
63
+ # Require 112-bit (3DES or better) encryption for updates
64
+ # Require 63-bit encryption for simple bind
65
+ # security ssf=1 update_ssf=112 simple_bind=64
66
+
67
+ # Sample access control policy:
68
+ # Root DSE: allow anyone to read it
69
+ # Subschema (sub)entry DSE: allow anyone to read it
70
+ # Other DSEs:
71
+ # Allow self write access
72
+ # Allow authenticated users read access
73
+ # Allow anonymous users to authenticate
74
+ # Directives needed to implement policy:
75
+
76
+ # access to dn.base="dc=esc" by * read
77
+ # access to dn.base="cn=Subschema" by * read
78
+ access to *
79
+ by self write
80
+ by * read
81
+ by anonymous auth
82
+
83
+ #
84
+ # if no access controls are present, the default policy
85
+ # allows anyone and everyone to read anything but restricts
86
+ # updates to rootdn. (e.g., "access to * by * read")
87
+ #
88
+ # rootdn can always read and write EVERYTHING!
89
+
90
+ #######################################################################
91
+ # ldbm and/or bdb database definitions
92
+ #######################################################################
93
+
94
+ database bdb
95
+
96
+ suffix "dc=test,dc=com"
97
+ directory openldap-data
98
+ rootdn "cn=admin,dc=test,dc=com"
99
+ ## rootpw = secret
100
+ rootpw {SSHA}fFjKcZb4cfOAcwSjJer8nCGOEVRUnwCC
101
+
102
+ # Indices to maintain for this database
103
+ index objectClass eq,pres
104
+ index ou,cn,mail,surname,givenname eq,pres,sub
105
+ index uidNumber,gidNumber,loginShell eq,pres
106
+ index uid,memberUid eq,pres,sub
107
+ index nisMapName,nisMapEntry eq,pres,sub
@@ -51,10 +51,11 @@ modulepath /usr/lib/openldap
51
51
  # slapd.pem so that the ldap user or group can read it. Your client software
52
52
  # may balk at self-signed certificates, however.
53
53
 
54
- # TLSCACertificateFile /etc/pki/tls/certs/ca-bundle.crt
55
- # TLSCertificateFile /etc/pki/tls/certs/slapd.pem
56
- # TLSCertificateKeyFile /etc/pki/tls/certs/slapd.pem
57
-
54
+ # ## For LDAPS
55
+ # TLSCACertificateFile server.pem
56
+ # TLSCertificateFile server.pem
57
+ # TLSCertificateKeyFile server.pem
58
+ #
58
59
  # TLSVerifyClient demand
59
60
 
60
61
  # Sample security restrictions
@@ -3,7 +3,7 @@ source 'http://rubygems.org'
3
3
  gem 'rails', '3.0.0.rc'
4
4
  gem 'sqlite3-ruby', :require => 'sqlite3'
5
5
 
6
- gem "devise", "1.1.rc2"
6
+ gem "devise", "1.1.1"
7
7
  gem "devise_ldap_authenticatable", :path => "../../"
8
8
 
9
9
  group :test do
@@ -0,0 +1,157 @@
1
+ PATH
2
+ remote: /Users/dpmcnevin/Rails/devise_ldap_authenticatable
3
+ specs:
4
+ devise_ldap_authenticatable (0.4.2)
5
+ devise (> 1.0.4)
6
+ net-ldap (>= 0.1.1)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ ZenTest (4.3.3)
12
+ abstract (1.0.0)
13
+ actionmailer (3.0.0.rc)
14
+ actionpack (= 3.0.0.rc)
15
+ mail (~> 2.2.5)
16
+ actionpack (3.0.0.rc)
17
+ activemodel (= 3.0.0.rc)
18
+ activesupport (= 3.0.0.rc)
19
+ builder (~> 2.1.2)
20
+ erubis (~> 2.6.6)
21
+ i18n (~> 0.4.1)
22
+ rack (~> 1.2.1)
23
+ rack-mount (~> 0.6.9)
24
+ rack-test (~> 0.5.4)
25
+ tzinfo (~> 0.3.22)
26
+ activemodel (3.0.0.rc)
27
+ activesupport (= 3.0.0.rc)
28
+ builder (~> 2.1.2)
29
+ i18n (~> 0.4.1)
30
+ activerecord (3.0.0.rc)
31
+ activemodel (= 3.0.0.rc)
32
+ activesupport (= 3.0.0.rc)
33
+ arel (~> 0.4.0)
34
+ tzinfo (~> 0.3.22)
35
+ activeresource (3.0.0.rc)
36
+ activemodel (= 3.0.0.rc)
37
+ activesupport (= 3.0.0.rc)
38
+ activesupport (3.0.0.rc)
39
+ arel (0.4.0)
40
+ activesupport (>= 3.0.0.beta)
41
+ autotest (4.3.2)
42
+ autotest-growl (0.2.4)
43
+ autotest (>= 4.2.4)
44
+ autotest-rails (4.1.0)
45
+ ZenTest
46
+ bcrypt-ruby (2.1.2)
47
+ builder (2.1.2)
48
+ capybara (0.3.9)
49
+ culerity (>= 0.2.4)
50
+ mime-types (>= 1.16)
51
+ nokogiri (>= 1.3.3)
52
+ rack (>= 1.0.0)
53
+ rack-test (>= 0.5.4)
54
+ selenium-webdriver (>= 0.0.3)
55
+ columnize (0.3.1)
56
+ configuration (1.1.0)
57
+ cucumber (0.8.5)
58
+ builder (~> 2.1.2)
59
+ diff-lcs (~> 1.1.2)
60
+ gherkin (~> 2.1.4)
61
+ json_pure (~> 1.4.3)
62
+ term-ansicolor (~> 1.0.4)
63
+ cucumber-rails (0.3.2)
64
+ cucumber (>= 0.8.0)
65
+ culerity (0.2.10)
66
+ database_cleaner (0.5.2)
67
+ devise (1.1.1)
68
+ bcrypt-ruby (~> 2.1.2)
69
+ warden (~> 0.10.7)
70
+ diff-lcs (1.1.2)
71
+ erubis (2.6.6)
72
+ abstract (>= 1.0.0)
73
+ factory_girl (1.3.1)
74
+ factory_girl_rails (1.0)
75
+ factory_girl (~> 1.3)
76
+ rails (>= 3.0.0.beta4)
77
+ ffi (0.6.3)
78
+ rake (>= 0.8.7)
79
+ gherkin (2.1.5)
80
+ trollop (~> 1.16.2)
81
+ i18n (0.4.1)
82
+ json_pure (1.4.3)
83
+ launchy (0.3.7)
84
+ configuration (>= 0.0.5)
85
+ rake (>= 0.8.1)
86
+ linecache (0.43)
87
+ mail (2.2.5)
88
+ activesupport (>= 2.3.6)
89
+ mime-types
90
+ treetop (>= 1.4.5)
91
+ mime-types (1.16)
92
+ mocha (0.9.8)
93
+ rake
94
+ net-ldap (0.1.1)
95
+ nokogiri (1.4.3.1)
96
+ polyglot (0.3.1)
97
+ rack (1.2.1)
98
+ rack-mount (0.6.9)
99
+ rack (>= 1.0.0)
100
+ rack-test (0.5.4)
101
+ rack (>= 1.0)
102
+ rails (3.0.0.rc)
103
+ actionmailer (= 3.0.0.rc)
104
+ actionpack (= 3.0.0.rc)
105
+ activerecord (= 3.0.0.rc)
106
+ activeresource (= 3.0.0.rc)
107
+ activesupport (= 3.0.0.rc)
108
+ bundler (>= 1.0.0.rc.1)
109
+ railties (= 3.0.0.rc)
110
+ railties (3.0.0.rc)
111
+ actionpack (= 3.0.0.rc)
112
+ activesupport (= 3.0.0.rc)
113
+ rake (>= 0.8.3)
114
+ thor (~> 0.14.0)
115
+ rake (0.8.7)
116
+ redgreen (1.2.2)
117
+ ruby-debug (0.10.3)
118
+ columnize (>= 0.1)
119
+ ruby-debug-base (~> 0.10.3.0)
120
+ ruby-debug-base (0.10.3)
121
+ linecache (>= 0.3)
122
+ rubyzip (0.9.4)
123
+ selenium-webdriver (0.0.27)
124
+ ffi (>= 0.6.1)
125
+ json_pure
126
+ rubyzip
127
+ shoulda (2.11.1)
128
+ sqlite3-ruby (1.3.1)
129
+ term-ansicolor (1.0.5)
130
+ thor (0.14.0)
131
+ treetop (1.4.8)
132
+ polyglot (>= 0.3.1)
133
+ trollop (1.16.2)
134
+ tzinfo (0.3.22)
135
+ warden (0.10.7)
136
+ rack (>= 1.0.0)
137
+
138
+ PLATFORMS
139
+ ruby
140
+
141
+ DEPENDENCIES
142
+ ZenTest
143
+ autotest-growl
144
+ autotest-rails
145
+ capybara
146
+ cucumber-rails
147
+ database_cleaner
148
+ devise (= 1.1.1)
149
+ devise_ldap_authenticatable!
150
+ factory_girl_rails
151
+ launchy
152
+ mocha
153
+ rails (= 3.0.0.rc)
154
+ redgreen
155
+ ruby-debug
156
+ shoulda
157
+ sqlite3-ruby
@@ -1,15 +1,3 @@
1
- ## Build / start instructions for LDAP
2
-
3
- # cd test/ldap
4
- # mkdir openldap-data
5
- # mkdir openldap-data/run
6
- # ./run-server.sh &
7
- # ldapadd -h localhost -p 3389 -x -D "cn=admin,dc=test,dc=com" -w secret -f base.ldif
8
- #
9
- # this creates the users:
10
- # cn=admin,dc=test,com / secret
11
- # cn=example.user@test.com,ou=people,dc=test,dc=com / secret
12
-
13
1
  authorizations: &AUTHORIZATIONS
14
2
  ## Authorization
15
3
  group_base: ou=groups,dc=test,dc=com
@@ -0,0 +1,23 @@
1
+ <% @base = "dc=test,dc=com" %>
2
+
3
+ authorizations: &AUTHORIZATIONS
4
+ ## Authorization
5
+ group_base: <%= "ou=groups,#{@base}" %>
6
+ required_groups:
7
+ - cn=admins,<%= "ou=groups,#{@base}" %>
8
+ require_attribute:
9
+ objectClass: inetOrgPerson
10
+ authorizationRole: blogAdmin
11
+
12
+ test: &TEST
13
+ host: <%= "localhost" %>
14
+ port: 3389
15
+ attribute: cn
16
+ base: <%= "ou=people,#{@base}" %>
17
+ admin_user: <%= "cn=admin,#{@base}" %>
18
+ admin_password: secret
19
+ ssl: false
20
+ <<: *AUTHORIZATIONS
21
+
22
+ development:
23
+ <<: *TEST
@@ -1,15 +1,3 @@
1
- ## Build / start instructions for LDAP
2
-
3
- # cd test/ldap
4
- # mkdir openldap-data
5
- # mkdir openldap-data/run
6
- # ./run-server.sh &
7
- # ldapadd -h localhost -p 3389 -x -D "cn=admin,dc=test,dc=com" -w secret -f base.ldif
8
- #
9
- # this creates the users:
10
- # cn=admin,dc=test,com / secret
11
- # cn=example.user@test.com,ou=people,dc=test,dc=com / secret
12
-
13
1
  authorizations: &AUTHORIZATIONS
14
2
  ## Authorization
15
3
  group_base: ou=groups,dc=test,dc=com
@@ -0,0 +1,21 @@
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
+ require_attribute:
7
+ objectClass: inetOrgPerson
8
+ authorizationRole: blogAdmin
9
+
10
+ test: &TEST
11
+ host: localhost
12
+ port: 3389
13
+ attribute: cn
14
+ base: ou=people,dc=test,dc=com
15
+ admin_user: cn=admin,dc=test,dc=com
16
+ admin_password: secret
17
+ ssl: true
18
+ <<: *AUTHORIZATIONS
19
+
20
+ development:
21
+ <<: *TEST
@@ -0,0 +1,23 @@
1
+ <% @base = "dc=test,dc=com" %>
2
+
3
+ authorizations: &AUTHORIZATIONS
4
+ ## Authorization
5
+ group_base: <%= "ou=groups,#{@base}" %>
6
+ required_groups:
7
+ - cn=admins,<%= "ou=groups,#{@base}" %>
8
+ require_attribute:
9
+ objectClass: inetOrgPerson
10
+ authorizationRole: blogAdmin
11
+
12
+ test: &TEST
13
+ host: <%= "localhost" %>
14
+ port: 3389
15
+ attribute: cn
16
+ base: <%= "ou=people,#{@base}" %>
17
+ admin_user: <%= "cn=admin,#{@base}" %>
18
+ admin_password: secret
19
+ ssl: true
20
+ <<: *AUTHORIZATIONS
21
+
22
+ development:
23
+ <<: *TEST
@@ -0,0 +1,18 @@
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
+ require_attribute:
7
+ objectClass: inetOrgPerson
8
+ authorizationRole: blogAdmin
9
+
10
+ test:
11
+ host: localhost
12
+ port: 3389
13
+ attribute: uid
14
+ base: ou=people,dc=test,dc=com
15
+ admin_user: cn=admin,dc=test,dc=com
16
+ admin_password: secret
17
+ ssl: true
18
+ <<: *AUTHORIZATIONS
@@ -4,6 +4,7 @@ Feature: Manage logins
4
4
  I want to login with LDAP
5
5
 
6
6
  Background:
7
+ Given I check for SSL
7
8
  Given the following logins:
8
9
  | email | password |
9
10
  | example.user@test.com | secret |
@@ -4,6 +4,10 @@ Given /^the following logins:$/ do |logins|
4
4
  end
5
5
  end
6
6
 
7
+ Given /^I check for SSL$/ do
8
+ ::Devise.ldap_config = "#{Rails.root}/config/ssl_ldap.yml" if ENV["LDAP_SSL"]
9
+ end
10
+
7
11
  When /^I delete the (\d+)(?:st|nd|rd|th) login$/ do |pos|
8
12
  visit logins_path
9
13
  within("table tr:nth-child(#{pos.to_i+1})") do
@@ -14,3 +18,4 @@ end
14
18
  Then /^I should see the following logins:$/ do |expected_logins_table|
15
19
  expected_logins_table.diff!(tableish('table tr', 'td,th'))
16
20
  end
21
+
@@ -5,15 +5,20 @@ require 'rails/test_help'
5
5
  class ActiveSupport::TestCase
6
6
 
7
7
  def reset_ldap_server!
8
- `ldapmodify -x -h localhost -p 3389 -D "cn=admin,dc=test,dc=com" -w secret -f ../ldap/clear.ldif`
9
- `ldapadd -x -h localhost -p 3389 -D "cn=admin,dc=test,dc=com" -w secret -f ../ldap/base.ldif`
8
+ if ENV["LDAP_SSL"]
9
+ `ldapmodify -x -H ldaps://localhost:3389 -D "cn=admin,dc=test,dc=com" -w secret -f ../ldap/clear.ldif`
10
+ `ldapadd -x -H ldaps://localhost:3389 -D "cn=admin,dc=test,dc=com" -w secret -f ../ldap/base.ldif`
11
+ else
12
+ `ldapmodify -x -h localhost -p 3389 -D "cn=admin,dc=test,dc=com" -w secret -f ../ldap/clear.ldif`
13
+ `ldapadd -x -h localhost -p 3389 -D "cn=admin,dc=test,dc=com" -w secret -f ../ldap/base.ldif`
14
+ end
10
15
  end
11
16
 
12
17
  def default_devise_settings!
13
18
  ::Devise.ldap_logger = true
14
19
  ::Devise.ldap_create_user = false
15
20
  ::Devise.ldap_update_password = true
16
- ::Devise.ldap_config = "#{Rails.root}/config/ldap.yml"
21
+ ::Devise.ldap_config = "#{Rails.root}/config/#{"ssl_" if ENV["LDAP_SSL"]}ldap.yml"
17
22
  ::Devise.ldap_check_group_membership = false
18
23
  ::Devise.ldap_check_attributes = false
19
24
  ::Devise.authentication_keys = [:email]
@@ -12,8 +12,8 @@ class UserTest < ActiveSupport::TestCase
12
12
 
13
13
  context "With default settings" do
14
14
  setup do
15
- reset_ldap_server!
16
15
  default_devise_settings!
16
+ reset_ldap_server!
17
17
  end
18
18
 
19
19
  context "create a basic user" do
@@ -137,9 +137,9 @@ class UserTest < ActiveSupport::TestCase
137
137
 
138
138
  context "use uid for login" do
139
139
  setup do
140
- reset_ldap_server!
141
140
  default_devise_settings!
142
- ::Devise.ldap_config = "#{Rails.root}/config/ldap_with_uid.yml"
141
+ reset_ldap_server!
142
+ ::Devise.ldap_config = "#{Rails.root}/config/#{"ssl_" if ENV["LDAP_SSL"]}ldap_with_uid.yml"
143
143
  ::Devise.authentication_keys = [:uid]
144
144
  end
145
145
 
@@ -168,5 +168,26 @@ class UserTest < ActiveSupport::TestCase
168
168
  end
169
169
  end
170
170
 
171
+ context "using ERB in the config file" do
172
+ setup do
173
+ default_devise_settings!
174
+ reset_ldap_server!
175
+ ::Devise.ldap_config = "#{Rails.root}/config/#{"ssl_" if ENV["LDAP_SSL"]}ldap_with_erb.yml"
176
+ end
177
+
178
+ context "authenticate" do
179
+ setup do
180
+ @admin = Factory(:admin)
181
+ @user = Factory(:user)
182
+ end
183
+
184
+ should "be able to authenticate" do
185
+ should_be_validated @user, "secret"
186
+ should_be_validated @admin, "admin_secret"
187
+ end
188
+ end
189
+ end
190
+
191
+
171
192
 
172
193
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_ldap_authenticatable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 2
10
- version: 0.4.2
9
+ - 3
10
+ version: 0.4.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Curtis Schiewek
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-08-03 00:00:00 -04:00
19
+ date: 2010-08-05 00:00:00 -04:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -83,8 +83,11 @@ files:
83
83
  - test/ldap/clear.ldif
84
84
  - test/ldap/local.schema
85
85
  - test/ldap/run-server.sh
86
+ - test/ldap/server.pem
87
+ - test/ldap/slapd-ssl-test.conf
86
88
  - test/ldap/slapd-test.conf
87
89
  - test/rails_app/Gemfile
90
+ - test/rails_app/Gemfile.lock
88
91
  - test/rails_app/Rakefile
89
92
  - test/rails_app/app/controllers/application_controller.rb
90
93
  - test/rails_app/app/controllers/posts_controller.rb
@@ -110,10 +113,14 @@ files:
110
113
  - test/rails_app/config/initializers/secret_token.rb
111
114
  - test/rails_app/config/initializers/session_store.rb
112
115
  - test/rails_app/config/ldap.yml
116
+ - test/rails_app/config/ldap_with_erb.yml
113
117
  - test/rails_app/config/ldap_with_uid.yml
114
118
  - test/rails_app/config/locales/devise.en.yml
115
119
  - test/rails_app/config/locales/en.yml
116
120
  - test/rails_app/config/routes.rb
121
+ - test/rails_app/config/ssl_ldap.yml
122
+ - test/rails_app/config/ssl_ldap_with_erb.yml
123
+ - test/rails_app/config/ssl_ldap_with_uid.yml
117
124
  - test/rails_app/db/migrate/20100708120302_create_posts.rb
118
125
  - test/rails_app/db/migrate/20100708120448_devise_create_users.rb
119
126
  - test/rails_app/db/schema.rb