omniauth-myspace 0.0.1
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/.gitignore +17 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +36 -0
- data/Rakefile +7 -0
- data/lib/omniauth-myspace.rb +1 -0
- data/lib/omniauth/myspace.rb +2 -0
- data/lib/omniauth/myspace/version.rb +5 -0
- data/lib/omniauth/strategies/myspace.rb +39 -0
- data/omniauth-myspace.gemspec +23 -0
- data/spec/omniauth/strategies/myspace_spec.rb +332 -0
- data/spec/shared_examples.rb +38 -0
- data/spec/spec_helper.rb +7 -0
- metadata +108 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 John Ferlito
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Omniauth::Myspace
|
2
|
+
|
3
|
+
MySpace OAuth2 strategy for OmniAuth 1.0
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'omniauth-myspace'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install omniauth-myspace
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
25
|
+
provider :myspace, ENV['MYSPACE_KEY'], ENV['MYSPACE_SECRET']
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
1. Fork it
|
33
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
34
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
35
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
36
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'omniauth/myspace'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'omniauth-oauth'
|
2
|
+
require 'multi_json'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class Myspace < OmniAuth::Strategies::OAuth
|
7
|
+
option :name, 'myspace'
|
8
|
+
|
9
|
+
option :client_options, {
|
10
|
+
:site => 'http://api.myspace.com',
|
11
|
+
:authorize_path => '/authorize',
|
12
|
+
:access_token_path => '/access_token',
|
13
|
+
:request_token_path => '/request_token',
|
14
|
+
:http_method => 'get',
|
15
|
+
}
|
16
|
+
|
17
|
+
uid { raw_info['id'] }
|
18
|
+
|
19
|
+
info do
|
20
|
+
{
|
21
|
+
:id => raw_info['id'],
|
22
|
+
:nickname => raw_info['nickname'],
|
23
|
+
:name => raw_info['displayName'],
|
24
|
+
:image => raw_info['thumbnailUrl'],
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
extra do
|
29
|
+
{
|
30
|
+
'raw_info' => raw_info
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
def raw_info
|
35
|
+
@raw_info ||= MultiJson.decode(access_token.get('/v2/people/@me/@self?format=json').body)['entry']
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth/myspace/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["John Ferlito"]
|
6
|
+
gem.email = ["johnf@inodes.org"]
|
7
|
+
gem.description = %q{MySpace strategy for omniauth}
|
8
|
+
gem.summary = %q{MySpace strategy for omniauth}
|
9
|
+
gem.homepage = 'https://github.com/johnf/omniauth-myspace'
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "omniauth-myspace"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = OmniAuth::Myspace::VERSION
|
17
|
+
|
18
|
+
gem.add_runtime_dependency 'omniauth-oauth'
|
19
|
+
gem.add_runtime_dependency 'multi_json'
|
20
|
+
|
21
|
+
gem.add_development_dependency 'rspec'
|
22
|
+
gem.add_development_dependency 'rake'
|
23
|
+
end
|
@@ -0,0 +1,332 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'omniauth-myspace'
|
3
|
+
#require 'openssl'
|
4
|
+
#require 'base64'
|
5
|
+
|
6
|
+
describe OmniAuth::Strategies::Myspace do
|
7
|
+
it_should_behave_like 'an oauth2 strategy'
|
8
|
+
|
9
|
+
# before :each do
|
10
|
+
# @request = double('Request')
|
11
|
+
# @request.stub(:params) { {} }
|
12
|
+
# @request.stub(:cookies) { {} }
|
13
|
+
#
|
14
|
+
# @client_id = '123'
|
15
|
+
# @client_secret = '53cr3tz'
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# subject do
|
19
|
+
# args = [@client_id, @client_secret, @options].compact
|
20
|
+
# OmniAuth::Strategies::Facebook.new(nil, *args).tap do |strategy|
|
21
|
+
# strategy.stub(:request) { @request }
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
#
|
26
|
+
# describe '#client' do
|
27
|
+
# it 'has correct Facebook site' do
|
28
|
+
# subject.client.site.should eq('https://graph.facebook.com')
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# it 'has correct authorize url' do
|
32
|
+
# subject.client.options[:authorize_url].should eq('/oauth/authorize')
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# it 'has correct token url' do
|
36
|
+
# subject.client.options[:token_url].should eq('/oauth/access_token')
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
#
|
40
|
+
# describe '#callback_url' do
|
41
|
+
# it "returns value from #authorize_options" do
|
42
|
+
# url = 'http://auth.myapp.com/auth/fb/callback'
|
43
|
+
# @options = { :authorize_options => { :callback_url => url } }
|
44
|
+
# subject.callback_url.should eq(url)
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# it "callback_url from request" do
|
48
|
+
# url_base = 'http://auth.request.com'
|
49
|
+
# @request.stub(:url) { "#{url_base}/page/path" }
|
50
|
+
# subject.stub(:script_name) { "" } # to not depend from Rack env
|
51
|
+
# subject.callback_url.should eq("#{url_base}/auth/facebook/callback")
|
52
|
+
# end
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# describe '#authorize_params' do
|
56
|
+
# it 'includes default scope for email and offline access' do
|
57
|
+
# subject.authorize_params.should be_a(Hash)
|
58
|
+
# subject.authorize_params[:scope].should eq('email,offline_access')
|
59
|
+
# end
|
60
|
+
#
|
61
|
+
# it 'includes display parameter from request when present' do
|
62
|
+
# @request.stub(:params) { { 'display' => 'touch' } }
|
63
|
+
# subject.authorize_params.should be_a(Hash)
|
64
|
+
# subject.authorize_params[:display].should eq('touch')
|
65
|
+
# end
|
66
|
+
#
|
67
|
+
# it 'includes state parameter from request when present' do
|
68
|
+
# @request.stub(:params) { { 'state' => 'some_state' } }
|
69
|
+
# subject.authorize_params.should be_a(Hash)
|
70
|
+
# subject.authorize_params[:state].should eq('some_state')
|
71
|
+
# end
|
72
|
+
# end
|
73
|
+
#
|
74
|
+
# describe '#token_params' do
|
75
|
+
# it 'has correct parse strategy' do
|
76
|
+
# subject.token_params[:parse].should eq(:query)
|
77
|
+
# end
|
78
|
+
# end
|
79
|
+
#
|
80
|
+
# describe '#access_token_options' do
|
81
|
+
# it 'has correct param name by default' do
|
82
|
+
# subject.access_token_options[:param_name].should eq('access_token')
|
83
|
+
# end
|
84
|
+
#
|
85
|
+
# it 'has correct header format by default' do
|
86
|
+
# subject.access_token_options[:header_format].should eq('OAuth %s')
|
87
|
+
# end
|
88
|
+
# end
|
89
|
+
#
|
90
|
+
# describe '#uid' do
|
91
|
+
# before :each do
|
92
|
+
# subject.stub(:raw_info) { { 'id' => '123' } }
|
93
|
+
# end
|
94
|
+
#
|
95
|
+
# it 'returns the id from raw_info' do
|
96
|
+
# subject.uid.should eq('123')
|
97
|
+
# end
|
98
|
+
# end
|
99
|
+
#
|
100
|
+
# describe '#info' do
|
101
|
+
# before :each do
|
102
|
+
# @raw_info ||= { 'name' => 'Fred Smith' }
|
103
|
+
# subject.stub(:raw_info) { @raw_info }
|
104
|
+
# end
|
105
|
+
#
|
106
|
+
# context 'when optional data is not present in raw info' do
|
107
|
+
# it 'has no email key' do
|
108
|
+
# subject.info.should_not have_key('email')
|
109
|
+
# end
|
110
|
+
#
|
111
|
+
# it 'has no nickname key' do
|
112
|
+
# subject.info.should_not have_key('nickname')
|
113
|
+
# end
|
114
|
+
#
|
115
|
+
# it 'has no first name key' do
|
116
|
+
# subject.info.should_not have_key('first_name')
|
117
|
+
# end
|
118
|
+
#
|
119
|
+
# it 'has no last name key' do
|
120
|
+
# subject.info.should_not have_key('last_name')
|
121
|
+
# end
|
122
|
+
#
|
123
|
+
# it 'has no location key' do
|
124
|
+
# subject.info.should_not have_key('location')
|
125
|
+
# end
|
126
|
+
#
|
127
|
+
# it 'has no description key' do
|
128
|
+
# subject.info.should_not have_key('description')
|
129
|
+
# end
|
130
|
+
#
|
131
|
+
# it 'has no urls' do
|
132
|
+
# subject.info.should_not have_key('urls')
|
133
|
+
# end
|
134
|
+
# end
|
135
|
+
#
|
136
|
+
# context 'when data is present in raw info' do
|
137
|
+
# it 'returns the name' do
|
138
|
+
# subject.info['name'].should eq('Fred Smith')
|
139
|
+
# end
|
140
|
+
#
|
141
|
+
# it 'returns the email' do
|
142
|
+
# @raw_info['email'] = 'fred@smith.com'
|
143
|
+
# subject.info['email'].should eq('fred@smith.com')
|
144
|
+
# end
|
145
|
+
#
|
146
|
+
# it 'returns the username as nickname' do
|
147
|
+
# @raw_info['username'] = 'fredsmith'
|
148
|
+
# subject.info['nickname'].should eq('fredsmith')
|
149
|
+
# end
|
150
|
+
#
|
151
|
+
# it 'returns the first name' do
|
152
|
+
# @raw_info['first_name'] = 'Fred'
|
153
|
+
# subject.info['first_name'].should eq('Fred')
|
154
|
+
# end
|
155
|
+
#
|
156
|
+
# it 'returns the last name' do
|
157
|
+
# @raw_info['last_name'] = 'Smith'
|
158
|
+
# subject.info['last_name'].should eq('Smith')
|
159
|
+
# end
|
160
|
+
#
|
161
|
+
# it 'returns the location name as location' do
|
162
|
+
# @raw_info['location'] = { 'id' => '104022926303756', 'name' => 'Palo Alto, California' }
|
163
|
+
# subject.info['location'].should eq('Palo Alto, California')
|
164
|
+
# end
|
165
|
+
#
|
166
|
+
# it 'returns bio as description' do
|
167
|
+
# @raw_info['bio'] = 'I am great'
|
168
|
+
# subject.info['description'].should eq('I am great')
|
169
|
+
# end
|
170
|
+
#
|
171
|
+
# it 'returns the square format facebook avatar url' do
|
172
|
+
# @raw_info['id'] = '321'
|
173
|
+
# subject.info['image'].should eq('http://graph.facebook.com/321/picture?type=square')
|
174
|
+
# end
|
175
|
+
#
|
176
|
+
# it 'returns the Facebook link as the Facebook url' do
|
177
|
+
# @raw_info['link'] = 'http://www.facebook.com/fredsmith'
|
178
|
+
# subject.info['urls'].should be_a(Hash)
|
179
|
+
# subject.info['urls']['Facebook'].should eq('http://www.facebook.com/fredsmith')
|
180
|
+
# end
|
181
|
+
#
|
182
|
+
# it 'returns website url' do
|
183
|
+
# @raw_info['website'] = 'https://my-wonderful-site.com'
|
184
|
+
# subject.info['urls'].should be_a(Hash)
|
185
|
+
# subject.info['urls']['Website'].should eq('https://my-wonderful-site.com')
|
186
|
+
# end
|
187
|
+
#
|
188
|
+
# it 'return both Facebook link and website urls' do
|
189
|
+
# @raw_info['link'] = 'http://www.facebook.com/fredsmith'
|
190
|
+
# @raw_info['website'] = 'https://my-wonderful-site.com'
|
191
|
+
# subject.info['urls'].should be_a(Hash)
|
192
|
+
# subject.info['urls']['Facebook'].should eq('http://www.facebook.com/fredsmith')
|
193
|
+
# subject.info['urls']['Website'].should eq('https://my-wonderful-site.com')
|
194
|
+
# end
|
195
|
+
# end
|
196
|
+
# end
|
197
|
+
#
|
198
|
+
# describe '#raw_info' do
|
199
|
+
# before :each do
|
200
|
+
# @access_token = double('OAuth2::AccessToken')
|
201
|
+
# subject.stub(:access_token) { @access_token }
|
202
|
+
# end
|
203
|
+
#
|
204
|
+
# it 'performs a GET to https://graph.facebook.com/me' do
|
205
|
+
# @access_token.stub(:get) { double('OAuth2::Response').as_null_object }
|
206
|
+
# @access_token.should_receive(:get).with('/me')
|
207
|
+
# subject.raw_info
|
208
|
+
# end
|
209
|
+
#
|
210
|
+
# it 'returns a Hash' do
|
211
|
+
# @access_token.stub(:get).with('/me') do
|
212
|
+
# raw_response = double('Faraday::Response')
|
213
|
+
# raw_response.stub(:body) { '{ "ohai": "thar" }' }
|
214
|
+
# raw_response.stub(:status) { 200 }
|
215
|
+
# raw_response.stub(:headers) { { 'Content-Type' => 'application/json' } }
|
216
|
+
# OAuth2::Response.new(raw_response)
|
217
|
+
# end
|
218
|
+
# subject.raw_info.should be_a(Hash)
|
219
|
+
# subject.raw_info['ohai'].should eq('thar')
|
220
|
+
# end
|
221
|
+
# end
|
222
|
+
#
|
223
|
+
# describe '#credentials' do
|
224
|
+
# before :each do
|
225
|
+
# @access_token = double('OAuth2::AccessToken')
|
226
|
+
# @access_token.stub(:token)
|
227
|
+
# @access_token.stub(:expires?)
|
228
|
+
# @access_token.stub(:expires_at)
|
229
|
+
# @access_token.stub(:refresh_token)
|
230
|
+
# subject.stub(:access_token) { @access_token }
|
231
|
+
# end
|
232
|
+
#
|
233
|
+
# it 'returns a Hash' do
|
234
|
+
# subject.credentials.should be_a(Hash)
|
235
|
+
# end
|
236
|
+
#
|
237
|
+
# it 'returns the token' do
|
238
|
+
# @access_token.stub(:token) { '123' }
|
239
|
+
# subject.credentials['token'].should eq('123')
|
240
|
+
# end
|
241
|
+
#
|
242
|
+
# it 'returns the expiry status' do
|
243
|
+
# @access_token.stub(:expires?) { true }
|
244
|
+
# subject.credentials['expires'].should eq(true)
|
245
|
+
#
|
246
|
+
# @access_token.stub(:expires?) { false }
|
247
|
+
# subject.credentials['expires'].should eq(false)
|
248
|
+
# end
|
249
|
+
#
|
250
|
+
# it 'returns the refresh token and expiry time when expiring' do
|
251
|
+
# ten_mins_from_now = (Time.now + 600).to_i
|
252
|
+
# @access_token.stub(:expires?) { true }
|
253
|
+
# @access_token.stub(:refresh_token) { '321' }
|
254
|
+
# @access_token.stub(:expires_at) { ten_mins_from_now }
|
255
|
+
# subject.credentials['refresh_token'].should eq('321')
|
256
|
+
# subject.credentials['expires_at'].should eq(ten_mins_from_now)
|
257
|
+
# end
|
258
|
+
#
|
259
|
+
# it 'does not return the refresh token when it is nil and expiring' do
|
260
|
+
# @access_token.stub(:expires?) { true }
|
261
|
+
# @access_token.stub(:refresh_token) { nil }
|
262
|
+
# subject.credentials['refresh_token'].should be_nil
|
263
|
+
# subject.credentials.should_not have_key('refresh_token')
|
264
|
+
# end
|
265
|
+
#
|
266
|
+
# it 'does not return the refresh token when not expiring' do
|
267
|
+
# @access_token.stub(:expires?) { false }
|
268
|
+
# @access_token.stub(:refresh_token) { 'XXX' }
|
269
|
+
# subject.credentials['refresh_token'].should be_nil
|
270
|
+
# subject.credentials.should_not have_key('refresh_token')
|
271
|
+
# end
|
272
|
+
# end
|
273
|
+
#
|
274
|
+
# describe '#extra' do
|
275
|
+
# before :each do
|
276
|
+
# @raw_info = { 'name' => 'Fred Smith' }
|
277
|
+
# subject.stub(:raw_info) { @raw_info }
|
278
|
+
# end
|
279
|
+
#
|
280
|
+
# it 'returns a Hash' do
|
281
|
+
# subject.extra.should be_a(Hash)
|
282
|
+
# end
|
283
|
+
#
|
284
|
+
# it 'contains raw info' do
|
285
|
+
# subject.extra.should eq({ 'raw_info' => @raw_info })
|
286
|
+
# end
|
287
|
+
# end
|
288
|
+
#
|
289
|
+
# describe '#signed_request' do
|
290
|
+
# context 'cookie not present' do
|
291
|
+
# it 'is nil' do
|
292
|
+
# subject.send(:signed_request).should be_nil
|
293
|
+
# end
|
294
|
+
# end
|
295
|
+
#
|
296
|
+
# context 'cookie present' do
|
297
|
+
# before :each do
|
298
|
+
# @payload = {
|
299
|
+
# 'algorithm' => 'HMAC-SHA256',
|
300
|
+
# 'code' => 'm4c0d3z',
|
301
|
+
# 'issued_at' => Time.now.to_i,
|
302
|
+
# 'user_id' => '123456'
|
303
|
+
# }
|
304
|
+
#
|
305
|
+
# @request.stub(:cookies) do
|
306
|
+
# { "fbsr_#{@client_id}" => signed_request(@payload, @client_secret) }
|
307
|
+
# end
|
308
|
+
# end
|
309
|
+
#
|
310
|
+
# it 'parses the access code out from the cookie' do
|
311
|
+
# subject.send(:signed_request).should eq(@payload)
|
312
|
+
# end
|
313
|
+
# end
|
314
|
+
# end
|
315
|
+
#
|
316
|
+
#private
|
317
|
+
#
|
318
|
+
# def signed_request(payload, secret)
|
319
|
+
# encoded_payload = base64_encode_url(MultiJson.encode(payload))
|
320
|
+
# encoded_signature = base64_encode_url(signature(encoded_payload, secret))
|
321
|
+
# [encoded_signature, encoded_payload].join('.')
|
322
|
+
# end
|
323
|
+
#
|
324
|
+
# def base64_encode_url(value)
|
325
|
+
# Base64.encode64(value).tr('+/', '-_').gsub(/\n/, '')
|
326
|
+
# end
|
327
|
+
#
|
328
|
+
# def signature(payload, secret, algorithm = OpenSSL::Digest::SHA256.new)
|
329
|
+
# OpenSSL::HMAC.digest(algorithm, secret, payload)
|
330
|
+
# end
|
331
|
+
end
|
332
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# NOTE it would be useful if this lived in omniauth-oauth2 eventually
|
2
|
+
shared_examples 'an oauth2 strategy' do
|
3
|
+
describe '#client' do
|
4
|
+
it 'should be initialized with symbolized client_options' do
|
5
|
+
@options = { :client_options => { 'authorize_url' => 'https://example.com' } }
|
6
|
+
subject.client.options[:authorize_url].should == 'https://example.com'
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#authorize_params' do
|
11
|
+
it 'should include any authorize params passed in the :authorize_params option' do
|
12
|
+
@options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
|
13
|
+
subject.authorize_params['foo'].should eq('bar')
|
14
|
+
subject.authorize_params['baz'].should eq('zip')
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should include top-level options that are marked as :authorize_options' do
|
18
|
+
@options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
19
|
+
subject.authorize_params['scope'].should eq('bar')
|
20
|
+
subject.authorize_params['foo'].should eq('baz')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#token_params' do
|
25
|
+
it 'should include any authorize params passed in the :authorize_params option' do
|
26
|
+
@options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
|
27
|
+
subject.token_params['foo'].should eq('bar')
|
28
|
+
subject.token_params['baz'].should eq('zip')
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should include top-level options that are marked as :authorize_options' do
|
32
|
+
@options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
33
|
+
subject.token_params['scope'].should eq('bar')
|
34
|
+
subject.token_params['foo'].should eq('baz')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-myspace
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- John Ferlito
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-03-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth-oauth
|
16
|
+
requirement: &11921880 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *11921880
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: multi_json
|
27
|
+
requirement: &11986000 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *11986000
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &12020000 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *12020000
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: &12076380 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *12076380
|
58
|
+
description: MySpace strategy for omniauth
|
59
|
+
email:
|
60
|
+
- johnf@inodes.org
|
61
|
+
executables: []
|
62
|
+
extensions: []
|
63
|
+
extra_rdoc_files: []
|
64
|
+
files:
|
65
|
+
- .gitignore
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- lib/omniauth-myspace.rb
|
71
|
+
- lib/omniauth/myspace.rb
|
72
|
+
- lib/omniauth/myspace/version.rb
|
73
|
+
- lib/omniauth/strategies/myspace.rb
|
74
|
+
- omniauth-myspace.gemspec
|
75
|
+
- spec/omniauth/strategies/myspace_spec.rb
|
76
|
+
- spec/shared_examples.rb
|
77
|
+
- spec/spec_helper.rb
|
78
|
+
homepage: https://github.com/johnf/omniauth-myspace
|
79
|
+
licenses: []
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
hash: -1586874147567145780
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
hash: -1586874147567145780
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 1.8.11
|
105
|
+
signing_key:
|
106
|
+
specification_version: 3
|
107
|
+
summary: MySpace strategy for omniauth
|
108
|
+
test_files: []
|