omniauth 0.2.6 → 0.3.0.rc3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of omniauth might be problematic. Click here for more details.

Files changed (189) hide show
  1. data/README.md +62 -34
  2. data/lib/omniauth/version.rb +3 -3
  3. metadata +74 -228
  4. data/Gemfile +0 -12
  5. data/Rakefile +0 -51
  6. data/oa-basic/Gemfile +0 -7
  7. data/oa-basic/LICENSE +0 -19
  8. data/oa-basic/README.rdoc +0 -34
  9. data/oa-basic/Rakefile +0 -6
  10. data/oa-basic/lib/oa-basic.rb +0 -1
  11. data/oa-basic/lib/omniauth/basic.rb +0 -8
  12. data/oa-basic/lib/omniauth/strategies/http_basic.rb +0 -56
  13. data/oa-basic/lib/omniauth/version.rb +0 -19
  14. data/oa-basic/oa-basic.gemspec +0 -27
  15. data/oa-basic/spec/omniauth/strategies/basic_spec.rb +0 -7
  16. data/oa-basic/spec/spec_helper.rb +0 -11
  17. data/oa-core/Gemfile +0 -3
  18. data/oa-core/LICENSE +0 -19
  19. data/oa-core/Rakefile +0 -6
  20. data/oa-core/autotest/discover.rb +0 -1
  21. data/oa-core/lib/oa-core.rb +0 -1
  22. data/oa-core/lib/omniauth/builder.rb +0 -33
  23. data/oa-core/lib/omniauth/core.rb +0 -135
  24. data/oa-core/lib/omniauth/form.rb +0 -186
  25. data/oa-core/lib/omniauth/strategy.rb +0 -227
  26. data/oa-core/lib/omniauth/test.rb +0 -12
  27. data/oa-core/lib/omniauth/test/phony_session.rb +0 -8
  28. data/oa-core/lib/omniauth/test/strategy_macros.rb +0 -34
  29. data/oa-core/lib/omniauth/test/strategy_test_case.rb +0 -49
  30. data/oa-core/lib/omniauth/version.rb +0 -19
  31. data/oa-core/oa-core.gemspec +0 -24
  32. data/oa-core/spec/omniauth/builder_spec.rb +0 -20
  33. data/oa-core/spec/omniauth/core_spec.rb +0 -79
  34. data/oa-core/spec/omniauth/strategy_spec.rb +0 -363
  35. data/oa-core/spec/spec_helper.rb +0 -12
  36. data/oa-enterprise/Gemfile +0 -7
  37. data/oa-enterprise/LICENSE +0 -19
  38. data/oa-enterprise/README.rdoc +0 -82
  39. data/oa-enterprise/Rakefile +0 -6
  40. data/oa-enterprise/lib/oa-enterprise.rb +0 -1
  41. data/oa-enterprise/lib/omniauth/enterprise.rb +0 -8
  42. data/oa-enterprise/lib/omniauth/strategies/cas.rb +0 -47
  43. data/oa-enterprise/lib/omniauth/strategies/cas/configuration.rb +0 -98
  44. data/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb +0 -91
  45. data/oa-enterprise/lib/omniauth/strategies/ldap.rb +0 -111
  46. data/oa-enterprise/lib/omniauth/strategies/ldap/adaptor.rb +0 -279
  47. data/oa-enterprise/lib/omniauth/version.rb +0 -19
  48. data/oa-enterprise/oa-enterprise.gemspec +0 -31
  49. data/oa-enterprise/spec/fixtures/cas_failure.xml +0 -4
  50. data/oa-enterprise/spec/fixtures/cas_success.xml +0 -8
  51. data/oa-enterprise/spec/omniauth/strategies/cas_spec.rb +0 -94
  52. data/oa-enterprise/spec/omniauth/strategies/ldap_spec.rb +0 -41
  53. data/oa-enterprise/spec/spec_helper.rb +0 -14
  54. data/oa-more/Gemfile +0 -7
  55. data/oa-more/LICENSE +0 -19
  56. data/oa-more/README.rdoc +0 -22
  57. data/oa-more/Rakefile +0 -6
  58. data/oa-more/lib/oa-more.rb +0 -1
  59. data/oa-more/lib/omniauth/more.rb +0 -11
  60. data/oa-more/lib/omniauth/strategies/draugiem.rb +0 -104
  61. data/oa-more/lib/omniauth/strategies/flickr.rb +0 -86
  62. data/oa-more/lib/omniauth/strategies/ign.rb +0 -93
  63. data/oa-more/lib/omniauth/strategies/windows_live.rb +0 -39
  64. data/oa-more/lib/omniauth/strategies/windows_live/windowslivelogin.rb +0 -1143
  65. data/oa-more/lib/omniauth/strategies/yupoo.rb +0 -67
  66. data/oa-more/lib/omniauth/version.rb +0 -19
  67. data/oa-more/oa-more.gemspec +0 -29
  68. data/oa-more/spec/omniauth/strategies/draugiem_spec.rb +0 -51
  69. data/oa-more/spec/omniauth/strategies/flickr_spec.rb +0 -7
  70. data/oa-more/spec/spec_helper.rb +0 -11
  71. data/oa-oauth/Gemfile +0 -7
  72. data/oa-oauth/LICENSE +0 -19
  73. data/oa-oauth/README.rdoc +0 -35
  74. data/oa-oauth/Rakefile +0 -6
  75. data/oa-oauth/autotest/discover.rb +0 -1
  76. data/oa-oauth/lib/oa-oauth.rb +0 -1
  77. data/oa-oauth/lib/omniauth/oauth.rb +0 -56
  78. data/oa-oauth/lib/omniauth/strategies/bitly.rb +0 -46
  79. data/oa-oauth/lib/omniauth/strategies/dailymile.rb +0 -64
  80. data/oa-oauth/lib/omniauth/strategies/doit.rb +0 -60
  81. data/oa-oauth/lib/omniauth/strategies/dopplr.rb +0 -53
  82. data/oa-oauth/lib/omniauth/strategies/douban.rb +0 -60
  83. data/oa-oauth/lib/omniauth/strategies/evernote.rb +0 -54
  84. data/oa-oauth/lib/omniauth/strategies/facebook.rb +0 -70
  85. data/oa-oauth/lib/omniauth/strategies/foursquare.rb +0 -62
  86. data/oa-oauth/lib/omniauth/strategies/github.rb +0 -50
  87. data/oa-oauth/lib/omniauth/strategies/goodreads.rb +0 -44
  88. data/oa-oauth/lib/omniauth/strategies/google.rb +0 -80
  89. data/oa-oauth/lib/omniauth/strategies/gowalla.rb +0 -72
  90. data/oa-oauth/lib/omniauth/strategies/hyves.rb +0 -67
  91. data/oa-oauth/lib/omniauth/strategies/identica.rb +0 -49
  92. data/oa-oauth/lib/omniauth/strategies/instagram.rb +0 -56
  93. data/oa-oauth/lib/omniauth/strategies/instapaper.rb +0 -40
  94. data/oa-oauth/lib/omniauth/strategies/linked_in.rb +0 -56
  95. data/oa-oauth/lib/omniauth/strategies/mailru.rb +0 -107
  96. data/oa-oauth/lib/omniauth/strategies/meetup.rb +0 -56
  97. data/oa-oauth/lib/omniauth/strategies/miso.rb +0 -41
  98. data/oa-oauth/lib/omniauth/strategies/mixi.rb +0 -59
  99. data/oa-oauth/lib/omniauth/strategies/netflix.rb +0 -65
  100. data/oa-oauth/lib/omniauth/strategies/oauth.rb +0 -83
  101. data/oa-oauth/lib/omniauth/strategies/oauth2.rb +0 -91
  102. data/oa-oauth/lib/omniauth/strategies/plurk.rb +0 -58
  103. data/oa-oauth/lib/omniauth/strategies/qzone.rb +0 -69
  104. data/oa-oauth/lib/omniauth/strategies/rdio.rb +0 -45
  105. data/oa-oauth/lib/omniauth/strategies/renren.rb +0 -87
  106. data/oa-oauth/lib/omniauth/strategies/salesforce.rb +0 -44
  107. data/oa-oauth/lib/omniauth/strategies/smug_mug.rb +0 -42
  108. data/oa-oauth/lib/omniauth/strategies/sound_cloud.rb +0 -46
  109. data/oa-oauth/lib/omniauth/strategies/t163.rb +0 -57
  110. data/oa-oauth/lib/omniauth/strategies/taobao.rb +0 -79
  111. data/oa-oauth/lib/omniauth/strategies/teambox.rb +0 -49
  112. data/oa-oauth/lib/omniauth/strategies/thirty_seven_signals.rb +0 -41
  113. data/oa-oauth/lib/omniauth/strategies/tqq.rb +0 -64
  114. data/oa-oauth/lib/omniauth/strategies/trade_me.rb +0 -45
  115. data/oa-oauth/lib/omniauth/strategies/trip_it.rb +0 -22
  116. data/oa-oauth/lib/omniauth/strategies/tsina.rb +0 -79
  117. data/oa-oauth/lib/omniauth/strategies/tsohu.rb +0 -57
  118. data/oa-oauth/lib/omniauth/strategies/tumblr.rb +0 -60
  119. data/oa-oauth/lib/omniauth/strategies/twitter.rb +0 -57
  120. data/oa-oauth/lib/omniauth/strategies/type_pad.rb +0 -76
  121. data/oa-oauth/lib/omniauth/strategies/vimeo.rb +0 -54
  122. data/oa-oauth/lib/omniauth/strategies/vkontakte.rb +0 -87
  123. data/oa-oauth/lib/omniauth/strategies/xauth.rb +0 -67
  124. data/oa-oauth/lib/omniauth/strategies/yahoo.rb +0 -55
  125. data/oa-oauth/lib/omniauth/strategies/yammer.rb +0 -43
  126. data/oa-oauth/lib/omniauth/strategies/you_tube.rb +0 -73
  127. data/oa-oauth/lib/omniauth/version.rb +0 -19
  128. data/oa-oauth/oa-oauth.gemspec +0 -32
  129. data/oa-oauth/spec/fixtures/basecamp_200.xml +0 -24
  130. data/oa-oauth/spec/fixtures/campfire_200.json +0 -10
  131. data/oa-oauth/spec/omniauth/strategies/bitly_spec.rb +0 -5
  132. data/oa-oauth/spec/omniauth/strategies/dailymile_spec.rb +0 -5
  133. data/oa-oauth/spec/omniauth/strategies/doit_spec.rb +0 -5
  134. data/oa-oauth/spec/omniauth/strategies/dopplr_spec.rb +0 -5
  135. data/oa-oauth/spec/omniauth/strategies/douban_spec.rb +0 -5
  136. data/oa-oauth/spec/omniauth/strategies/evernote_spec.rb +0 -5
  137. data/oa-oauth/spec/omniauth/strategies/facebook_spec.rb +0 -5
  138. data/oa-oauth/spec/omniauth/strategies/foursquare_spec.rb +0 -18
  139. data/oa-oauth/spec/omniauth/strategies/github_spec.rb +0 -5
  140. data/oa-oauth/spec/omniauth/strategies/goodreads_spec.rb +0 -6
  141. data/oa-oauth/spec/omniauth/strategies/google_spec.rb +0 -5
  142. data/oa-oauth/spec/omniauth/strategies/gowalla_spec.rb +0 -5
  143. data/oa-oauth/spec/omniauth/strategies/hyves_spec.rb +0 -5
  144. data/oa-oauth/spec/omniauth/strategies/identica_spec.rb +0 -5
  145. data/oa-oauth/spec/omniauth/strategies/linked_in_spec.rb +0 -5
  146. data/oa-oauth/spec/omniauth/strategies/mailru_spec.rb +0 -5
  147. data/oa-oauth/spec/omniauth/strategies/meetup_spec.rb +0 -14
  148. data/oa-oauth/spec/omniauth/strategies/miso_spec.rb +0 -5
  149. data/oa-oauth/spec/omniauth/strategies/netflix_spec.rb +0 -5
  150. data/oa-oauth/spec/omniauth/strategies/oauth2_spec.rb +0 -0
  151. data/oa-oauth/spec/omniauth/strategies/oauth_spec.rb +0 -77
  152. data/oa-oauth/spec/omniauth/strategies/plurk_spec.rb +0 -5
  153. data/oa-oauth/spec/omniauth/strategies/rdio_spec.rb +0 -5
  154. data/oa-oauth/spec/omniauth/strategies/salesforce_spec.rb +0 -5
  155. data/oa-oauth/spec/omniauth/strategies/smug_mug_spec.rb +0 -5
  156. data/oa-oauth/spec/omniauth/strategies/sound_cloud_spec.rb +0 -5
  157. data/oa-oauth/spec/omniauth/strategies/t163_spec.rb +0 -5
  158. data/oa-oauth/spec/omniauth/strategies/taobao_spec.rb +0 -5
  159. data/oa-oauth/spec/omniauth/strategies/teambox_spec.rb +0 -5
  160. data/oa-oauth/spec/omniauth/strategies/thirty_seven_signals_spec.rb +0 -5
  161. data/oa-oauth/spec/omniauth/strategies/trade_me_spec.rb +0 -5
  162. data/oa-oauth/spec/omniauth/strategies/trip_it_spec.rb +0 -5
  163. data/oa-oauth/spec/omniauth/strategies/tsina_spec.rb +0 -5
  164. data/oa-oauth/spec/omniauth/strategies/tumblr_spec.rb +0 -5
  165. data/oa-oauth/spec/omniauth/strategies/twitter_spec.rb +0 -20
  166. data/oa-oauth/spec/omniauth/strategies/type_pad_spec.rb +0 -5
  167. data/oa-oauth/spec/omniauth/strategies/vimeo_spec.rb +0 -5
  168. data/oa-oauth/spec/omniauth/strategies/vkontakte_spec.rb +0 -5
  169. data/oa-oauth/spec/omniauth/strategies/yahoo_spec.rb +0 -5
  170. data/oa-oauth/spec/omniauth/strategies/yammer_spec.rb +0 -5
  171. data/oa-oauth/spec/omniauth/strategies/you_tube_spec.rb +0 -5
  172. data/oa-oauth/spec/spec_helper.rb +0 -27
  173. data/oa-oauth/spec/support/shared_examples.rb +0 -29
  174. data/oa-openid/Gemfile +0 -7
  175. data/oa-openid/LICENSE +0 -19
  176. data/oa-openid/README.rdoc +0 -51
  177. data/oa-openid/Rakefile +0 -6
  178. data/oa-openid/lib/oa-openid.rb +0 -1
  179. data/oa-openid/lib/omniauth/openid.rb +0 -60
  180. data/oa-openid/lib/omniauth/openid/gapps.rb +0 -32
  181. data/oa-openid/lib/omniauth/strategies/google_apps.rb +0 -23
  182. data/oa-openid/lib/omniauth/strategies/open_id.rb +0 -132
  183. data/oa-openid/lib/omniauth/strategies/steam.rb +0 -55
  184. data/oa-openid/lib/omniauth/version.rb +0 -19
  185. data/oa-openid/oa-openid.gemspec +0 -28
  186. data/oa-openid/spec/omniauth/strategies/open_id_spec.rb +0 -71
  187. data/oa-openid/spec/spec_helper.rb +0 -14
  188. data/omniauth.gemspec +0 -20
  189. data/tasks/all.rb +0 -134
@@ -1,279 +0,0 @@
1
- #this code boughts pieces from activeldap and net-ldap
2
-
3
- require 'rack'
4
- require 'net/ldap'
5
- require 'net/ntlm'
6
- require 'uri'
7
-
8
- module OmniAuth
9
- module Strategies
10
- class LDAP
11
- class Adaptor
12
- class LdapError < StandardError; end
13
- class ConfigurationError < StandardError; end
14
- class AuthenticationError < StandardError; end
15
- class ConnectionError < StandardError; end
16
-
17
- VALID_ADAPTER_CONFIGURATION_KEYS = [:host, :port, :method, :bind_dn, :password,
18
- :try_sasl, :sasl_mechanisms, :uid, :base, :allow_anonymous]
19
-
20
- MUST_HAVE_KEYS = [:host, :port, :method, :uid, :base]
21
-
22
- METHOD = {
23
- :ssl => :simple_tls,
24
- :tls => :start_tls,
25
- :plain => nil,
26
- }
27
-
28
- attr_accessor :bind_dn, :password
29
- attr_reader :connection, :uid, :base
30
-
31
- def initialize(configuration={})
32
- @connection = nil
33
- @disconnected = false
34
- @bound = false
35
- @configuration = configuration.dup
36
- @configuration[:allow_anonymous] ||= false
37
- @logger = @configuration.delete(:logger)
38
- message = []
39
- MUST_HAVE_KEYS.each do |name|
40
- message << name if configuration[name].nil?
41
- end
42
- raise ArgumentError.new(message.join(",") +" MUST be provided") unless message.empty?
43
- VALID_ADAPTER_CONFIGURATION_KEYS.each do |name|
44
- instance_variable_set("@#{name}", configuration[name])
45
- end
46
- end
47
-
48
- def connect(options={})
49
- host = options[:host] || @host
50
- method = ensure_method(options[:method] || @method || :plain)
51
- port = options[:port] || @port || ensure_port(method)
52
- @disconnected = false
53
- @bound = false
54
- @bind_tried = false
55
-
56
- config = {
57
- :host => host,
58
- :port => port,
59
- }
60
-
61
- config[:encryption] = {:method => method} if method
62
-
63
- @connection, @uri, @with_start_tls = begin
64
- uri = construct_uri(host, port, method == :simple_tls)
65
- with_start_tls = method == :start_tls
66
- puts ({:uri => uri, :with_start_tls => with_start_tls}).inspect
67
- [Net::LDAP::Connection.new(config), uri, with_start_tls]
68
- rescue Net::LDAP::LdapError
69
- raise ConnectionError, $!.message
70
- end
71
- end
72
-
73
- def unbind(options={})
74
- @connection.close # Net::LDAP doesn't implement unbind.
75
- end
76
-
77
- def bind(options={})
78
- connect(options) unless connecting?
79
- begin
80
- @bind_tried = true
81
-
82
- bind_dn = (options[:bind_dn] || @bind_dn).to_s
83
- try_sasl = options.has_key?(:try_sasl) ? options[:try_sasl] : @try_sasl
84
- if options.has_key?(:allow_anonymous)
85
- allow_anonymous = options[:allow_anonymous]
86
- else
87
- allow_anonymous = @allow_anonymous
88
- end
89
- # Rough bind loop:
90
- # Attempt 1: SASL if available
91
- # Attempt 2: SIMPLE with credentials if password block
92
- # Attempt 3: SIMPLE ANONYMOUS if 1 and 2 fail and allow anonymous is set to true
93
- if try_sasl and sasl_bind(bind_dn, options)
94
- puts "bound with sasl"
95
- elsif simple_bind(bind_dn, options)
96
- puts "bound with simple"
97
- elsif allow_anonymous and bind_as_anonymous(options)
98
- puts "bound as anonymous"
99
- else
100
- message = yield if block_given?
101
- message ||= ('All authentication methods for %s exhausted.') % target
102
- raise AuthenticationError, message
103
- end
104
- @bound = true
105
- rescue Net::LDAP::LdapError
106
- raise AuthenticationError, $!.message
107
- end
108
- end
109
-
110
- def disconnect!(options={})
111
- unbind(options)
112
- @connection = @uri = @with_start_tls = nil
113
- @disconnected = true
114
- end
115
-
116
- def rebind(options={})
117
- unbind(options) if bound?
118
- connect(options)
119
- end
120
-
121
- def connecting?
122
- !@connection.nil? and !@disconnected
123
- end
124
-
125
- def bound?
126
- connecting? and @bound
127
- end
128
-
129
- def search(options={}, &block)
130
- base = options[:base]
131
- filter = options[:filter]
132
- limit = options[:limit]
133
-
134
- args = {
135
- :base => @base,
136
- :filter => filter,
137
- :size => limit
138
- }
139
-
140
- attributes = {}
141
- execute(:search, args) do |entry|
142
- entry.attribute_names.each do |name|
143
- attributes[name] = entry[name]
144
- end
145
- end
146
- attributes
147
- end
148
-
149
- private
150
-
151
- def execute(method, *args, &block)
152
- result = @connection.send(method, *args, &block)
153
- message = nil
154
-
155
- if result.is_a?(Hash)
156
- message = result[:errorMessage]
157
- result = result[:resultCode]
158
- end
159
-
160
- unless result.zero?
161
- message = [Net::LDAP.result2string(result), message].compact.join(": ")
162
- raise LdapError, message
163
- end
164
- end
165
-
166
- def ensure_port(method)
167
- if method == :ssl
168
- URI::LDAPS::DEFAULT_PORT
169
- else
170
- URI::LDAP::DEFAULT_PORT
171
- end
172
- end
173
-
174
- def prepare_connection(options)
175
- end
176
-
177
- def ensure_method(method)
178
- method ||= "plain"
179
- normalized_method = method.to_s.downcase.to_sym
180
- return METHOD[normalized_method] if METHOD.has_key?(normalized_method)
181
-
182
- available_methods = METHOD.keys.collect {|m| m.inspect}.join(", ")
183
- format = "%s is not one of the available connect methods: %s"
184
- raise ConfigurationError, format % [method.inspect, available_methods]
185
- end
186
-
187
- def sasl_bind(bind_dn, options={})
188
- sasl_mechanisms = options[:sasl_mechanisms] || @sasl_mechanisms
189
- sasl_mechanisms.each do |mechanism|
190
- begin
191
- normalized_mechanism = mechanism.downcase.gsub(/-/, '_')
192
- sasl_bind_setup = "sasl_bind_setup_#{normalized_mechanism}"
193
- next unless respond_to?(sasl_bind_setup, true)
194
- initial_credential, challenge_response = send(sasl_bind_setup, bind_dn, options)
195
-
196
- args = {
197
- :method => :sasl,
198
- :initial_credential => initial_credential,
199
- :mechanism => mechanism,
200
- :challenge_response => challenge_response,
201
- }
202
-
203
- info = {
204
- :name => "bind: SASL", :dn => bind_dn, :mechanism => mechanism,
205
- }
206
-
207
- execute(:bind, args)
208
- return true
209
-
210
- rescue Exception => e
211
- puts e.message
212
- end
213
- end
214
- false
215
- end
216
-
217
- def sasl_bind_setup_digest_md5(bind_dn, options)
218
- initial_credential = ""
219
- challenge_response = Proc.new do |cred|
220
- pref = SASL::Preferences.new :digest_uri => "ldap/#{@host}", :username => bind_dn, :has_password? => true, :password => options[:password]||@password
221
- sasl = SASL.new("DIGEST-MD5", pref)
222
- response = sasl.receive("challenge", cred)
223
- response[1]
224
- end
225
- [initial_credential, challenge_response]
226
- end
227
-
228
- def sasl_bind_setup_gss_spnego(bind_dn, options)
229
- puts options.inspect
230
- user,psw = [bind_dn, options[:password]||@password]
231
- raise LdapError.new( "invalid binding information" ) unless (user && psw)
232
-
233
- nego = proc {|challenge|
234
- t2_msg = Net::NTLM::Message.parse( challenge )
235
- user, domain = user.split('\\').reverse
236
- t2_msg.target_name = Net::NTLM::encode_utf16le(domain) if domain
237
- t3_msg = t2_msg.response( {:user => user, :password => psw}, {:ntlmv2 => true} )
238
- t3_msg.serialize
239
- }
240
- [Net::NTLM::Message::Type1.new.serialize, nego]
241
- end
242
-
243
- def simple_bind(bind_dn, options={})
244
- args = {
245
- :method => :simple,
246
- :username => bind_dn,
247
- :password => (options[:password]||@password).to_s,
248
- }
249
- begin
250
- raise AuthenticationError if args[:password] == ""
251
- execute(:bind, args)
252
- true
253
- rescue Exception
254
- false
255
- end
256
- end
257
-
258
- def bind_as_anonymous(options={})
259
- execute(:bind, {:method => :anonymous})
260
- true
261
- end
262
-
263
- def construct_uri(host, port, ssl)
264
- protocol = ssl ? "ldaps" : "ldap"
265
- URI.parse("#{protocol}://#{host}:#{port}").to_s
266
- end
267
-
268
- def target
269
- return nil if @uri.nil?
270
- if @with_start_tls
271
- "#{@uri}(StartTLS)"
272
- else
273
- @uri
274
- end
275
- end
276
- end
277
- end
278
- end
279
- end
@@ -1,19 +0,0 @@
1
- module OmniAuth
2
- module Version
3
- unless defined?(::OmniAuth::Version::MAJOR)
4
- MAJOR = 0
5
- end
6
- unless defined?(::OmniAuth::Version::MINOR)
7
- MINOR = 2
8
- end
9
- unless defined?(::OmniAuth::Version::PATCH)
10
- PATCH = 6
11
- end
12
- unless defined?(::OmniAuth::Version::PRE)
13
- PRE = nil
14
- end
15
- unless defined?(::OmniAuth::Version::STRING)
16
- STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
17
- end
18
- end
19
- end
@@ -1,31 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/omniauth/version', __FILE__)
3
-
4
- Gem::Specification.new do |gem|
5
- gem.add_runtime_dependency 'addressable', '2.2.4'
6
- gem.add_runtime_dependency 'nokogiri', '~> 1.4.2'
7
- gem.add_runtime_dependency 'net-ldap', '~> 0.2.2'
8
- gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING
9
- gem.add_runtime_dependency 'pyu-ruby-sasl', '~> 0.0.3.1'
10
- gem.add_runtime_dependency 'rubyntlm', '~> 0.1.1'
11
- gem.add_development_dependency 'maruku', '~> 0.6'
12
- gem.add_development_dependency 'simplecov', '~> 0.4'
13
- gem.add_development_dependency 'rack-test', '~> 0.5'
14
- gem.add_development_dependency 'rake', '~> 0.8'
15
- gem.add_development_dependency 'rspec', '~> 2.5'
16
- gem.add_development_dependency 'webmock', '~> 1.6'
17
- gem.add_development_dependency 'yard', '~> 0.7'
18
- gem.add_development_dependency 'ZenTest', '~> 4.5'
19
- gem.name = 'oa-enterprise'
20
- gem.version = OmniAuth::Version::STRING
21
- gem.description = %q{Enterprise strategies for OmniAuth.}
22
- gem.summary = gem.description
23
- gem.email = ['james.a.rosen@gmail.com', 'ping@intridea.com', 'michael@intridea.com', 'sferik@gmail.com']
24
- gem.homepage = 'http://github.com/intridea/omniauth'
25
- gem.authors = ['James A. Rosen', 'Ping Yu', 'Michael Bleigh', 'Erik Michaels-Ober']
26
- gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
27
- gem.files = `git ls-files`.split("\n")
28
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
29
- gem.require_paths = ['lib']
30
- gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if gem.respond_to? :required_rubygems_version=
31
- end
@@ -1,4 +0,0 @@
1
- <cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
2
- <cas:authenticationFailure>
3
- </cas:authenticationFailure>
4
- </cas:serviceResponse>
@@ -1,8 +0,0 @@
1
- <cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
2
- <cas:authenticationSuccess>
3
- <cas:user>psegel</cas:user>
4
- <cas:first-name>Peter</cas:first-name>
5
- <cas:last-name>Segel</cas:last-name>
6
- <hire-date>2004-07-13</hire-date>
7
- </cas:authenticationSuccess>
8
- </cas:serviceResponse>
@@ -1,94 +0,0 @@
1
- require File.expand_path('../../../spec_helper', __FILE__)
2
- require 'cgi'
3
-
4
- describe OmniAuth::Strategies::CAS, :type => :strategy do
5
-
6
- include OmniAuth::Test::StrategyTestCase
7
-
8
- def strategy
9
- @cas_server ||= 'https://cas.example.org'
10
- [OmniAuth::Strategies::CAS, {:cas_server => @cas_server}]
11
- end
12
-
13
- describe 'GET /auth/cas' do
14
- before do
15
- get '/auth/cas'
16
- end
17
-
18
- it 'should redirect to the CAS server' do
19
- last_response.should be_redirect
20
- return_to = CGI.escape(last_request.url + '/callback')
21
- last_response.headers['Location'].should == @cas_server + '/login?service=' + return_to
22
- end
23
- end
24
-
25
- describe 'GET /auth/cas/callback without a ticket' do
26
- before do
27
- get '/auth/cas/callback'
28
- end
29
- it 'should fail' do
30
- last_response.should be_redirect
31
- last_response.headers['Location'].should =~ /no_ticket/
32
- end
33
- end
34
-
35
- describe 'GET /auth/cas/callback with an invalid ticket' do
36
- before do
37
- stub_request(:get, /^https:\/\/cas.example.org(:443)?\/serviceValidate\?([^&]+&)?ticket=9391d/).
38
- to_return(:body => File.read(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cas_failure.xml')))
39
- get '/auth/cas/callback?ticket=9391d'
40
- end
41
- it 'should fail' do
42
- last_response.should be_redirect
43
- last_response.headers['Location'].should =~ /invalid_ticket/
44
- end
45
- end
46
-
47
- describe 'GET /auth/cas/callback with a valid ticket' do
48
- before do
49
- stub_request(:get, /^https:\/\/cas.example.org(:443)?\/serviceValidate\?([^&]+&)?ticket=593af/).
50
- with { |request| @request_uri = request.uri.to_s }.
51
- to_return(:body => File.read(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cas_success.xml')))
52
- get '/auth/cas/callback?ticket=593af'
53
- end
54
-
55
- it 'should strip the ticket parameter from the callback URL before sending it to the CAS server' do
56
- @request_uri.scan('ticket=').length.should == 1
57
- end
58
-
59
- sets_an_auth_hash
60
- sets_provider_to 'cas'
61
- sets_uid_to 'psegel'
62
-
63
- it 'should set additional user information' do
64
- extra = (last_request.env['omniauth.auth'] || {})['extra']
65
- extra.should be_kind_of(Hash)
66
- extra['first-name'].should == 'Peter'
67
- extra['last-name'].should == 'Segel'
68
- extra['hire-date'].should == '2004-07-13'
69
- end
70
-
71
- it 'should call through to the master app' do
72
- last_response.body.should == 'true'
73
- end
74
- end
75
-
76
- unless RUBY_VERSION =~ /^1\.8\.\d$/
77
- describe 'GET /auth/cas/callback with a valid ticket and gzipped response from the server on ruby >1.8' do
78
- before do
79
- zipped = StringIO.new
80
- Zlib::GzipWriter.wrap zipped do |io|
81
- io.write File.read(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cas_success.xml'))
82
- end
83
- stub_request(:get, /^https:\/\/cas.example.org(:443)?\/serviceValidate\?([^&]+&)?ticket=593af/).
84
- with { |request| @request_uri = request.uri.to_s }.
85
- to_return(:body => zipped.string, :headers => { 'content-encoding' => 'gzip' })
86
- get '/auth/cas/callback?ticket=593af'
87
- end
88
-
89
- it 'should call through to the master app when response is gzipped' do
90
- last_response.body.should == 'true'
91
- end
92
- end
93
- end
94
- end
@@ -1,41 +0,0 @@
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