omniauth-ldap 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MDk4ZjI4OGU0MjkyOTVkYWM1NTM1ZTZhMDI1ZWE5Y2U1MTYyNTgwZg==
5
+ data.tar.gz: !binary |-
6
+ YTJhNTU0ODAyZDQyOTUyM2MxNmE0ODRhM2Y2ZGNmM2I0MmFlN2E4ZQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZTIxMGExMTMwYzg0MjMyYTcwMjU4YmMwMjdjMGFiODU4YjZjZjRhZWIzOWRh
10
+ Zjk3NTI1N2JmZjY3NWE5YTM4ZjlmMGQwZmRiYjI3ZTQwN2UzZGNjNTMyNmRi
11
+ Y2IwOGY0NzVkNTE3OTkxMWYxMDNiY2YxZjQ1YjVlOGI4YjFiZTE=
12
+ data.tar.gz: !binary |-
13
+ M2E2MTA0NGI5ODk3YTA0MzY4MDZmM2FlZjk5YjVhNDQzNGRhNTc0NmM3Y2Qz
14
+ M2I1YzA0MTFlYmVlYzU4OWI2ZGJlYTBjMTIzMmQxNDYyOTYyNDk3NWNkMDJj
15
+ MGNiNmJjMTVkNmEzYmY1MzgyMmU3YjEyNWI0OWE5NGIxYzIyMjA=
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  .project
2
2
  coverage
3
+ /Gemfile.lock
@@ -3,7 +3,6 @@
3
3
  require 'rack'
4
4
  require 'net/ldap'
5
5
  require 'net/ntlm'
6
- require 'uri'
7
6
  require 'sasl'
8
7
  require 'kconv'
9
8
  module OmniAuth
@@ -48,11 +47,9 @@ module OmniAuth
48
47
  :encryption => method,
49
48
  :base => @base
50
49
  }
51
- @uri = construct_uri(@host, @port, @method != :plain)
52
-
53
50
  @bind_method = @try_sasl ? :sasl : (@allow_anonymous||!@bind_dn||!@password ? :anonymous : :simple)
54
-
55
-
51
+
52
+
56
53
  @auth = sasl_auths({:username => @bind_dn, :password => @password}).first if @bind_method == :sasl
57
54
  @auth ||= { :method => @bind_method,
58
55
  :username => @bind_dn,
@@ -61,11 +58,11 @@ module OmniAuth
61
58
  config[:auth] = @auth
62
59
  @connection = Net::LDAP.new(config)
63
60
  end
64
-
61
+
65
62
  #:base => "dc=yourcompany, dc=com",
66
63
  # :filter => "(mail=#{user})",
67
64
  # :password => psw
68
- def bind_as(args = {})
65
+ def bind_as(args = {})
69
66
  result = false
70
67
  @connection.open do |me|
71
68
  rs = me.search args
@@ -140,10 +137,6 @@ module OmniAuth
140
137
  [Net::NTLM::Message::Type1.new.serialize, nego]
141
138
  end
142
139
 
143
- def construct_uri(host, port, ssl)
144
- protocol = ssl ? "ldaps" : "ldap"
145
- URI.parse("#{protocol}://#{host}:#{port}").to_s
146
- end
147
140
  end
148
141
  end
149
142
  end
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module LDAP
3
- VERSION = "1.0.3"
3
+ VERSION = "1.0.4"
4
4
  end
5
5
  end
@@ -64,14 +64,14 @@ module OmniAuth
64
64
  mapper.each do |key, value|
65
65
  case value
66
66
  when String
67
- user[key] = object[value.downcase.to_sym].first if object[value.downcase.to_sym]
67
+ user[key] = object[value.downcase.to_sym].first if object.respond_to? value.downcase.to_sym
68
68
  when Array
69
- value.each {|v| (user[key] = object[v.downcase.to_sym].first; break;) if object[v.downcase.to_sym]}
69
+ value.each {|v| (user[key] = object[v.downcase.to_sym].first; break;) if object.respond_to? v.downcase.to_sym}
70
70
  when Hash
71
71
  value.map do |key1, value1|
72
72
  pattern = key1.dup
73
73
  value1.each_with_index do |v,i|
74
- part = ''; v.collect(&:downcase).collect(&:to_sym).each {|v1| (part = object[v1].first; break;) if object[v1]}
74
+ part = ''; v.collect(&:downcase).collect(&:to_sym).each {|v1| (part = object[v1].first; break;) if object.respond_to? v1}
75
75
  pattern.gsub!("%#{i}",part||'')
76
76
  end
77
77
  user[key] = pattern
@@ -7,17 +7,18 @@ Gem::Specification.new do |gem|
7
7
  gem.description = %q{A LDAP strategy for OmniAuth.}
8
8
  gem.summary = %q{A LDAP strategy for OmniAuth.}
9
9
  gem.homepage = "https://github.com/intridea/omniauth-ldap"
10
+ gem.license = "MIT"
10
11
 
11
12
  gem.add_runtime_dependency 'omniauth', '~> 1.0'
12
- gem.add_runtime_dependency 'net-ldap', '~> 0.2.2'
13
+ gem.add_runtime_dependency 'net-ldap', '~> 0.3.1'
13
14
  gem.add_runtime_dependency 'pyu-ruby-sasl', '~> 0.0.3.1'
14
- gem.add_runtime_dependency 'rubyntlm', '~> 0.1.1'
15
+ gem.add_runtime_dependency 'rubyntlm', '~> 0.1.1'
15
16
  gem.add_development_dependency 'rspec', '~> 2.7'
16
17
  gem.add_development_dependency 'simplecov'
17
18
  gem.add_development_dependency 'rack-test'
18
19
  gem.add_development_dependency 'libnotify'
19
20
  gem.add_development_dependency 'ruby-debug19'
20
-
21
+
21
22
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
23
  gem.files = `git ls-files`.split("\n")
23
24
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -49,7 +49,7 @@ describe "OmniAuth::Strategies::LDAP" do
49
49
 
50
50
  describe 'post /auth/ldap/callback' do
51
51
  before(:each) do
52
- @adaptor = mock(OmniAuth::LDAP::Adaptor, {:uid => 'ping'})
52
+ @adaptor = double(OmniAuth::LDAP::Adaptor, {:uid => 'ping'})
53
53
  OmniAuth::LDAP::Adaptor.stub(:new).and_return(@adaptor)
54
54
  end
55
55
 
@@ -125,20 +125,25 @@ describe "OmniAuth::Strategies::LDAP" do
125
125
  let(:auth_hash){ last_request.env['omniauth.auth'] }
126
126
 
127
127
  before(:each) do
128
- @adaptor.stub(:bind_as).and_return({
129
- :dn => ['cn=ping, dc=intridea, dc=com'],
130
- :mail => ['ping@intridea.com'],
131
- :givenname => ['Ping'], :sn => ['Yu'],
132
- :telephonenumber => ['555-555-5555'],
133
- :mobile => ['444-444-4444'],
134
- :uid => ['ping'],
135
- :title => ['dev'],
136
- :address =>[ 'k street'],
137
- :l => ['Washington'], :st => ['DC'], :co => ["U.S.A"], :postofficebox => ['20001'],
138
- :wwwhomepage => ['www.intridea.com'],
139
- :jpegphoto => ['http://www.intridea.com/ping.jpg'],
140
- :description => ['omniauth-ldap']})
141
-
128
+ @adaptor.stub(:bind_as).and_return(Net::LDAP::Entry.from_single_ldif_string(
129
+ %Q{dn: cn=ping, dc=intridea, dc=com
130
+ mail: ping@intridea.com
131
+ givenname: Ping
132
+ sn: Yu
133
+ telephonenumber: 555-555-5555
134
+ mobile: 444-444-4444
135
+ uid: ping
136
+ title: dev
137
+ address: k street
138
+ l: Washington
139
+ st: DC
140
+ co: U.S.A
141
+ postofficebox: 20001
142
+ wwwhomepage: www.intridea.com
143
+ jpegphoto: http://www.intridea.com/ping.jpg
144
+ description: omniauth-ldap
145
+ }
146
+ ))
142
147
  post('/auth/ldap/callback', {:username => 'ping', :password => 'password'})
143
148
  end
144
149
 
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-ldap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
5
- prerelease:
4
+ version: 1.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ping Yu
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-23 00:00:00.000000000 Z
11
+ date: 2013-12-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: omniauth
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,23 +27,20 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: net-ldap
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
37
- version: 0.2.2
33
+ version: 0.3.1
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
45
- version: 0.2.2
40
+ version: 0.3.1
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: pyu-ruby-sasl
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rubyntlm
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rspec
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ~>
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ~>
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: simplecov
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ! '>='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ! '>='
108
95
  - !ruby/object:Gem::Version
@@ -110,7 +97,6 @@ dependencies:
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: rack-test
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
101
  - - ! '>='
116
102
  - !ruby/object:Gem::Version
@@ -118,7 +104,6 @@ dependencies:
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
108
  - - ! '>='
124
109
  - !ruby/object:Gem::Version
@@ -126,7 +111,6 @@ dependencies:
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: libnotify
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
115
  - - ! '>='
132
116
  - !ruby/object:Gem::Version
@@ -134,7 +118,6 @@ dependencies:
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
122
  - - ! '>='
140
123
  - !ruby/object:Gem::Version
@@ -142,7 +125,6 @@ dependencies:
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: ruby-debug19
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
129
  - - ! '>='
148
130
  - !ruby/object:Gem::Version
@@ -150,7 +132,6 @@ dependencies:
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
136
  - - ! '>='
156
137
  - !ruby/object:Gem::Version
@@ -165,7 +146,6 @@ files:
165
146
  - .gitignore
166
147
  - .rspec
167
148
  - Gemfile
168
- - Gemfile.lock
169
149
  - Guardfile
170
150
  - README.md
171
151
  - Rakefile
@@ -178,28 +158,28 @@ files:
178
158
  - spec/omniauth/strategies/ldap_spec.rb
179
159
  - spec/spec_helper.rb
180
160
  homepage: https://github.com/intridea/omniauth-ldap
181
- licenses: []
161
+ licenses:
162
+ - MIT
163
+ metadata: {}
182
164
  post_install_message:
183
165
  rdoc_options: []
184
166
  require_paths:
185
167
  - lib
186
168
  required_ruby_version: !ruby/object:Gem::Requirement
187
- none: false
188
169
  requirements:
189
170
  - - ! '>='
190
171
  - !ruby/object:Gem::Version
191
172
  version: '0'
192
173
  required_rubygems_version: !ruby/object:Gem::Requirement
193
- none: false
194
174
  requirements:
195
175
  - - ! '>='
196
176
  - !ruby/object:Gem::Version
197
177
  version: '0'
198
178
  requirements: []
199
179
  rubyforge_project:
200
- rubygems_version: 1.8.24
180
+ rubygems_version: 2.1.10
201
181
  signing_key:
202
- specification_version: 3
182
+ specification_version: 4
203
183
  summary: A LDAP strategy for OmniAuth.
204
184
  test_files:
205
185
  - spec/omniauth-ldap/adaptor_spec.rb
@@ -1,79 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- omniauth-ldap (1.0.2)
5
- net-ldap (~> 0.2.2)
6
- omniauth (~> 1.0)
7
- pyu-ruby-sasl (~> 0.0.3.1)
8
- rubyntlm (~> 0.1.1)
9
-
10
- GEM
11
- remote: http://rubygems.org/
12
- specs:
13
- archive-tar-minitar (0.5.2)
14
- columnize (0.3.4)
15
- diff-lcs (1.1.3)
16
- ffi (1.0.9)
17
- growl (1.0.3)
18
- guard (0.8.8)
19
- thor (~> 0.14.6)
20
- guard-bundler (0.1.3)
21
- bundler (>= 1.0.0)
22
- guard (>= 0.2.2)
23
- guard-rspec (0.5.0)
24
- guard (>= 0.8.4)
25
- hashie (1.2.0)
26
- libnotify (0.5.7)
27
- ffi (= 1.0.9)
28
- linecache19 (0.5.12)
29
- ruby_core_source (>= 0.1.4)
30
- multi_json (1.0.3)
31
- net-ldap (0.2.2)
32
- omniauth (1.0.1)
33
- hashie (~> 1.2)
34
- rack
35
- pyu-ruby-sasl (0.0.3.3)
36
- rack (1.3.5)
37
- rack-test (0.6.1)
38
- rack (>= 1.0)
39
- rb-fsevent (0.4.3.1)
40
- rspec (2.7.0)
41
- rspec-core (~> 2.7.0)
42
- rspec-expectations (~> 2.7.0)
43
- rspec-mocks (~> 2.7.0)
44
- rspec-core (2.7.1)
45
- rspec-expectations (2.7.0)
46
- diff-lcs (~> 1.1.2)
47
- rspec-mocks (2.7.0)
48
- ruby-debug-base19 (0.11.25)
49
- columnize (>= 0.3.1)
50
- linecache19 (>= 0.5.11)
51
- ruby_core_source (>= 0.1.4)
52
- ruby-debug19 (0.11.6)
53
- columnize (>= 0.3.1)
54
- linecache19 (>= 0.5.11)
55
- ruby-debug-base19 (>= 0.11.19)
56
- ruby_core_source (0.1.5)
57
- archive-tar-minitar (>= 0.5.2)
58
- rubyntlm (0.1.1)
59
- simplecov (0.5.4)
60
- multi_json (~> 1.0.3)
61
- simplecov-html (~> 0.5.3)
62
- simplecov-html (0.5.3)
63
- thor (0.14.6)
64
-
65
- PLATFORMS
66
- ruby
67
-
68
- DEPENDENCIES
69
- growl
70
- guard
71
- guard-bundler
72
- guard-rspec
73
- libnotify
74
- omniauth-ldap!
75
- rack-test
76
- rb-fsevent
77
- rspec (~> 2.7)
78
- ruby-debug19
79
- simplecov