devise_oauth2_providable 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/app/models/access_token.rb +3 -6
- data/config/routes.rb +3 -2
- data/lib/devise_oauth2_providable/schema.rb +1 -0
- data/lib/devise_oauth2_providable/version.rb +1 -1
- data/lib/token_endpoint.rb +1 -2
- data/spec/rails_app/.gitignore +4 -0
- data/spec/rails_app/.rspec +1 -0
- data/spec/rails_app/Gemfile +35 -0
- data/spec/rails_app/README +256 -0
- data/spec/rails_app/Rakefile +7 -0
- data/spec/rails_app/app/controllers/application_controller.rb +3 -0
- data/spec/rails_app/app/helpers/application_helper.rb +2 -0
- data/spec/rails_app/app/models/user.rb +3 -0
- data/spec/rails_app/app/views/layouts/application.html.erb +14 -0
- data/spec/rails_app/config/application.rb +42 -0
- data/spec/rails_app/config/boot.rb +6 -0
- data/spec/rails_app/config/database.yml +22 -0
- data/spec/rails_app/config/environment.rb +5 -0
- data/spec/rails_app/config/environments/development.rb +26 -0
- data/spec/rails_app/config/environments/production.rb +49 -0
- data/spec/rails_app/config/environments/test.rb +35 -0
- data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_app/config/initializers/devise.rb +194 -0
- data/spec/rails_app/config/initializers/inflections.rb +10 -0
- data/spec/rails_app/config/initializers/mime_types.rb +5 -0
- data/spec/rails_app/config/initializers/secret_token.rb +7 -0
- data/spec/rails_app/config/initializers/session_store.rb +8 -0
- data/spec/rails_app/config/locales/devise.en.yml +50 -0
- data/spec/rails_app/config/locales/en.yml +5 -0
- data/spec/rails_app/config/routes.rb +60 -0
- data/spec/rails_app/config.ru +4 -0
- data/spec/rails_app/db/migrate/20110511210818_create_oauth2_schema.rb +8 -0
- data/spec/rails_app/db/migrate/20110511210926_create_users.rb +14 -0
- data/spec/rails_app/db/schema.rb +78 -0
- data/spec/rails_app/db/seeds.rb +7 -0
- data/spec/rails_app/doc/README_FOR_APP +2 -0
- data/spec/rails_app/lib/tasks/.gitkeep +0 -0
- data/spec/rails_app/public/404.html +26 -0
- data/spec/rails_app/public/422.html +26 -0
- data/spec/rails_app/public/500.html +26 -0
- data/spec/rails_app/public/favicon.ico +0 -0
- data/spec/rails_app/public/images/rails.png +0 -0
- data/spec/rails_app/public/index.html +239 -0
- data/spec/rails_app/public/javascripts/.gitkeep +0 -0
- data/spec/rails_app/public/javascripts/application.js +0 -0
- data/spec/rails_app/public/robots.txt +5 -0
- data/spec/rails_app/public/stylesheets/.gitkeep +0 -0
- data/spec/rails_app/script/rails +6 -0
- data/spec/rails_app/spec/integration/token_endpoint_spec.rb +59 -0
- data/spec/rails_app/spec/models/access_token_spec.rb +17 -0
- data/spec/rails_app/spec/models/client_spec.rb +12 -0
- data/spec/rails_app/spec/models/user_spec.rb +8 -0
- data/spec/rails_app/spec/spec_helper.rb +27 -0
- data/spec/rails_app/vendor/plugins/.gitkeep +0 -0
- metadata +103 -7
- data/spec/token_endpoint_spec.rb +0 -27
@@ -0,0 +1,239 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Ruby on Rails: Welcome aboard</title>
|
5
|
+
<style type="text/css" media="screen">
|
6
|
+
body {
|
7
|
+
margin: 0;
|
8
|
+
margin-bottom: 25px;
|
9
|
+
padding: 0;
|
10
|
+
background-color: #f0f0f0;
|
11
|
+
font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
|
12
|
+
font-size: 13px;
|
13
|
+
color: #333;
|
14
|
+
}
|
15
|
+
|
16
|
+
h1 {
|
17
|
+
font-size: 28px;
|
18
|
+
color: #000;
|
19
|
+
}
|
20
|
+
|
21
|
+
a {color: #03c}
|
22
|
+
a:hover {
|
23
|
+
background-color: #03c;
|
24
|
+
color: white;
|
25
|
+
text-decoration: none;
|
26
|
+
}
|
27
|
+
|
28
|
+
|
29
|
+
#page {
|
30
|
+
background-color: #f0f0f0;
|
31
|
+
width: 750px;
|
32
|
+
margin: 0;
|
33
|
+
margin-left: auto;
|
34
|
+
margin-right: auto;
|
35
|
+
}
|
36
|
+
|
37
|
+
#content {
|
38
|
+
float: left;
|
39
|
+
background-color: white;
|
40
|
+
border: 3px solid #aaa;
|
41
|
+
border-top: none;
|
42
|
+
padding: 25px;
|
43
|
+
width: 500px;
|
44
|
+
}
|
45
|
+
|
46
|
+
#sidebar {
|
47
|
+
float: right;
|
48
|
+
width: 175px;
|
49
|
+
}
|
50
|
+
|
51
|
+
#footer {
|
52
|
+
clear: both;
|
53
|
+
}
|
54
|
+
|
55
|
+
|
56
|
+
#header, #about, #getting-started {
|
57
|
+
padding-left: 75px;
|
58
|
+
padding-right: 30px;
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
#header {
|
63
|
+
background-image: url("images/rails.png");
|
64
|
+
background-repeat: no-repeat;
|
65
|
+
background-position: top left;
|
66
|
+
height: 64px;
|
67
|
+
}
|
68
|
+
#header h1, #header h2 {margin: 0}
|
69
|
+
#header h2 {
|
70
|
+
color: #888;
|
71
|
+
font-weight: normal;
|
72
|
+
font-size: 16px;
|
73
|
+
}
|
74
|
+
|
75
|
+
|
76
|
+
#about h3 {
|
77
|
+
margin: 0;
|
78
|
+
margin-bottom: 10px;
|
79
|
+
font-size: 14px;
|
80
|
+
}
|
81
|
+
|
82
|
+
#about-content {
|
83
|
+
background-color: #ffd;
|
84
|
+
border: 1px solid #fc0;
|
85
|
+
margin-left: -55px;
|
86
|
+
margin-right: -10px;
|
87
|
+
}
|
88
|
+
#about-content table {
|
89
|
+
margin-top: 10px;
|
90
|
+
margin-bottom: 10px;
|
91
|
+
font-size: 11px;
|
92
|
+
border-collapse: collapse;
|
93
|
+
}
|
94
|
+
#about-content td {
|
95
|
+
padding: 10px;
|
96
|
+
padding-top: 3px;
|
97
|
+
padding-bottom: 3px;
|
98
|
+
}
|
99
|
+
#about-content td.name {color: #555}
|
100
|
+
#about-content td.value {color: #000}
|
101
|
+
|
102
|
+
#about-content ul {
|
103
|
+
padding: 0;
|
104
|
+
list-style-type: none;
|
105
|
+
}
|
106
|
+
|
107
|
+
#about-content.failure {
|
108
|
+
background-color: #fcc;
|
109
|
+
border: 1px solid #f00;
|
110
|
+
}
|
111
|
+
#about-content.failure p {
|
112
|
+
margin: 0;
|
113
|
+
padding: 10px;
|
114
|
+
}
|
115
|
+
|
116
|
+
|
117
|
+
#getting-started {
|
118
|
+
border-top: 1px solid #ccc;
|
119
|
+
margin-top: 25px;
|
120
|
+
padding-top: 15px;
|
121
|
+
}
|
122
|
+
#getting-started h1 {
|
123
|
+
margin: 0;
|
124
|
+
font-size: 20px;
|
125
|
+
}
|
126
|
+
#getting-started h2 {
|
127
|
+
margin: 0;
|
128
|
+
font-size: 14px;
|
129
|
+
font-weight: normal;
|
130
|
+
color: #333;
|
131
|
+
margin-bottom: 25px;
|
132
|
+
}
|
133
|
+
#getting-started ol {
|
134
|
+
margin-left: 0;
|
135
|
+
padding-left: 0;
|
136
|
+
}
|
137
|
+
#getting-started li {
|
138
|
+
font-size: 18px;
|
139
|
+
color: #888;
|
140
|
+
margin-bottom: 25px;
|
141
|
+
}
|
142
|
+
#getting-started li h2 {
|
143
|
+
margin: 0;
|
144
|
+
font-weight: normal;
|
145
|
+
font-size: 18px;
|
146
|
+
color: #333;
|
147
|
+
}
|
148
|
+
#getting-started li p {
|
149
|
+
color: #555;
|
150
|
+
font-size: 13px;
|
151
|
+
}
|
152
|
+
|
153
|
+
|
154
|
+
#sidebar ul {
|
155
|
+
margin-left: 0;
|
156
|
+
padding-left: 0;
|
157
|
+
}
|
158
|
+
#sidebar ul h3 {
|
159
|
+
margin-top: 25px;
|
160
|
+
font-size: 16px;
|
161
|
+
padding-bottom: 10px;
|
162
|
+
border-bottom: 1px solid #ccc;
|
163
|
+
}
|
164
|
+
#sidebar li {
|
165
|
+
list-style-type: none;
|
166
|
+
}
|
167
|
+
#sidebar ul.links li {
|
168
|
+
margin-bottom: 5px;
|
169
|
+
}
|
170
|
+
|
171
|
+
</style>
|
172
|
+
<script type="text/javascript">
|
173
|
+
function about() {
|
174
|
+
info = document.getElementById('about-content');
|
175
|
+
if (window.XMLHttpRequest)
|
176
|
+
{ xhr = new XMLHttpRequest(); }
|
177
|
+
else
|
178
|
+
{ xhr = new ActiveXObject("Microsoft.XMLHTTP"); }
|
179
|
+
xhr.open("GET","rails/info/properties",false);
|
180
|
+
xhr.send("");
|
181
|
+
info.innerHTML = xhr.responseText;
|
182
|
+
info.style.display = 'block'
|
183
|
+
}
|
184
|
+
</script>
|
185
|
+
</head>
|
186
|
+
<body>
|
187
|
+
<div id="page">
|
188
|
+
<div id="sidebar">
|
189
|
+
<ul id="sidebar-items">
|
190
|
+
<li>
|
191
|
+
<h3>Browse the documentation</h3>
|
192
|
+
<ul class="links">
|
193
|
+
<li><a href="http://api.rubyonrails.org/">Rails API</a></li>
|
194
|
+
<li><a href="http://stdlib.rubyonrails.org/">Ruby standard library</a></li>
|
195
|
+
<li><a href="http://corelib.rubyonrails.org/">Ruby core</a></li>
|
196
|
+
<li><a href="http://guides.rubyonrails.org/">Rails Guides</a></li>
|
197
|
+
</ul>
|
198
|
+
</li>
|
199
|
+
</ul>
|
200
|
+
</div>
|
201
|
+
|
202
|
+
<div id="content">
|
203
|
+
<div id="header">
|
204
|
+
<h1>Welcome aboard</h1>
|
205
|
+
<h2>You’re riding Ruby on Rails!</h2>
|
206
|
+
</div>
|
207
|
+
|
208
|
+
<div id="about">
|
209
|
+
<h3><a href="rails/info/properties" onclick="about(); return false">About your application’s environment</a></h3>
|
210
|
+
<div id="about-content" style="display: none"></div>
|
211
|
+
</div>
|
212
|
+
|
213
|
+
<div id="getting-started">
|
214
|
+
<h1>Getting started</h1>
|
215
|
+
<h2>Here’s how to get rolling:</h2>
|
216
|
+
|
217
|
+
<ol>
|
218
|
+
<li>
|
219
|
+
<h2>Use <code>rails generate</code> to create your models and controllers</h2>
|
220
|
+
<p>To see all available options, run it without parameters.</p>
|
221
|
+
</li>
|
222
|
+
|
223
|
+
<li>
|
224
|
+
<h2>Set up a default route and remove or rename this file</h2>
|
225
|
+
<p>Routes are set up in config/routes.rb.</p>
|
226
|
+
</li>
|
227
|
+
|
228
|
+
<li>
|
229
|
+
<h2>Create your database</h2>
|
230
|
+
<p>Run <code>rake db:migrate</code> to create your database. If you're not using SQLite (the default), edit <code>config/database.yml</code> with your username and password.</p>
|
231
|
+
</li>
|
232
|
+
</ol>
|
233
|
+
</div>
|
234
|
+
</div>
|
235
|
+
|
236
|
+
<div id="footer"> </div>
|
237
|
+
</div>
|
238
|
+
</body>
|
239
|
+
</html>
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe TokenEndpoint do
|
4
|
+
describe 'password grant type' do
|
5
|
+
context 'with valid params' do
|
6
|
+
before do
|
7
|
+
@user = User.create! :email => 'ryan@socialcast.com', :name => 'ryan sonnek', :password => 'test'
|
8
|
+
@client = Client.create! :name => 'example', :redirect_uri => 'http://localhost', :website => 'http://localhost'
|
9
|
+
|
10
|
+
params = {
|
11
|
+
:grant_type => 'password',
|
12
|
+
:client_id => @client.identifier,
|
13
|
+
:client_secret => @client.secret,
|
14
|
+
:username => @user.email,
|
15
|
+
:password => 'test'
|
16
|
+
}
|
17
|
+
|
18
|
+
post '/oauth2/token', params
|
19
|
+
end
|
20
|
+
it { response.code.to_i.should == 200 }
|
21
|
+
it 'returns json' do
|
22
|
+
token = AccessToken.last
|
23
|
+
refresh_token = RefreshToken.last
|
24
|
+
expected = {
|
25
|
+
:token_type => 'bearer',
|
26
|
+
:expires_in => 899,
|
27
|
+
:refresh_token => refresh_token.token,
|
28
|
+
:access_token => token.token
|
29
|
+
}
|
30
|
+
response.body.should == expected.to_json
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'with invalid params' do
|
35
|
+
before do
|
36
|
+
@user = User.create! :email => 'ryan@socialcast.com', :name => 'ryan sonnek', :password => 'test'
|
37
|
+
@client = Client.create! :name => 'example', :redirect_uri => 'http://localhost', :website => 'http://localhost'
|
38
|
+
|
39
|
+
params = {
|
40
|
+
:grant_type => 'password',
|
41
|
+
:client_id => @client.identifier,
|
42
|
+
:client_secret => @client.secret,
|
43
|
+
:username => @user.email,
|
44
|
+
:password => 'bar'
|
45
|
+
}
|
46
|
+
|
47
|
+
post '/oauth2/token', params
|
48
|
+
end
|
49
|
+
it { response.code.to_i.should == 400 }
|
50
|
+
it 'returns json' do
|
51
|
+
expected = {
|
52
|
+
:error_description => "The provided access grant is invalid, expired, or revoked (e.g. invalid assertion, expired authorization token, bad end-user password credentials, or mismatching authorization code and redirection URI).",
|
53
|
+
:error => "invalid_grant"
|
54
|
+
}
|
55
|
+
response.body.should == expected.to_json
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AccessToken do
|
4
|
+
describe 'basic access token instance' do
|
5
|
+
subject do
|
6
|
+
client = Client.create! :name => 'test', :redirect_uri => 'http://localhost:3000', :website => 'http://localhost'
|
7
|
+
AccessToken.create! :client => client
|
8
|
+
end
|
9
|
+
it { should validate_presence_of :token }
|
10
|
+
it { should validate_uniqueness_of :token }
|
11
|
+
it { should belong_to :user }
|
12
|
+
it { should belong_to :client }
|
13
|
+
it { should validate_presence_of :client }
|
14
|
+
it { should validate_presence_of :expires_at }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Client do
|
4
|
+
describe 'basic client instance' do
|
5
|
+
subject { Client.create! :name => 'test', :redirect_uri => 'http://localhost:3000', :website => 'http://localhost' }
|
6
|
+
it { should validate_presence_of :name }
|
7
|
+
it { should validate_presence_of :website }
|
8
|
+
it { should validate_presence_of :redirect_uri }
|
9
|
+
it { should validate_uniqueness_of :identifier }
|
10
|
+
it { should have_many :refresh_tokens }
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
require File.expand_path("../../config/environment", __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
|
6
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
7
|
+
# in spec/support/ and its subdirectories.
|
8
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
# == Mock Framework
|
12
|
+
#
|
13
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
14
|
+
#
|
15
|
+
# config.mock_with :mocha
|
16
|
+
# config.mock_with :flexmock
|
17
|
+
# config.mock_with :rr
|
18
|
+
config.mock_with :rspec
|
19
|
+
|
20
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
21
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
22
|
+
|
23
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
24
|
+
# examples within a transaction, remove the following line or assign false
|
25
|
+
# instead of true.
|
26
|
+
config.use_transactional_fixtures = true
|
27
|
+
end
|
File without changes
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_oauth2_providable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Sonnek
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-05-
|
18
|
+
date: 2011-05-12 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rails
|
@@ -117,9 +117,57 @@ files:
|
|
117
117
|
- lib/expirable_token.rb
|
118
118
|
- lib/token_endpoint.rb
|
119
119
|
- spec/devise_oauth2_providable_spec.rb
|
120
|
+
- spec/rails_app/.gitignore
|
121
|
+
- spec/rails_app/.rspec
|
122
|
+
- spec/rails_app/Gemfile
|
123
|
+
- spec/rails_app/README
|
124
|
+
- spec/rails_app/Rakefile
|
125
|
+
- spec/rails_app/app/controllers/application_controller.rb
|
126
|
+
- spec/rails_app/app/helpers/application_helper.rb
|
127
|
+
- spec/rails_app/app/models/user.rb
|
128
|
+
- spec/rails_app/app/views/layouts/application.html.erb
|
129
|
+
- spec/rails_app/config.ru
|
130
|
+
- spec/rails_app/config/application.rb
|
131
|
+
- spec/rails_app/config/boot.rb
|
132
|
+
- spec/rails_app/config/database.yml
|
133
|
+
- spec/rails_app/config/environment.rb
|
134
|
+
- spec/rails_app/config/environments/development.rb
|
135
|
+
- spec/rails_app/config/environments/production.rb
|
136
|
+
- spec/rails_app/config/environments/test.rb
|
137
|
+
- spec/rails_app/config/initializers/backtrace_silencers.rb
|
138
|
+
- spec/rails_app/config/initializers/devise.rb
|
139
|
+
- spec/rails_app/config/initializers/inflections.rb
|
140
|
+
- spec/rails_app/config/initializers/mime_types.rb
|
141
|
+
- spec/rails_app/config/initializers/secret_token.rb
|
142
|
+
- spec/rails_app/config/initializers/session_store.rb
|
143
|
+
- spec/rails_app/config/locales/devise.en.yml
|
144
|
+
- spec/rails_app/config/locales/en.yml
|
145
|
+
- spec/rails_app/config/routes.rb
|
146
|
+
- spec/rails_app/db/migrate/20110511210818_create_oauth2_schema.rb
|
147
|
+
- spec/rails_app/db/migrate/20110511210926_create_users.rb
|
148
|
+
- spec/rails_app/db/schema.rb
|
149
|
+
- spec/rails_app/db/seeds.rb
|
150
|
+
- spec/rails_app/doc/README_FOR_APP
|
151
|
+
- spec/rails_app/lib/tasks/.gitkeep
|
152
|
+
- spec/rails_app/public/404.html
|
153
|
+
- spec/rails_app/public/422.html
|
154
|
+
- spec/rails_app/public/500.html
|
155
|
+
- spec/rails_app/public/favicon.ico
|
156
|
+
- spec/rails_app/public/images/rails.png
|
157
|
+
- spec/rails_app/public/index.html
|
158
|
+
- spec/rails_app/public/javascripts/.gitkeep
|
159
|
+
- spec/rails_app/public/javascripts/application.js
|
160
|
+
- spec/rails_app/public/robots.txt
|
161
|
+
- spec/rails_app/public/stylesheets/.gitkeep
|
162
|
+
- spec/rails_app/script/rails
|
163
|
+
- spec/rails_app/spec/integration/token_endpoint_spec.rb
|
164
|
+
- spec/rails_app/spec/models/access_token_spec.rb
|
165
|
+
- spec/rails_app/spec/models/client_spec.rb
|
166
|
+
- spec/rails_app/spec/models/user_spec.rb
|
167
|
+
- spec/rails_app/spec/spec_helper.rb
|
168
|
+
- spec/rails_app/vendor/plugins/.gitkeep
|
120
169
|
- spec/setup_database.rb
|
121
170
|
- spec/spec_helper.rb
|
122
|
-
- spec/token_endpoint_spec.rb
|
123
171
|
homepage: ""
|
124
172
|
licenses: []
|
125
173
|
|
@@ -149,12 +197,60 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
197
|
requirements: []
|
150
198
|
|
151
199
|
rubyforge_project: devise_oauth2_providable
|
152
|
-
rubygems_version: 1.
|
200
|
+
rubygems_version: 1.8.1
|
153
201
|
signing_key:
|
154
202
|
specification_version: 3
|
155
203
|
summary: OAuth2 Provider for Rails3 applications
|
156
204
|
test_files:
|
157
205
|
- spec/devise_oauth2_providable_spec.rb
|
206
|
+
- spec/rails_app/.gitignore
|
207
|
+
- spec/rails_app/.rspec
|
208
|
+
- spec/rails_app/Gemfile
|
209
|
+
- spec/rails_app/README
|
210
|
+
- spec/rails_app/Rakefile
|
211
|
+
- spec/rails_app/app/controllers/application_controller.rb
|
212
|
+
- spec/rails_app/app/helpers/application_helper.rb
|
213
|
+
- spec/rails_app/app/models/user.rb
|
214
|
+
- spec/rails_app/app/views/layouts/application.html.erb
|
215
|
+
- spec/rails_app/config.ru
|
216
|
+
- spec/rails_app/config/application.rb
|
217
|
+
- spec/rails_app/config/boot.rb
|
218
|
+
- spec/rails_app/config/database.yml
|
219
|
+
- spec/rails_app/config/environment.rb
|
220
|
+
- spec/rails_app/config/environments/development.rb
|
221
|
+
- spec/rails_app/config/environments/production.rb
|
222
|
+
- spec/rails_app/config/environments/test.rb
|
223
|
+
- spec/rails_app/config/initializers/backtrace_silencers.rb
|
224
|
+
- spec/rails_app/config/initializers/devise.rb
|
225
|
+
- spec/rails_app/config/initializers/inflections.rb
|
226
|
+
- spec/rails_app/config/initializers/mime_types.rb
|
227
|
+
- spec/rails_app/config/initializers/secret_token.rb
|
228
|
+
- spec/rails_app/config/initializers/session_store.rb
|
229
|
+
- spec/rails_app/config/locales/devise.en.yml
|
230
|
+
- spec/rails_app/config/locales/en.yml
|
231
|
+
- spec/rails_app/config/routes.rb
|
232
|
+
- spec/rails_app/db/migrate/20110511210818_create_oauth2_schema.rb
|
233
|
+
- spec/rails_app/db/migrate/20110511210926_create_users.rb
|
234
|
+
- spec/rails_app/db/schema.rb
|
235
|
+
- spec/rails_app/db/seeds.rb
|
236
|
+
- spec/rails_app/doc/README_FOR_APP
|
237
|
+
- spec/rails_app/lib/tasks/.gitkeep
|
238
|
+
- spec/rails_app/public/404.html
|
239
|
+
- spec/rails_app/public/422.html
|
240
|
+
- spec/rails_app/public/500.html
|
241
|
+
- spec/rails_app/public/favicon.ico
|
242
|
+
- spec/rails_app/public/images/rails.png
|
243
|
+
- spec/rails_app/public/index.html
|
244
|
+
- spec/rails_app/public/javascripts/.gitkeep
|
245
|
+
- spec/rails_app/public/javascripts/application.js
|
246
|
+
- spec/rails_app/public/robots.txt
|
247
|
+
- spec/rails_app/public/stylesheets/.gitkeep
|
248
|
+
- spec/rails_app/script/rails
|
249
|
+
- spec/rails_app/spec/integration/token_endpoint_spec.rb
|
250
|
+
- spec/rails_app/spec/models/access_token_spec.rb
|
251
|
+
- spec/rails_app/spec/models/client_spec.rb
|
252
|
+
- spec/rails_app/spec/models/user_spec.rb
|
253
|
+
- spec/rails_app/spec/spec_helper.rb
|
254
|
+
- spec/rails_app/vendor/plugins/.gitkeep
|
158
255
|
- spec/setup_database.rb
|
159
256
|
- spec/spec_helper.rb
|
160
|
-
- spec/token_endpoint_spec.rb
|
data/spec/token_endpoint_spec.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'token_endpoint'
|
3
|
-
require 'active_record'
|
4
|
-
require File.join(File.dirname(__FILE__), '..', 'app', 'models', 'client')
|
5
|
-
|
6
|
-
describe TokenEndpoint do
|
7
|
-
#FIXME
|
8
|
-
describe 'refresh_token grant type' do
|
9
|
-
before do
|
10
|
-
params = {
|
11
|
-
:grant_type => 'refresh_token',
|
12
|
-
:client_id => 'client_id',
|
13
|
-
:code => 'authorization_code',
|
14
|
-
:redirect_uri => 'http://client.example.com/callback'
|
15
|
-
}
|
16
|
-
|
17
|
-
request = Rack::MockRequest.new TokenEndpoint.new
|
18
|
-
@response = request.post('/', :params => params)
|
19
|
-
end
|
20
|
-
it 'should create new access token' do
|
21
|
-
|
22
|
-
end
|
23
|
-
it { @response.status.should == 200 }
|
24
|
-
it { @response.content_type.should == 'application/json' }
|
25
|
-
it { @response.body.should include '"access_token"' }
|
26
|
-
end
|
27
|
-
end
|