aker 3.0.2 → 3.0.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/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  Aker History
2
2
  ============
3
3
 
4
+ 3.0.3
5
+ -----
6
+ - Added: search_domain configuration option to LDAP authority. (#15)
7
+ This new option is mandatory; the lack of this option in prior
8
+ versions of the authority meant that they would not work with LDAP
9
+ servers other than Northwestern's.
10
+
4
11
  3.0.2
5
12
  -----
6
13
  - Added missing LICENSE file. Aker is made available under the MIT
@@ -82,6 +82,10 @@ module Aker::Ldap
82
82
  # @option config [String] :server The hostname for the LDAP server
83
83
  # (required)
84
84
  #
85
+ # @option config [String] :search_domain The search base to use
86
+ # when looking up users. E.g., `"dc=example,dc=org"`.
87
+ # (required)
88
+ #
85
89
  # @option config [Integer] :port (636) The port to use to connect to the
86
90
  # LDAP server
87
91
  #
@@ -161,6 +165,12 @@ module Aker::Ldap
161
165
  @config[:use_tls].nil? ? true : @config[:use_tls]
162
166
  end
163
167
 
168
+ ##
169
+ # The search domain to use when finding user records.
170
+ def search_domain
171
+ @config[:search_domain]
172
+ end
173
+
164
174
  ##
165
175
  # The mapping between attributes from the LDAP server and
166
176
  # {Aker::User} attributes. This mapping is used in two ways:
@@ -351,8 +361,7 @@ module Aker::Ldap
351
361
  def find_by_criteria(ldap, *criteria)
352
362
  filter = criteria.collect { |c| create_criteria_filter(c) }.inject { |a, f| a | f }
353
363
  return [] unless filter
354
- base = "dc=northwestern,dc=edu"
355
- ldap.search(:filter => filter, :base => base)
364
+ ldap.search(:filter => filter, :base => search_domain) || []
356
365
  end
357
366
 
358
367
  def one_value(ldap_entry, key)
@@ -362,6 +371,7 @@ module Aker::Ldap
362
371
 
363
372
  def validate_config!
364
373
  self.server or raise "The server parameter is required for ldap."
374
+ self.search_domain or raise 'The search_domain parameter is required for ldap.'
365
375
  if self.user.nil? ^ self.password.nil?
366
376
  raise "For ldap, both user and password are required if one is set."
367
377
  end
data/lib/aker/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Aker
2
- VERSION = "3.0.2"
2
+ VERSION = '3.0.3'
3
3
  end
@@ -23,7 +23,10 @@ module Aker::Ldap
23
23
 
24
24
  # Minimal valid set
25
25
  let(:params) {
26
- { :server => '127.0.0.1' }
26
+ {
27
+ :server => '127.0.0.1',
28
+ :search_domain => 'dc=northwestern,dc=edu'
29
+ }
27
30
  }
28
31
 
29
32
  def actual
@@ -60,6 +63,11 @@ module Aker::Ldap
60
63
  lambda { actual }.should raise_error("The server parameter is required for ldap.")
61
64
  end
62
65
 
66
+ it 'requires the search domain' do
67
+ params[:search_domain] = nil
68
+ lambda { actual }.should raise_error('The search_domain parameter is required for ldap.')
69
+ end
70
+
63
71
  it "does not require a user name" do
64
72
  params[:user] = nil
65
73
  params[:password] = nil
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aker
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
5
- prerelease: false
4
+ hash: 1
5
+ prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 2
10
- version: 3.0.2
9
+ - 3
10
+ version: 3.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rhett Sutphin
@@ -17,8 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-10-07 00:00:00 -05:00
21
- default_executable:
20
+ date: 2011-10-31 00:00:00 Z
22
21
  dependencies:
23
22
  - !ruby/object:Gem::Dependency
24
23
  name: rubytree
@@ -240,7 +239,6 @@ files:
240
239
  - spec/matchers.rb
241
240
  - spec/mock_builder.rb
242
241
  - spec/spec_helper.rb
243
- has_rdoc: true
244
242
  homepage: https://github.com/NUBIC/aker
245
243
  licenses: []
246
244
 
@@ -270,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
268
  requirements: []
271
269
 
272
270
  rubyforge_project:
273
- rubygems_version: 1.3.7
271
+ rubygems_version: 1.8.10
274
272
  signing_key:
275
273
  specification_version: 3
276
274
  summary: A flexible authentication and authorization framework for Rack applications.