oa-enterprise 0.2.5 → 0.2.6

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/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ platforms :jruby do
4
+ gem 'jruby-openssl', '~> 0.7'
5
+ end
6
+
7
+ gemspec
@@ -38,14 +38,21 @@ module OmniAuth
38
38
  # returns nil if given nil
39
39
  def parse_user_info(node)
40
40
  return nil if node.nil?
41
- node.children.inject({}) do |hash, child|
42
- unless child.kind_of?(Nokogiri::XML::Text) ||
43
- child.name == 'cas:proxies' ||
44
- child.name == 'proxies'
45
- hash[child.name.sub(/^cas:/, '')] = child.content
41
+ hash = {}
42
+ node.children.each do |e|
43
+ unless e.kind_of?(Nokogiri::XML::Text) ||
44
+ e.name == 'cas:proxies' ||
45
+ e.name == 'proxies'
46
+ # There are no child elements
47
+ if e.element_children.count == 0
48
+ hash[e.name.sub(/^cas:/, '')] = e.content
49
+ elsif e.element_children.count
50
+ hash[e.name.sub(/^cas:/, '')] = [] if hash[e.name.sub(/^cas:/, '')].nil?
51
+ hash[e.name.sub(/^cas:/, '')].push parse_user_info e
52
+ end
46
53
  end
47
- hash
48
54
  end
55
+ hash
49
56
  end
50
57
 
51
58
  # finds an `<cas:authenticationSuccess>` node in
@@ -7,7 +7,7 @@ module OmniAuth
7
7
  MINOR = 2
8
8
  end
9
9
  unless defined?(::OmniAuth::Version::PATCH)
10
- PATCH = 5
10
+ PATCH = 6
11
11
  end
12
12
  unless defined?(::OmniAuth::Version::PRE)
13
13
  PRE = nil
@@ -3,7 +3,6 @@ require File.expand_path('../lib/omniauth/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.add_runtime_dependency 'addressable', '2.2.4'
6
- gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java'
7
6
  gem.add_runtime_dependency 'nokogiri', '~> 1.4.2'
8
7
  gem.add_runtime_dependency 'net-ldap', '~> 0.2.2'
9
8
  gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING
@@ -15,7 +14,7 @@ Gem::Specification.new do |gem|
15
14
  gem.add_development_dependency 'rake', '~> 0.8'
16
15
  gem.add_development_dependency 'rspec', '~> 2.5'
17
16
  gem.add_development_dependency 'webmock', '~> 1.6'
18
- gem.add_development_dependency 'yard', '~> 0.6'
17
+ gem.add_development_dependency 'yard', '~> 0.7'
19
18
  gem.add_development_dependency 'ZenTest', '~> 4.5'
20
19
  gem.name = 'oa-enterprise'
21
20
  gem.version = OmniAuth::Version::STRING
@@ -0,0 +1,41 @@
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+ require 'cgi'
3
+
4
+ describe OmniAuth::Strategies::LDAP, :type => :strategy do
5
+
6
+ include OmniAuth::Test::StrategyTestCase
7
+
8
+ def strategy
9
+ @ldap_server ||= 'ldap.example.org'
10
+ [OmniAuth::Strategies::LDAP, {
11
+ :host => @ldap_server,
12
+ :port => 636,
13
+ :method => :ssl,
14
+ :uid => 'jeremyf',
15
+ :base => 'o="University of OmniAuth", st=Sublime, c=RubyNation',
16
+ }]
17
+ end
18
+
19
+ describe 'GET /auth/ldap' do
20
+ before do
21
+ get '/auth/ldap'
22
+ end
23
+
24
+ # TODO: Add checks that page has authentication form; I attempted
25
+ # to use `should have_tag` but that was not working.
26
+ it 'should get authentication page' do
27
+ last_response.status.should == 200
28
+ end
29
+ end
30
+
31
+ describe 'POST /auth/ldap' do
32
+ before do
33
+ post '/auth/ldap', {:username => 'jeremy', :password => 'valid_password' }
34
+ end
35
+
36
+ it 'should redirect us to /auth/ldap/callback' do
37
+ last_response.should be_redirect
38
+ last_response.location.should == '/auth/ldap/callback'
39
+ end
40
+ end
41
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: oa-enterprise
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.5
5
+ version: 0.2.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - James A. Rosen
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2011-04-29 00:00:00 Z
16
+ date: 2011-05-20 00:00:00 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: addressable
@@ -56,7 +56,7 @@ dependencies:
56
56
  requirements:
57
57
  - - "="
58
58
  - !ruby/object:Gem::Version
59
- version: 0.2.5
59
+ version: 0.2.6
60
60
  type: :runtime
61
61
  version_requirements: *id004
62
62
  - !ruby/object:Gem::Dependency
@@ -155,7 +155,7 @@ dependencies:
155
155
  requirements:
156
156
  - - ~>
157
157
  - !ruby/object:Gem::Version
158
- version: "0.6"
158
+ version: "0.7"
159
159
  type: :development
160
160
  version_requirements: *id013
161
161
  - !ruby/object:Gem::Dependency
@@ -185,6 +185,7 @@ files:
185
185
  - .gemtest
186
186
  - .rspec
187
187
  - .yardopts
188
+ - Gemfile
188
189
  - LICENSE
189
190
  - README.rdoc
190
191
  - Rakefile
@@ -200,6 +201,7 @@ files:
200
201
  - spec/fixtures/cas_failure.xml
201
202
  - spec/fixtures/cas_success.xml
202
203
  - spec/omniauth/strategies/cas_spec.rb
204
+ - spec/omniauth/strategies/ldap_spec.rb
203
205
  - spec/spec_helper.rb
204
206
  homepage: http://github.com/intridea/omniauth
205
207
  licenses: []
@@ -224,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
226
  requirements: []
225
227
 
226
228
  rubyforge_project:
227
- rubygems_version: 1.7.2
229
+ rubygems_version: 1.8.2
228
230
  signing_key:
229
231
  specification_version: 3
230
232
  summary: Enterprise strategies for OmniAuth.
@@ -232,5 +234,5 @@ test_files:
232
234
  - spec/fixtures/cas_failure.xml
233
235
  - spec/fixtures/cas_success.xml
234
236
  - spec/omniauth/strategies/cas_spec.rb
237
+ - spec/omniauth/strategies/ldap_spec.rb
235
238
  - spec/spec_helper.rb
236
- has_rdoc: