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,186 +0,0 @@
1
- require 'omniauth/core'
2
-
3
- module OmniAuth
4
- class Form
5
- DEFAULT_CSS = <<-CSS
6
- body {
7
- background: #ccc;
8
- font-family: "Lucida Grande", "Lucida Sans", Helvetica, Arial, sans-serif;
9
- }
10
-
11
- h1 {
12
- text-align: center;
13
- margin: 30px auto 0px;
14
- font-size: 18px;
15
- padding: 10px 10px 15px;
16
- background: #555;
17
- color: white;
18
- width: 320px;
19
- border: 10px solid #444;
20
- border-bottom: 0;
21
- -moz-border-radius-topleft: 10px;
22
- -moz-border-radius-topright: 10px;
23
- -webkit-border-top-left-radius: 10px;
24
- -webkit-border-top-right-radius: 10px;
25
- border-top-left-radius: 10px;
26
- border-top-right-radius: 10px;
27
- }
28
-
29
- h1, form {
30
- -moz-box-shadow: 2px 2px 7px rgba(0,0,0,0.3);
31
- -webkit-box-shadow: 2px 2px 7px rgba(0,0,0,0.3);
32
- }
33
-
34
- form {
35
- background: white;
36
- border: 10px solid #eee;
37
- border-top: 0;
38
- padding: 20px;
39
- margin: 0px auto 40px;
40
- width: 300px;
41
- -moz-border-radius-bottomleft: 10px;
42
- -moz-border-radius-bottomright: 10px;
43
- -webkit-border-bottom-left-radius: 10px;
44
- -webkit-border-bottom-right-radius: 10px;
45
- border-bottom-left-radius: 10px;
46
- border-bottom-right-radius: 10px;
47
- }
48
-
49
- label {
50
- display: block;
51
- font-weight: bold;
52
- margin-bottom: 5px;
53
- }
54
-
55
- input {
56
- font-size: 18px;
57
- padding: 4px 8px;
58
- display: block;
59
- margin-bottom: 10px;
60
- width: 280px;
61
- }
62
-
63
- input#identifier, input#openid_url {
64
- background: url(http://openid.net/login-bg.gif) no-repeat;
65
- background-position: 0 50%;
66
- padding-left: 18px;
67
- }
68
-
69
- button {
70
- font-size: 22px;
71
- padding: 4px 8px;
72
- display: block;
73
- margin: 20px auto 0;
74
- }
75
-
76
- fieldset {
77
- border: 1px solid #ccc;
78
- border-left: 0;
79
- border-right: 0;
80
- padding: 10px 0;
81
- }
82
-
83
- fieldset input {
84
- width: 260px;
85
- font-size: 16px;
86
- }
87
- CSS
88
-
89
- attr_accessor :options
90
-
91
- def initialize(options = {})
92
- options[:title] ||= "Authentication Info Required"
93
- options[:header_info] ||= ""
94
- self.options = options
95
-
96
- @html = ""
97
- header(options[:title],options[:header_info])
98
- end
99
-
100
- def self.build(title=nil,&block)
101
- form = OmniAuth::Form.new(title)
102
- form.instance_eval(&block)
103
- end
104
-
105
- def label_field(text, target)
106
- @html << "\n<label for='#{target}'>#{text}:</label>"
107
- self
108
- end
109
-
110
- def input_field(type, name)
111
- @html << "\n<input type='#{type}' id='#{name}' name='#{name}'/>"
112
- self
113
- end
114
-
115
- def text_field(label, name)
116
- label_field(label, name)
117
- input_field('text', name)
118
- self
119
- end
120
-
121
- def password_field(label, name)
122
- label_field(label, name)
123
- input_field('password', name)
124
- self
125
- end
126
-
127
- def button(text)
128
- @html << "\n<button type='submit'>#{text}</button>"
129
- end
130
-
131
- def html(html)
132
- @html << html
133
- end
134
-
135
- def fieldset(legend, options = {}, &block)
136
- @html << "\n<fieldset#{" style='#{options[:style]}'" if options[:style]}#{" id='#{options[:id]}'" if options[:id]}>\n <legend>#{legend}</legend>\n"
137
- self.instance_eval &block
138
- @html << "\n</fieldset>"
139
- self
140
- end
141
-
142
- def header(title,header_info)
143
- @html << <<-HTML
144
- <!DOCTYPE html>
145
- <html>
146
- <head>
147
- <title>#{title}</title>
148
- #{css}
149
- #{header_info}
150
- </head>
151
- <body>
152
- <h1>#{title}</h1>
153
- <form method='post' #{"action='#{options[:url]}' " if options[:url]}noValidate='noValidate'>
154
- HTML
155
- self
156
- end
157
-
158
- def footer
159
- return self if @footer
160
- @html << <<-HTML
161
- <button type='submit'>Connect</button>
162
- </form>
163
- </body>
164
- </html>
165
- HTML
166
- @footer = true
167
- self
168
- end
169
-
170
- def to_html
171
- footer
172
- @html
173
- end
174
-
175
- def to_response
176
- footer
177
- Rack::Response.new(@html).finish
178
- end
179
-
180
- protected
181
-
182
- def css
183
- "\n<style type='text/css'>#{OmniAuth.config.form_css}</style>"
184
- end
185
- end
186
- end
@@ -1,227 +0,0 @@
1
- require 'omniauth/core'
2
-
3
- module OmniAuth
4
- class NoSessionError < StandardError; end
5
- # The Strategy is the base unit of OmniAuth's ability to
6
- # wrangle multiple providers. Each strategy provided by
7
- # OmniAuth includes this mixin to gain the default functionality
8
- # necessary to be compatible with the OmniAuth library.
9
- module Strategy
10
- def self.included(base)
11
- OmniAuth.strategies << base
12
- base.class_eval do
13
- attr_reader :app, :name, :env, :options, :response
14
- end
15
- end
16
-
17
- def initialize(app, name, *args, &block)
18
- @app = app
19
- @name = name.to_sym
20
- @options = args.last.is_a?(Hash) ? args.pop : {}
21
-
22
- yield self if block_given?
23
- end
24
-
25
- def inspect
26
- "#<#{self.class.to_s}>"
27
- end
28
-
29
- def call(env)
30
- dup.call!(env)
31
- end
32
-
33
- def call!(env)
34
- raise OmniAuth::NoSessionError.new("You must provide a session to use OmniAuth.") unless env['rack.session']
35
-
36
- @env = env
37
- @env['omniauth.strategy'] = self if on_auth_path?
38
-
39
- return mock_call!(env) if OmniAuth.config.test_mode
40
-
41
- return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
42
- return callback_call if on_callback_path?
43
- return other_phase if respond_to?(:other_phase)
44
- @app.call(env)
45
- end
46
-
47
- # Performs the steps necessary to run the request phase of a strategy.
48
- def request_call
49
- setup_phase
50
- if response = call_through_to_app
51
- response
52
- else
53
- if request.params['origin']
54
- @env['rack.session']['omniauth.origin'] = request.params['origin']
55
- elsif env['HTTP_REFERER'] && !env['HTTP_REFERER'].match(/#{request_path}$/)
56
- @env['rack.session']['omniauth.origin'] = env['HTTP_REFERER']
57
- end
58
- request_phase
59
- end
60
- end
61
-
62
- # Performs the steps necessary to run the callback phase of a strategy.
63
- def callback_call
64
- setup_phase
65
- @env['omniauth.origin'] = session.delete('omniauth.origin')
66
- @env['omniauth.origin'] = nil if env['omniauth.origin'] == ''
67
-
68
- callback_phase
69
- end
70
-
71
- def on_auth_path?
72
- on_request_path? || on_callback_path?
73
- end
74
-
75
- def on_request_path?
76
- current_path.casecmp(request_path) == 0
77
- end
78
-
79
- def on_callback_path?
80
- current_path.casecmp(callback_path) == 0
81
- end
82
-
83
- def mock_call!(env)
84
- return mock_request_call if on_request_path?
85
- return mock_callback_call if on_callback_path?
86
- call_app!
87
- end
88
-
89
- def mock_request_call
90
- setup_phase
91
- return response if response = call_through_to_app
92
-
93
- if request.params['origin']
94
- @env['rack.session']['omniauth.origin'] = request.params['origin']
95
- elsif env['HTTP_REFERER'] && !env['HTTP_REFERER'].match(/#{request_path}$/)
96
- @env['rack.session']['omniauth.origin'] = env['HTTP_REFERER']
97
- end
98
- redirect(script_name + callback_path)
99
- end
100
-
101
- def mock_callback_call
102
- setup_phase
103
- mocked_auth = OmniAuth.mock_auth_for(name.to_sym)
104
- if mocked_auth.is_a?(Symbol)
105
- fail!(mocked_auth)
106
- else
107
- @env['omniauth.auth'] = mocked_auth
108
- @env['omniauth.origin'] = session.delete('omniauth.origin')
109
- @env['omniauth.origin'] = nil if env['omniauth.origin'] == ''
110
- call_app!
111
- end
112
- end
113
-
114
- def setup_phase
115
- if options[:setup].respond_to?(:call)
116
- options[:setup].call(env)
117
- elsif options[:setup]
118
- setup_env = env.merge('PATH_INFO' => setup_path, 'REQUEST_METHOD' => 'GET')
119
- call_app!(setup_env)
120
- end
121
- end
122
-
123
- def request_phase
124
- raise NotImplementedError
125
- end
126
-
127
- def callback_phase
128
- @env['omniauth.auth'] = auth_hash
129
- call_app!
130
- end
131
-
132
- def path_prefix
133
- options[:path_prefix] || OmniAuth.config.path_prefix
134
- end
135
-
136
- def request_path
137
- options[:request_path] || "#{path_prefix}/#{name}"
138
- end
139
-
140
- def callback_path
141
- options[:callback_path] || "#{path_prefix}/#{name}/callback"
142
- end
143
-
144
- def setup_path
145
- options[:setup_path] || "#{path_prefix}/#{name}/setup"
146
- end
147
-
148
- def current_path
149
- request.path_info.downcase.sub(/\/$/,'')
150
- end
151
-
152
- def query_string
153
- request.query_string.empty? ? "" : "?#{request.query_string}"
154
- end
155
-
156
- def call_through_to_app
157
- status, headers, body = *call_app!
158
- @response = Rack::Response.new(body, status, headers)
159
-
160
- status == 404 ? nil : @response.finish
161
- end
162
-
163
- def call_app!(env = @env)
164
- @app.call(env)
165
- end
166
-
167
- def auth_hash
168
- {
169
- 'provider' => name.to_s,
170
- 'uid' => nil
171
- }
172
- end
173
-
174
- def full_host
175
- case OmniAuth.config.full_host
176
- when String
177
- OmniAuth.config.full_host
178
- when Proc
179
- OmniAuth.config.full_host.call(env)
180
- else
181
- uri = URI.parse(request.url.gsub(/\?.*$/,''))
182
- uri.path = ''
183
- uri.query = nil
184
- uri.to_s
185
- end
186
- end
187
-
188
- def callback_url
189
- full_host + script_name + callback_path + query_string
190
- end
191
-
192
- def script_name
193
- @env['SCRIPT_NAME'] || ''
194
- end
195
-
196
- def session
197
- @env['rack.session']
198
- end
199
-
200
- def request
201
- @request ||= Rack::Request.new(@env)
202
- end
203
-
204
- def redirect(uri)
205
- r = Rack::Response.new
206
-
207
- if options[:iframe]
208
- r.write("<script type='text/javascript' charset='utf-8'>top.location.href = '#{uri}';</script>")
209
- else
210
- r.write("Redirecting to #{uri}...")
211
- r.redirect(uri)
212
- end
213
-
214
- r.finish
215
- end
216
-
217
- def user_info; {} end
218
-
219
- def fail!(message_key, exception = nil)
220
- self.env['omniauth.error'] = exception
221
- self.env['omniauth.error.type'] = message_key.to_sym
222
- self.env['omniauth.error.strategy'] = self
223
-
224
- OmniAuth.config.on_failure.call(self.env)
225
- end
226
- end
227
- end
@@ -1,12 +0,0 @@
1
- module OmniAuth
2
-
3
- # Support for testing OmniAuth strategies.
4
- module Test
5
-
6
- autoload :PhonySession, 'omniauth/test/phony_session'
7
- autoload :StrategyMacros, 'omniauth/test/strategy_macros'
8
- autoload :StrategyTestCase, 'omniauth/test/strategy_test_case'
9
-
10
- end
11
-
12
- end
@@ -1,8 +0,0 @@
1
- class OmniAuth::Test::PhonySession
2
- def initialize(app); @app = app end
3
- def call(env)
4
- @session ||= (env['rack.session'] || {})
5
- env['rack.session'] = @session
6
- @app.call(env)
7
- end
8
- end
@@ -1,34 +0,0 @@
1
- module OmniAuth
2
-
3
- module Test
4
-
5
- module StrategyMacros
6
-
7
- def sets_an_auth_hash
8
- it 'should set an auth hash' do
9
- last_request.env['omniauth.auth'].should be_kind_of(Hash)
10
- end
11
- end
12
-
13
- def sets_provider_to(provider)
14
- it "should set the provider to #{provider}" do
15
- (last_request.env['omniauth.auth'] || {})['provider'].should == provider
16
- end
17
- end
18
-
19
- def sets_uid_to(uid)
20
- it "should set the UID to #{uid}" do
21
- (last_request.env['omniauth.auth'] || {})['uid'].should == uid
22
- end
23
- end
24
-
25
- def sets_user_info_to(user_info)
26
- it "should set the user_info to #{user_info}" do
27
- (last_request.env['omniauth.auth'] || {})['user_info'].should == user_info
28
- end
29
- end
30
- end
31
-
32
- end
33
-
34
- end