devise_oauth2_providable 0.3.8 → 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +33 -2
- data/README.md +23 -11
- data/Rakefile +8 -1
- data/app/controllers/devise/oauth2_providable/authorizations_controller.rb +59 -0
- data/app/controllers/{oauth2 → devise/oauth2_providable}/tokens_controller.rb +1 -1
- data/app/models/{access_token.rb → devise/oauth2_providable/access_token.rb} +1 -1
- data/app/models/{authorization_code.rb → devise/oauth2_providable/authorization_code.rb} +1 -1
- data/app/models/{client.rb → devise/oauth2_providable/client.rb} +2 -1
- data/app/models/{refresh_token.rb → devise/oauth2_providable/refresh_token.rb} +1 -1
- data/app/views/{oauth2 → devise/oauth2_providable}/authorizations/_form.html.erb +1 -1
- data/app/views/{oauth2 → devise/oauth2_providable}/authorizations/error.html.erb +0 -0
- data/app/views/devise/oauth2_providable/authorizations/new.html.erb +4 -0
- data/config/routes.rb +6 -6
- data/db/migrate/20111014160714_create_devise_oauth2_providable_schema.rb +55 -0
- data/devise_oauth2_providable.gemspec +7 -4
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/engine.rb +2 -1
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/models/oauth2_authorization_code_grantable.rb +0 -0
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/models/oauth2_password_grantable.rb +0 -0
- data/lib/devise/oauth2_providable/models/oauth2_providable.rb +13 -0
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/models/oauth2_refresh_token_grantable.rb +0 -0
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/strategies/oauth2_authorization_code_grant_type_strategy.rb +2 -2
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/strategies/oauth2_grant_type_strategy.rb +2 -2
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/strategies/oauth2_password_grant_type_strategy.rb +1 -1
- data/lib/{devise_oauth2_providable/strategy.rb → devise/oauth2_providable/strategies/oauth2_providable_strategy.rb} +1 -1
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/strategies/oauth2_refresh_token_grant_type_strategy.rb +1 -1
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/version.rb +1 -1
- data/lib/devise_oauth2_providable.rb +16 -14
- data/script/rails +6 -0
- data/spec/{rails_app/spec/controllers → controllers}/protected_controller_spec.rb +3 -3
- data/spec/{rails_app → dummy}/Rakefile +2 -2
- data/spec/dummy/app/assets/javascripts/application.js +7 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/{rails_app → dummy}/app/controllers/application_controller.rb +0 -0
- data/spec/{rails_app → dummy}/app/controllers/protected_controller.rb +0 -0
- data/spec/{rails_app → dummy}/app/helpers/application_helper.rb +0 -0
- data/spec/{rails_app/lib/tasks → dummy/app/mailers}/.gitkeep +0 -0
- data/spec/{rails_app/public/javascripts → dummy/app/models}/.gitkeep +0 -0
- data/spec/{rails_app → dummy}/app/models/user.rb +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/{rails_app → dummy}/config/application.rb +10 -7
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/{rails_app → dummy}/config/database.yml +3 -0
- data/spec/{rails_app → dummy}/config/environment.rb +1 -1
- data/spec/{rails_app → dummy}/config/environments/development.rb +8 -4
- data/spec/{rails_app → dummy}/config/environments/production.rb +24 -13
- data/spec/{rails_app → dummy}/config/environments/test.rb +6 -2
- data/spec/{rails_app → dummy}/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/{rails_app → dummy}/config/initializers/devise.rb +29 -17
- data/spec/{rails_app → dummy}/config/initializers/inflections.rb +0 -0
- data/spec/{rails_app → dummy}/config/initializers/mime_types.rb +0 -0
- data/spec/{rails_app → dummy}/config/initializers/secret_token.rb +1 -1
- data/spec/{rails_app → dummy}/config/initializers/session_store.rb +2 -2
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/{rails_app → dummy}/config/locales/devise.en.yml +8 -0
- data/spec/{rails_app → dummy}/config/locales/en.yml +1 -1
- data/spec/dummy/config/routes.rb +7 -0
- data/spec/{rails_app → dummy}/config.ru +1 -1
- data/spec/{rails_app/db/migrate/20110511210926_create_users.rb → dummy/db/migrate/20111014142838_create_users.rb} +1 -7
- data/spec/dummy/db/migrate/20111014161437_create_devise_oauth2_providable_schema.rb +55 -0
- data/spec/dummy/db/schema.rb +78 -0
- data/spec/{rails_app/public/stylesheets → dummy/lib/assets}/.gitkeep +0 -0
- data/spec/{rails_app/vendor/plugins → dummy/log}/.gitkeep +0 -0
- data/spec/{rails_app → dummy}/public/404.html +0 -0
- data/spec/{rails_app → dummy}/public/422.html +0 -0
- data/spec/{rails_app → dummy}/public/500.html +0 -0
- data/spec/{rails_app → dummy}/public/favicon.ico +0 -0
- data/spec/{rails_app → dummy}/script/rails +0 -0
- data/spec/{rails_app/spec/integration → integration}/oauth2_authorization_token_grant_type_strategy_spec.rb +7 -7
- data/spec/{rails_app/spec/integration → integration}/oauth2_password_grant_type_strategy_spec.rb +6 -6
- data/spec/{rails_app/spec/integration → integration}/oauth2_refresh_token_grant_type_strategy_spec.rb +6 -6
- data/spec/{devise_oauth2_providable_spec.rb → lib/devise_oauth2_providable_spec.rb} +0 -0
- data/spec/{rails_app/spec/models → models}/access_token_spec.rb +7 -5
- data/spec/{rails_app/spec/models → models}/authorization_code_spec.rb +3 -3
- data/spec/{rails_app/spec/models → models}/client_spec.rb +5 -2
- data/spec/{rails_app/spec/models → models}/refresh_token_spec.rb +5 -3
- data/spec/models/user_spec.rb +6 -0
- data/spec/{rails_app/spec/routing → routing}/authorizations_routing_spec.rb +1 -1
- data/spec/{rails_app/spec/routing → routing}/tokens_routing_spec.rb +1 -1
- data/spec/spec_helper.rb +14 -20
- data/spec/support/match_json.rb +6 -0
- metadata +204 -162
- data/app/controllers/oauth2/authorizations_controller.rb +0 -55
- data/app/views/oauth2/authorizations/new.html.erb +0 -5
- data/lib/devise_oauth2_providable/model.rb +0 -13
- data/lib/devise_oauth2_providable/schema.rb +0 -61
- data/spec/rails_app/.gitignore +0 -4
- data/spec/rails_app/.rspec +0 -2
- data/spec/rails_app/Gemfile +0 -36
- data/spec/rails_app/README +0 -256
- data/spec/rails_app/app/views/layouts/application.html.erb +0 -14
- data/spec/rails_app/config/boot.rb +0 -6
- data/spec/rails_app/config/routes.rb +0 -61
- data/spec/rails_app/db/migrate/20110511210818_create_oauth2_schema.rb +0 -8
- data/spec/rails_app/db/schema.rb +0 -79
- data/spec/rails_app/db/seeds.rb +0 -7
- data/spec/rails_app/doc/README_FOR_APP +0 -2
- data/spec/rails_app/public/images/rails.png +0 -0
- data/spec/rails_app/public/index.html +0 -239
- data/spec/rails_app/public/javascripts/application.js +0 -0
- data/spec/rails_app/public/robots.txt +0 -5
- data/spec/rails_app/spec/models/user_spec.rb +0 -8
- data/spec/rails_app/spec/spec_helper.rb +0 -36
@@ -1,8 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Client do
|
3
|
+
describe Devise::Oauth2Providable::Client do
|
4
|
+
it { Devise::Oauth2Providable::Client.table_name.should == 'oauth2_clients' }
|
5
|
+
|
4
6
|
describe 'basic client instance' do
|
5
|
-
subject { Client.create! :name => 'test', :redirect_uri => 'http://localhost:3000', :website => 'http://localhost' }
|
7
|
+
subject { Devise::Oauth2Providable::Client.create! :name => 'test', :redirect_uri => 'http://localhost:3000', :website => 'http://localhost' }
|
6
8
|
it { should validate_presence_of :name }
|
7
9
|
it { should validate_uniqueness_of :name }
|
8
10
|
it { should allow_mass_assignment_of :name }
|
@@ -15,5 +17,6 @@ describe Client do
|
|
15
17
|
it { should_not allow_mass_assignment_of :identifier }
|
16
18
|
it { should_not allow_mass_assignment_of :secret }
|
17
19
|
it { should have_many :refresh_tokens }
|
20
|
+
it { should have_many :authorization_codes }
|
18
21
|
end
|
19
22
|
end
|
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe RefreshToken do
|
3
|
+
describe Devise::Oauth2Providable::RefreshToken do
|
4
|
+
it { Devise::Oauth2Providable::RefreshToken.table_name.should == 'oauth2_refresh_tokens' }
|
5
|
+
|
4
6
|
describe 'basic refresh token instance' do
|
5
7
|
subject do
|
6
|
-
client = Client.create! :name => 'test', :redirect_uri => 'http://localhost:3000', :website => 'http://localhost'
|
7
|
-
RefreshToken.create! :client => client
|
8
|
+
client = Devise::Oauth2Providable::Client.create! :name => 'test', :redirect_uri => 'http://localhost:3000', :website => 'http://localhost'
|
9
|
+
Devise::Oauth2Providable::RefreshToken.create! :client => client
|
8
10
|
end
|
9
11
|
it { should validate_presence_of :token }
|
10
12
|
it { should validate_uniqueness_of :token }
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe Devise::Oauth2Providable::AuthorizationsController do
|
4
4
|
describe 'routing' do
|
5
5
|
it 'routes POST /oauth2/authorizations' do
|
6
6
|
{:post => '/oauth2/authorizations'}.should route_to(:controller => 'oauth2/authorizations', :action => 'create')
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe Devise::Oauth2Providable::TokensController do
|
4
4
|
describe 'routing' do
|
5
5
|
it 'routes POST /oauth2/token' do
|
6
6
|
{:post => '/oauth2/token'}.should route_to(:controller => 'oauth2/tokens', :action => 'create')
|
data/spec/spec_helper.rb
CHANGED
@@ -1,29 +1,23 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Configure Rails Envinronment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
3
4
|
|
4
|
-
require '
|
5
|
+
require 'rspec/rails'
|
6
|
+
require 'shoulda-matchers'
|
7
|
+
require 'pry'
|
8
|
+
|
9
|
+
ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
|
5
10
|
|
6
11
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
7
12
|
# in spec/support/ and its subdirectories.
|
8
|
-
|
9
|
-
|
10
|
-
# include Devise::TestHelpers
|
13
|
+
Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
|
11
14
|
|
12
15
|
RSpec.configure do |config|
|
13
|
-
|
14
|
-
#
|
15
|
-
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
16
|
-
#
|
17
|
-
# config.mock_with :mocha
|
18
|
-
# config.mock_with :flexmock
|
19
|
-
# config.mock_with :rr
|
20
|
-
config.mock_with :rspec
|
16
|
+
config.include Devise::TestHelpers, :type => :controller
|
21
17
|
|
22
|
-
|
23
|
-
# config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
18
|
+
config.use_transactional_fixtures = true
|
24
19
|
|
25
|
-
#
|
26
|
-
#
|
27
|
-
|
28
|
-
# config.use_transactional_fixtures = true
|
20
|
+
# enable rendering of views for controller tests
|
21
|
+
# see http://stackoverflow.com/questions/4401539/rspec-2-how-to-render-views-by-default-for-all-controller-specs
|
22
|
+
config.render_views
|
29
23
|
end
|
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_oauth2_providable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 62196353
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
|
9
|
+
- 0
|
10
|
+
- beta
|
11
|
+
- 1
|
12
|
+
version: 1.0.0.beta1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- Ryan Sonnek
|
@@ -15,7 +17,7 @@ autorequire:
|
|
15
17
|
bindir: bin
|
16
18
|
cert_chain: []
|
17
19
|
|
18
|
-
date: 2011-10-
|
20
|
+
date: 2011-10-17 00:00:00 Z
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
21
23
|
name: rails
|
@@ -25,14 +27,14 @@ dependencies:
|
|
25
27
|
requirements:
|
26
28
|
- - ">="
|
27
29
|
- !ruby/object:Gem::Version
|
28
|
-
hash:
|
30
|
+
hash: 3
|
29
31
|
segments:
|
30
32
|
- 3
|
33
|
+
- 1
|
31
34
|
- 0
|
32
|
-
|
33
|
-
version: 3.0.7
|
34
|
-
type: :runtime
|
35
|
+
version: 3.1.0
|
35
36
|
version_requirements: *id001
|
37
|
+
type: :runtime
|
36
38
|
- !ruby/object:Gem::Dependency
|
37
39
|
name: devise
|
38
40
|
prerelease: false
|
@@ -41,14 +43,14 @@ dependencies:
|
|
41
43
|
requirements:
|
42
44
|
- - ">="
|
43
45
|
- !ruby/object:Gem::Version
|
44
|
-
hash:
|
46
|
+
hash: 1
|
45
47
|
segments:
|
46
48
|
- 1
|
49
|
+
- 4
|
47
50
|
- 3
|
48
|
-
|
49
|
-
version: 1.3.3
|
50
|
-
type: :runtime
|
51
|
+
version: 1.4.3
|
51
52
|
version_requirements: *id002
|
53
|
+
type: :runtime
|
52
54
|
- !ruby/object:Gem::Dependency
|
53
55
|
name: rack-oauth2
|
54
56
|
prerelease: false
|
@@ -63,24 +65,75 @@ dependencies:
|
|
63
65
|
- 11
|
64
66
|
- 0
|
65
67
|
version: 0.11.0
|
66
|
-
type: :runtime
|
67
68
|
version_requirements: *id003
|
69
|
+
type: :runtime
|
68
70
|
- !ruby/object:Gem::Dependency
|
69
|
-
name: rspec
|
71
|
+
name: rspec-rails
|
70
72
|
prerelease: false
|
71
73
|
requirement: &id004 !ruby/object:Gem::Requirement
|
72
74
|
none: false
|
73
75
|
requirements:
|
74
|
-
- - "
|
76
|
+
- - "="
|
75
77
|
- !ruby/object:Gem::Version
|
76
|
-
hash:
|
78
|
+
hash: 21
|
77
79
|
segments:
|
78
80
|
- 2
|
79
|
-
-
|
81
|
+
- 6
|
82
|
+
- 1
|
83
|
+
version: 2.6.1
|
84
|
+
version_requirements: *id004
|
85
|
+
type: :development
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: sqlite3
|
88
|
+
prerelease: false
|
89
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - "="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
hash: 19
|
95
|
+
segments:
|
96
|
+
- 1
|
97
|
+
- 3
|
98
|
+
- 4
|
99
|
+
version: 1.3.4
|
100
|
+
version_requirements: *id005
|
101
|
+
type: :development
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: shoulda-matchers
|
104
|
+
prerelease: false
|
105
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - "="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
hash: 62196357
|
111
|
+
segments:
|
112
|
+
- 1
|
80
113
|
- 0
|
81
|
-
|
114
|
+
- 0
|
115
|
+
- beta
|
116
|
+
- 3
|
117
|
+
version: 1.0.0.beta3
|
118
|
+
version_requirements: *id006
|
119
|
+
type: :development
|
120
|
+
- !ruby/object:Gem::Dependency
|
121
|
+
name: pry
|
122
|
+
prerelease: false
|
123
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - "="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
hash: 27
|
129
|
+
segments:
|
130
|
+
- 0
|
131
|
+
- 9
|
132
|
+
- 6
|
133
|
+
- 2
|
134
|
+
version: 0.9.6.2
|
135
|
+
version_requirements: *id007
|
82
136
|
type: :development
|
83
|
-
version_requirements: *id004
|
84
137
|
description: Rails3 engine that adds OAuth2 Provider support to any application built with Devise authentication
|
85
138
|
email:
|
86
139
|
- ryan@socialcast.com
|
@@ -99,91 +152,85 @@ files:
|
|
99
152
|
- LICENSE.txt
|
100
153
|
- README.md
|
101
154
|
- Rakefile
|
102
|
-
- app/controllers/
|
103
|
-
- app/controllers/
|
104
|
-
- app/models/access_token.rb
|
105
|
-
- app/models/authorization_code.rb
|
106
|
-
- app/models/client.rb
|
107
|
-
- app/models/refresh_token.rb
|
108
|
-
- app/views/
|
109
|
-
- app/views/
|
110
|
-
- app/views/
|
155
|
+
- app/controllers/devise/oauth2_providable/authorizations_controller.rb
|
156
|
+
- app/controllers/devise/oauth2_providable/tokens_controller.rb
|
157
|
+
- app/models/devise/oauth2_providable/access_token.rb
|
158
|
+
- app/models/devise/oauth2_providable/authorization_code.rb
|
159
|
+
- app/models/devise/oauth2_providable/client.rb
|
160
|
+
- app/models/devise/oauth2_providable/refresh_token.rb
|
161
|
+
- app/views/devise/oauth2_providable/authorizations/_form.html.erb
|
162
|
+
- app/views/devise/oauth2_providable/authorizations/error.html.erb
|
163
|
+
- app/views/devise/oauth2_providable/authorizations/new.html.erb
|
111
164
|
- config/routes.rb
|
165
|
+
- db/migrate/20111014160714_create_devise_oauth2_providable_schema.rb
|
112
166
|
- devise_oauth2_providable.gemspec
|
167
|
+
- lib/devise/oauth2_providable/engine.rb
|
168
|
+
- lib/devise/oauth2_providable/models/oauth2_authorization_code_grantable.rb
|
169
|
+
- lib/devise/oauth2_providable/models/oauth2_password_grantable.rb
|
170
|
+
- lib/devise/oauth2_providable/models/oauth2_providable.rb
|
171
|
+
- lib/devise/oauth2_providable/models/oauth2_refresh_token_grantable.rb
|
172
|
+
- lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
|
173
|
+
- lib/devise/oauth2_providable/strategies/oauth2_grant_type_strategy.rb
|
174
|
+
- lib/devise/oauth2_providable/strategies/oauth2_password_grant_type_strategy.rb
|
175
|
+
- lib/devise/oauth2_providable/strategies/oauth2_providable_strategy.rb
|
176
|
+
- lib/devise/oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
|
177
|
+
- lib/devise/oauth2_providable/version.rb
|
113
178
|
- lib/devise_oauth2_providable.rb
|
114
|
-
- lib/devise_oauth2_providable/engine.rb
|
115
|
-
- lib/devise_oauth2_providable/model.rb
|
116
|
-
- lib/devise_oauth2_providable/models/oauth2_authorization_code_grantable.rb
|
117
|
-
- lib/devise_oauth2_providable/models/oauth2_password_grantable.rb
|
118
|
-
- lib/devise_oauth2_providable/models/oauth2_refresh_token_grantable.rb
|
119
|
-
- lib/devise_oauth2_providable/schema.rb
|
120
|
-
- lib/devise_oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
|
121
|
-
- lib/devise_oauth2_providable/strategies/oauth2_grant_type_strategy.rb
|
122
|
-
- lib/devise_oauth2_providable/strategies/oauth2_password_grant_type_strategy.rb
|
123
|
-
- lib/devise_oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
|
124
|
-
- lib/devise_oauth2_providable/strategy.rb
|
125
|
-
- lib/devise_oauth2_providable/version.rb
|
126
179
|
- lib/expirable_token.rb
|
127
|
-
-
|
128
|
-
- spec/
|
129
|
-
- spec/
|
130
|
-
- spec/
|
131
|
-
- spec/
|
132
|
-
- spec/
|
133
|
-
- spec/
|
134
|
-
- spec/
|
135
|
-
- spec/
|
136
|
-
- spec/
|
137
|
-
- spec/
|
138
|
-
- spec/
|
139
|
-
- spec/
|
140
|
-
- spec/
|
141
|
-
- spec/
|
142
|
-
- spec/
|
143
|
-
- spec/
|
144
|
-
- spec/
|
145
|
-
- spec/
|
146
|
-
- spec/
|
147
|
-
- spec/
|
148
|
-
- spec/
|
149
|
-
- spec/
|
150
|
-
- spec/
|
151
|
-
- spec/
|
152
|
-
- spec/
|
153
|
-
- spec/
|
154
|
-
- spec/
|
155
|
-
- spec/
|
156
|
-
- spec/
|
157
|
-
- spec/
|
158
|
-
- spec/
|
159
|
-
- spec/
|
160
|
-
- spec/
|
161
|
-
- spec/
|
162
|
-
- spec/
|
163
|
-
- spec/
|
164
|
-
- spec/
|
165
|
-
- spec/
|
166
|
-
- spec/
|
167
|
-
- spec/
|
168
|
-
- spec/
|
169
|
-
- spec/
|
170
|
-
- spec/
|
171
|
-
- spec/
|
172
|
-
- spec/
|
173
|
-
- spec/
|
174
|
-
- spec/
|
175
|
-
- spec/
|
176
|
-
- spec/
|
177
|
-
- spec/
|
178
|
-
- spec/rails_app/spec/models/client_spec.rb
|
179
|
-
- spec/rails_app/spec/models/refresh_token_spec.rb
|
180
|
-
- spec/rails_app/spec/models/user_spec.rb
|
181
|
-
- spec/rails_app/spec/routing/authorizations_routing_spec.rb
|
182
|
-
- spec/rails_app/spec/routing/tokens_routing_spec.rb
|
183
|
-
- spec/rails_app/spec/spec_helper.rb
|
184
|
-
- spec/rails_app/vendor/plugins/.gitkeep
|
180
|
+
- script/rails
|
181
|
+
- spec/controllers/protected_controller_spec.rb
|
182
|
+
- spec/dummy/Rakefile
|
183
|
+
- spec/dummy/app/assets/javascripts/application.js
|
184
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
185
|
+
- spec/dummy/app/controllers/application_controller.rb
|
186
|
+
- spec/dummy/app/controllers/protected_controller.rb
|
187
|
+
- spec/dummy/app/helpers/application_helper.rb
|
188
|
+
- spec/dummy/app/mailers/.gitkeep
|
189
|
+
- spec/dummy/app/models/.gitkeep
|
190
|
+
- spec/dummy/app/models/user.rb
|
191
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
192
|
+
- spec/dummy/config.ru
|
193
|
+
- spec/dummy/config/application.rb
|
194
|
+
- spec/dummy/config/boot.rb
|
195
|
+
- spec/dummy/config/database.yml
|
196
|
+
- spec/dummy/config/environment.rb
|
197
|
+
- spec/dummy/config/environments/development.rb
|
198
|
+
- spec/dummy/config/environments/production.rb
|
199
|
+
- spec/dummy/config/environments/test.rb
|
200
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
201
|
+
- spec/dummy/config/initializers/devise.rb
|
202
|
+
- spec/dummy/config/initializers/inflections.rb
|
203
|
+
- spec/dummy/config/initializers/mime_types.rb
|
204
|
+
- spec/dummy/config/initializers/secret_token.rb
|
205
|
+
- spec/dummy/config/initializers/session_store.rb
|
206
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
207
|
+
- spec/dummy/config/locales/devise.en.yml
|
208
|
+
- spec/dummy/config/locales/en.yml
|
209
|
+
- spec/dummy/config/routes.rb
|
210
|
+
- spec/dummy/db/migrate/20111014142838_create_users.rb
|
211
|
+
- spec/dummy/db/migrate/20111014161437_create_devise_oauth2_providable_schema.rb
|
212
|
+
- spec/dummy/db/schema.rb
|
213
|
+
- spec/dummy/lib/assets/.gitkeep
|
214
|
+
- spec/dummy/log/.gitkeep
|
215
|
+
- spec/dummy/public/404.html
|
216
|
+
- spec/dummy/public/422.html
|
217
|
+
- spec/dummy/public/500.html
|
218
|
+
- spec/dummy/public/favicon.ico
|
219
|
+
- spec/dummy/script/rails
|
220
|
+
- spec/integration/oauth2_authorization_token_grant_type_strategy_spec.rb
|
221
|
+
- spec/integration/oauth2_password_grant_type_strategy_spec.rb
|
222
|
+
- spec/integration/oauth2_refresh_token_grant_type_strategy_spec.rb
|
223
|
+
- spec/lib/devise_oauth2_providable_spec.rb
|
224
|
+
- spec/models/access_token_spec.rb
|
225
|
+
- spec/models/authorization_code_spec.rb
|
226
|
+
- spec/models/client_spec.rb
|
227
|
+
- spec/models/refresh_token_spec.rb
|
228
|
+
- spec/models/user_spec.rb
|
229
|
+
- spec/routing/authorizations_routing_spec.rb
|
230
|
+
- spec/routing/tokens_routing_spec.rb
|
185
231
|
- spec/setup_database.rb
|
186
232
|
- spec/spec_helper.rb
|
233
|
+
- spec/support/match_json.rb
|
187
234
|
homepage: ""
|
188
235
|
licenses: []
|
189
236
|
|
@@ -204,12 +251,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
204
251
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
252
|
none: false
|
206
253
|
requirements:
|
207
|
-
- - "
|
254
|
+
- - ">"
|
208
255
|
- !ruby/object:Gem::Version
|
209
|
-
hash:
|
256
|
+
hash: 25
|
210
257
|
segments:
|
211
|
-
-
|
212
|
-
|
258
|
+
- 1
|
259
|
+
- 3
|
260
|
+
- 1
|
261
|
+
version: 1.3.1
|
213
262
|
requirements: []
|
214
263
|
|
215
264
|
rubyforge_project: devise_oauth2_providable
|
@@ -218,63 +267,56 @@ signing_key:
|
|
218
267
|
specification_version: 3
|
219
268
|
summary: OAuth2 Provider for Rails3 applications
|
220
269
|
test_files:
|
221
|
-
- spec/
|
222
|
-
- spec/
|
223
|
-
- spec/
|
224
|
-
- spec/
|
225
|
-
- spec/
|
226
|
-
- spec/
|
227
|
-
- spec/
|
228
|
-
- spec/
|
229
|
-
- spec/
|
230
|
-
- spec/
|
231
|
-
- spec/
|
232
|
-
- spec/
|
233
|
-
- spec/
|
234
|
-
- spec/
|
235
|
-
- spec/
|
236
|
-
- spec/
|
237
|
-
- spec/
|
238
|
-
- spec/
|
239
|
-
- spec/
|
240
|
-
- spec/
|
241
|
-
- spec/
|
242
|
-
- spec/
|
243
|
-
- spec/
|
244
|
-
- spec/
|
245
|
-
- spec/
|
246
|
-
- spec/
|
247
|
-
- spec/
|
248
|
-
- spec/
|
249
|
-
- spec/
|
250
|
-
- spec/
|
251
|
-
- spec/
|
252
|
-
- spec/
|
253
|
-
- spec/
|
254
|
-
- spec/
|
255
|
-
- spec/
|
256
|
-
- spec/
|
257
|
-
- spec/
|
258
|
-
- spec/
|
259
|
-
- spec/
|
260
|
-
- spec/
|
261
|
-
- spec/
|
262
|
-
- spec/
|
263
|
-
- spec/
|
264
|
-
- spec/
|
265
|
-
- spec/
|
266
|
-
- spec/
|
267
|
-
- spec/
|
268
|
-
- spec/
|
269
|
-
- spec/
|
270
|
-
- spec/
|
271
|
-
- spec/rails_app/spec/models/authorization_code_spec.rb
|
272
|
-
- spec/rails_app/spec/models/client_spec.rb
|
273
|
-
- spec/rails_app/spec/models/refresh_token_spec.rb
|
274
|
-
- spec/rails_app/spec/models/user_spec.rb
|
275
|
-
- spec/rails_app/spec/routing/authorizations_routing_spec.rb
|
276
|
-
- spec/rails_app/spec/routing/tokens_routing_spec.rb
|
277
|
-
- spec/rails_app/spec/spec_helper.rb
|
278
|
-
- spec/rails_app/vendor/plugins/.gitkeep
|
270
|
+
- spec/controllers/protected_controller_spec.rb
|
271
|
+
- spec/dummy/Rakefile
|
272
|
+
- spec/dummy/app/assets/javascripts/application.js
|
273
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
274
|
+
- spec/dummy/app/controllers/application_controller.rb
|
275
|
+
- spec/dummy/app/controllers/protected_controller.rb
|
276
|
+
- spec/dummy/app/helpers/application_helper.rb
|
277
|
+
- spec/dummy/app/mailers/.gitkeep
|
278
|
+
- spec/dummy/app/models/.gitkeep
|
279
|
+
- spec/dummy/app/models/user.rb
|
280
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
281
|
+
- spec/dummy/config.ru
|
282
|
+
- spec/dummy/config/application.rb
|
283
|
+
- spec/dummy/config/boot.rb
|
284
|
+
- spec/dummy/config/database.yml
|
285
|
+
- spec/dummy/config/environment.rb
|
286
|
+
- spec/dummy/config/environments/development.rb
|
287
|
+
- spec/dummy/config/environments/production.rb
|
288
|
+
- spec/dummy/config/environments/test.rb
|
289
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
290
|
+
- spec/dummy/config/initializers/devise.rb
|
291
|
+
- spec/dummy/config/initializers/inflections.rb
|
292
|
+
- spec/dummy/config/initializers/mime_types.rb
|
293
|
+
- spec/dummy/config/initializers/secret_token.rb
|
294
|
+
- spec/dummy/config/initializers/session_store.rb
|
295
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
296
|
+
- spec/dummy/config/locales/devise.en.yml
|
297
|
+
- spec/dummy/config/locales/en.yml
|
298
|
+
- spec/dummy/config/routes.rb
|
299
|
+
- spec/dummy/db/migrate/20111014142838_create_users.rb
|
300
|
+
- spec/dummy/db/migrate/20111014161437_create_devise_oauth2_providable_schema.rb
|
301
|
+
- spec/dummy/db/schema.rb
|
302
|
+
- spec/dummy/lib/assets/.gitkeep
|
303
|
+
- spec/dummy/log/.gitkeep
|
304
|
+
- spec/dummy/public/404.html
|
305
|
+
- spec/dummy/public/422.html
|
306
|
+
- spec/dummy/public/500.html
|
307
|
+
- spec/dummy/public/favicon.ico
|
308
|
+
- spec/dummy/script/rails
|
309
|
+
- spec/integration/oauth2_authorization_token_grant_type_strategy_spec.rb
|
310
|
+
- spec/integration/oauth2_password_grant_type_strategy_spec.rb
|
311
|
+
- spec/integration/oauth2_refresh_token_grant_type_strategy_spec.rb
|
312
|
+
- spec/lib/devise_oauth2_providable_spec.rb
|
313
|
+
- spec/models/access_token_spec.rb
|
314
|
+
- spec/models/authorization_code_spec.rb
|
315
|
+
- spec/models/client_spec.rb
|
316
|
+
- spec/models/refresh_token_spec.rb
|
317
|
+
- spec/models/user_spec.rb
|
318
|
+
- spec/routing/authorizations_routing_spec.rb
|
319
|
+
- spec/routing/tokens_routing_spec.rb
|
279
320
|
- spec/setup_database.rb
|
280
321
|
- spec/spec_helper.rb
|
322
|
+
- spec/support/match_json.rb
|
@@ -1,55 +0,0 @@
|
|
1
|
-
class Oauth2::AuthorizationsController < ApplicationController
|
2
|
-
before_filter :authenticate_user!
|
3
|
-
|
4
|
-
rescue_from Rack::OAuth2::Server::Authorize::BadRequest do |e|
|
5
|
-
@error = e
|
6
|
-
render :error, :status => e.status
|
7
|
-
end
|
8
|
-
|
9
|
-
def new
|
10
|
-
respond *authorize_endpoint.call(request.env)
|
11
|
-
end
|
12
|
-
|
13
|
-
def create
|
14
|
-
respond *authorize_endpoint(:allow_approval).call(request.env)
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def respond(status, header, response)
|
20
|
-
["WWW-Authenticate"].each do |key|
|
21
|
-
headers[key] = header[key] if header[key].present?
|
22
|
-
end
|
23
|
-
if response.redirect?
|
24
|
-
redirect_to header['Location']
|
25
|
-
else
|
26
|
-
render :new
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def authorize_endpoint(allow_approval = false)
|
31
|
-
Rack::OAuth2::Server::Authorize.new do |req, res|
|
32
|
-
@client = Client.find_by_identifier(req.client_id) || req.bad_request!
|
33
|
-
res.redirect_uri = @redirect_uri = req.verify_redirect_uri!(@client.redirect_uri)
|
34
|
-
if allow_approval
|
35
|
-
if params[:approve].present?
|
36
|
-
case req.response_type
|
37
|
-
when :code
|
38
|
-
authorization_code = current_user.authorization_codes.create(:client => @client, :redirect_uri => @redirect_uri)
|
39
|
-
res.code = authorization_code.token
|
40
|
-
when :token
|
41
|
-
access_token = current_user.access_tokens.create(:client => @client).token
|
42
|
-
bearer_token = Rack::OAuth2::AccessToken::Bearer.new(:access_token => access_token)
|
43
|
-
res.access_token = bearer_token
|
44
|
-
res.uid = current_user.id
|
45
|
-
end
|
46
|
-
res.approve!
|
47
|
-
else
|
48
|
-
req.access_denied!
|
49
|
-
end
|
50
|
-
else
|
51
|
-
@response_type = req.response_type
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,5 +0,0 @@
|
|
1
|
-
<h2><%= link_to @client.name, @client.website %> is requesting permission to access your resources.</h2>
|
2
|
-
|
3
|
-
<%= render 'oauth2/authorizations/form', :client => @client, :response_type => @response_type, :redirect_uri => @redirect_uri, :action => :approve %>
|
4
|
-
<%= render 'oauth2/authorizations/form', :client => @client, :response_type => @response_type, :redirect_uri => @redirect_uri, :action => :deny %>
|
5
|
-
|