oauth2-provider 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/Gemfile +3 -0
- data/README.md +49 -0
- data/Rakefile +24 -0
- data/examples/client/Gemfile +6 -0
- data/examples/client/Gemfile.lock +20 -0
- data/examples/client/README +8 -0
- data/examples/client/app.rb +59 -0
- data/examples/client/config.ru +3 -0
- data/examples/client/views/home.haml +3 -0
- data/examples/client/views/response.haml +11 -0
- data/examples/rails3-example/.gitignore +4 -0
- data/examples/rails3-example/Gemfile +10 -0
- data/examples/rails3-example/Gemfile.lock +82 -0
- data/examples/rails3-example/README +9 -0
- data/examples/rails3-example/Rakefile +7 -0
- data/examples/rails3-example/app/controllers/account_controller.rb +14 -0
- data/examples/rails3-example/app/controllers/application_controller.rb +18 -0
- data/examples/rails3-example/app/controllers/authorization_controller.rb +18 -0
- data/examples/rails3-example/app/controllers/home_controller.rb +4 -0
- data/examples/rails3-example/app/controllers/session_controller.rb +24 -0
- data/examples/rails3-example/app/helpers/application_helper.rb +2 -0
- data/examples/rails3-example/app/models/account.rb +6 -0
- data/examples/rails3-example/app/views/authorization/new.html.erb +5 -0
- data/examples/rails3-example/app/views/home/show.html.erb +1 -0
- data/examples/rails3-example/app/views/layouts/application.html.erb +16 -0
- data/examples/rails3-example/app/views/session/new.html.erb +7 -0
- data/examples/rails3-example/config.ru +4 -0
- data/examples/rails3-example/config/application.rb +42 -0
- data/examples/rails3-example/config/boot.rb +6 -0
- data/examples/rails3-example/config/database.yml +22 -0
- data/examples/rails3-example/config/environment.rb +5 -0
- data/examples/rails3-example/config/environments/development.rb +26 -0
- data/examples/rails3-example/config/environments/production.rb +49 -0
- data/examples/rails3-example/config/environments/test.rb +35 -0
- data/examples/rails3-example/config/initializers/backtrace_silencers.rb +7 -0
- data/examples/rails3-example/config/initializers/inflections.rb +10 -0
- data/examples/rails3-example/config/initializers/mime_types.rb +5 -0
- data/examples/rails3-example/config/initializers/secret_token.rb +7 -0
- data/examples/rails3-example/config/initializers/session_store.rb +8 -0
- data/examples/rails3-example/config/locales/en.yml +5 -0
- data/examples/rails3-example/config/routes.rb +9 -0
- data/examples/rails3-example/db/migrate/20110508151935_add_account_table.rb +12 -0
- data/examples/rails3-example/db/migrate/20110508151948_add_oauth2_tables.rb +43 -0
- data/examples/rails3-example/db/schema.rb +52 -0
- data/examples/rails3-example/db/seeds.rb +11 -0
- data/examples/rails3-example/doc/README_FOR_APP +2 -0
- data/examples/rails3-example/lib/tasks/.gitkeep +0 -0
- data/examples/rails3-example/public/404.html +26 -0
- data/examples/rails3-example/public/422.html +26 -0
- data/examples/rails3-example/public/500.html +26 -0
- data/examples/rails3-example/public/favicon.ico +0 -0
- data/examples/rails3-example/public/images/rails.png +0 -0
- data/examples/rails3-example/public/robots.txt +5 -0
- data/examples/rails3-example/public/stylesheets/.gitkeep +0 -0
- data/examples/rails3-example/script/rails +6 -0
- data/lib/oauth2-provider.rb +3 -0
- data/lib/oauth2/provider.rb +39 -0
- data/lib/oauth2/provider/models.rb +40 -0
- data/lib/oauth2/provider/models/access_token.rb +54 -0
- data/lib/oauth2/provider/models/active_record.rb +30 -0
- data/lib/oauth2/provider/models/active_record/access_token.rb +13 -0
- data/lib/oauth2/provider/models/active_record/authorization.rb +16 -0
- data/lib/oauth2/provider/models/active_record/authorization_code.rb +13 -0
- data/lib/oauth2/provider/models/active_record/client.rb +15 -0
- data/lib/oauth2/provider/models/authorization.rb +40 -0
- data/lib/oauth2/provider/models/authorization_code.rb +27 -0
- data/lib/oauth2/provider/models/client.rb +28 -0
- data/lib/oauth2/provider/models/mongoid.rb +30 -0
- data/lib/oauth2/provider/models/mongoid/access_token.rb +40 -0
- data/lib/oauth2/provider/models/mongoid/authorization.rb +32 -0
- data/lib/oauth2/provider/models/mongoid/authorization_code.rb +43 -0
- data/lib/oauth2/provider/models/mongoid/client.rb +40 -0
- data/lib/oauth2/provider/rack.rb +11 -0
- data/lib/oauth2/provider/rack/access_token_handler.rb +103 -0
- data/lib/oauth2/provider/rack/authorization_code_request.rb +74 -0
- data/lib/oauth2/provider/rack/authorization_codes_support.rb +25 -0
- data/lib/oauth2/provider/rack/middleware.rb +28 -0
- data/lib/oauth2/provider/rack/resource_request.rb +91 -0
- data/lib/oauth2/provider/rack/responses.rb +34 -0
- data/lib/oauth2/provider/rails.rb +37 -0
- data/lib/oauth2/provider/rails/controller_authentication.rb +21 -0
- data/lib/oauth2/provider/random.rb +30 -0
- data/lib/oauth2/provider/version.rb +5 -0
- data/oauth2-provider.gemspec +35 -0
- data/spec/models/access_token_spec.rb +123 -0
- data/spec/models/authorization_code_spec.rb +115 -0
- data/spec/models/authorization_spec.rb +110 -0
- data/spec/models/client_spec.rb +75 -0
- data/spec/requests/access_tokens_controller_spec.rb +360 -0
- data/spec/requests/authentication_spec.rb +150 -0
- data/spec/requests/authorization_codes_support_spec.rb +157 -0
- data/spec/schema.rb +38 -0
- data/spec/set_backend_env_to_mongoid.rb +1 -0
- data/spec/spec_helper.rb +27 -0
- data/spec/support/activerecord_backend.rb +18 -0
- data/spec/support/factories.rb +56 -0
- data/spec/support/macros.rb +46 -0
- data/spec/support/mongoid_backend.rb +34 -0
- data/spec/support/rack.rb +32 -0
- metadata +373 -0
@@ -0,0 +1,157 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe OAuth2::Provider::Rack::AuthorizationCodesSupport do
|
4
|
+
before :each do
|
5
|
+
ExampleResourceOwner.destroy_all
|
6
|
+
@client = OAuth2::Provider.client_class.create! :name => 'client'
|
7
|
+
@valid_params = {
|
8
|
+
:client_id => @client.oauth_identifier,
|
9
|
+
:redirect_uri => "https://redirect.example.com/callback"
|
10
|
+
}
|
11
|
+
@owner = create_resource_owner
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "Validating requests" do
|
15
|
+
action do |env|
|
16
|
+
request = Rack::Request.new(env)
|
17
|
+
env['oauth2.authorization_request'] ||= OAuth2::Provider::Rack::AuthorizationCodeRequest.new(env, request.params)
|
18
|
+
env['oauth2.authorization_request'].validate!
|
19
|
+
successful_response
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "Any request with a client_id and redirect_uri" do
|
23
|
+
before :each do
|
24
|
+
get '/oauth/authorize', @valid_params
|
25
|
+
end
|
26
|
+
|
27
|
+
it "is successful" do
|
28
|
+
response.status.should == 200
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "Any request without a client_id" do
|
33
|
+
before :each do
|
34
|
+
get '/oauth/authorize', @valid_params.except(:client_id)
|
35
|
+
end
|
36
|
+
|
37
|
+
redirects_back_with_error 'invalid_request'
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "Any request without a redirect_uri" do
|
41
|
+
before :each do
|
42
|
+
get '/oauth/authorize', @valid_params.except(:redirect_uri)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "returns 400" do
|
46
|
+
response.status.should == 400
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "Any request with an invalid redirect_uri" do
|
51
|
+
before :each do
|
52
|
+
get '/oauth/authorize', @valid_params.merge(:redirect_uri => "http://")
|
53
|
+
end
|
54
|
+
|
55
|
+
it "returns 400" do
|
56
|
+
response.status.should == 400
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "Any request with an unknown client id" do
|
61
|
+
before :each do
|
62
|
+
get '/oauth/authorize', @valid_params.merge(:client_id => 'unknown')
|
63
|
+
end
|
64
|
+
|
65
|
+
redirects_back_with_error 'invalid_client'
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "A request where the scope is declared invalid" do
|
69
|
+
action do |env|
|
70
|
+
request = Rack::Request.new(env)
|
71
|
+
env['oauth2.authorization_request'] ||= OAuth2::Provider::Rack::AuthorizationCodeRequest.new(env, request.params)
|
72
|
+
env['oauth2.authorization_request'].validate!
|
73
|
+
env['oauth2.authorization_request'].invalid_scope!
|
74
|
+
successful_response
|
75
|
+
end
|
76
|
+
|
77
|
+
before :each do
|
78
|
+
get '/oauth/authorize', @valid_params
|
79
|
+
end
|
80
|
+
|
81
|
+
redirects_back_with_error 'invalid_scope'
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe "Granting a code" do
|
86
|
+
action do |env|
|
87
|
+
request = Rack::Request.new(env)
|
88
|
+
env['oauth2.authorization_request'] ||= OAuth2::Provider::Rack::AuthorizationCodeRequest.new(env, request.params)
|
89
|
+
env['oauth2.authorization_request'].grant! ExampleResourceOwner.first
|
90
|
+
end
|
91
|
+
|
92
|
+
before :each do
|
93
|
+
post '/oauth/authorize', @valid_params.merge(:submit => 'Yes')
|
94
|
+
end
|
95
|
+
|
96
|
+
it "redirects back to the redirect_uri with a valid authorization code for the client" do
|
97
|
+
response.status.should == 302
|
98
|
+
code = Addressable::URI.parse(response.location).query_values["code"]
|
99
|
+
code.should_not be_nil
|
100
|
+
found = OAuth2::Provider.authorization_code_class.find_by_code(code)
|
101
|
+
found.should_not be_nil
|
102
|
+
found.authorization.client.should == @client
|
103
|
+
found.authorization.resource_owner.should == @owner
|
104
|
+
found.should_not be_expired
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe "Granting a code with a scope" do
|
109
|
+
action do |env|
|
110
|
+
request = Rack::Request.new(env)
|
111
|
+
env['oauth2.authorization_request'] ||= OAuth2::Provider::Rack::AuthorizationCodeRequest.new(env, request.params)
|
112
|
+
env['oauth2.authorization_request'].grant! ExampleResourceOwner.first
|
113
|
+
end
|
114
|
+
|
115
|
+
before :each do
|
116
|
+
post '/oauth/authorize', @valid_params.merge(:submit => 'Yes', :scope => 'periscope')
|
117
|
+
end
|
118
|
+
|
119
|
+
it "includes the scope in the granted authorization" do
|
120
|
+
code = Addressable::URI.parse(response.location).query_values["code"]
|
121
|
+
found = OAuth2::Provider.authorization_code_class.find_by_code(code)
|
122
|
+
found.authorization.scope.should == 'periscope'
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe "Granting a code with custom authorization length" do
|
127
|
+
action do |env|
|
128
|
+
request = Rack::Request.new(env)
|
129
|
+
env['oauth2.authorization_request'] ||= OAuth2::Provider::Rack::AuthorizationCodeRequest.new(env, request.params)
|
130
|
+
env['oauth2.authorization_request'].grant! ExampleResourceOwner.first, 5.years.from_now
|
131
|
+
end
|
132
|
+
|
133
|
+
before :each do
|
134
|
+
post '/oauth/authorize', @valid_params.merge(:submit => 'Yes', :five_years => 'true')
|
135
|
+
end
|
136
|
+
|
137
|
+
it "redirects with an authorization code linked to the extended authorization" do
|
138
|
+
code = Addressable::URI.parse(response.location).query_values["code"]
|
139
|
+
found = OAuth2::Provider.authorization_code_class.find_by_code(code)
|
140
|
+
found.authorization.expires_at.should eql(5.years.from_now)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
describe "Denying a code" do
|
145
|
+
action do |env|
|
146
|
+
request = Rack::Request.new(env)
|
147
|
+
env['oauth2.authorization_request'] ||= OAuth2::Provider::Rack::AuthorizationCodeRequest.new(env, request.params)
|
148
|
+
env['oauth2.authorization_request'].deny!
|
149
|
+
end
|
150
|
+
|
151
|
+
before :each do
|
152
|
+
post '/oauth/authorize', @valid_params.merge(:submit => 'No')
|
153
|
+
end
|
154
|
+
|
155
|
+
redirects_back_with_error 'access_denied'
|
156
|
+
end
|
157
|
+
end
|
data/spec/schema.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
ActiveRecord::Schema.define(:version => 20110323171649) do
|
2
|
+
create_table 'example_resource_owners', :force => true do |t|
|
3
|
+
t.string 'username'
|
4
|
+
t.string 'password'
|
5
|
+
end
|
6
|
+
|
7
|
+
create_table 'oauth_clients', :force => true do |t|
|
8
|
+
t.string 'name'
|
9
|
+
t.string 'oauth_identifier', :null => false
|
10
|
+
t.string 'oauth_secret', :null => false
|
11
|
+
end
|
12
|
+
|
13
|
+
create_table 'oauth_authorization_codes', :force => true do |t|
|
14
|
+
t.integer 'authorization_id', :null => false
|
15
|
+
t.string 'code', :null => false
|
16
|
+
t.datetime 'expires_at'
|
17
|
+
t.datetime 'created_at'
|
18
|
+
t.datetime 'updated_at'
|
19
|
+
t.string 'redirect_uri'
|
20
|
+
end
|
21
|
+
|
22
|
+
create_table 'oauth_authorizations', :force => true do |t|
|
23
|
+
t.integer 'client_id', :null => false
|
24
|
+
t.integer 'resource_owner_id'
|
25
|
+
t.string 'resource_owner_type'
|
26
|
+
t.string 'scope'
|
27
|
+
t.datetime 'expires_at'
|
28
|
+
end
|
29
|
+
|
30
|
+
create_table 'oauth_access_tokens', :force => true do |t|
|
31
|
+
t.integer 'authorization_id', :null => false
|
32
|
+
t.string 'access_token', :null => false
|
33
|
+
t.string 'refresh_token'
|
34
|
+
t.datetime 'expires_at'
|
35
|
+
t.datetime 'created_at'
|
36
|
+
t.datetime 'updated_at'
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
ENV['BACKEND']='mongoid'
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'rack'
|
3
|
+
require 'rack/test'
|
4
|
+
require 'oauth2-provider'
|
5
|
+
|
6
|
+
require 'timecop'
|
7
|
+
require 'yajl'
|
8
|
+
|
9
|
+
require "support/#{ENV["BACKEND"] || 'activerecord'}_backend"
|
10
|
+
|
11
|
+
require 'support/macros'
|
12
|
+
require 'support/factories'
|
13
|
+
require 'support/rack'
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
config.before :each do
|
17
|
+
Timecop.freeze
|
18
|
+
end
|
19
|
+
|
20
|
+
config.after :each do
|
21
|
+
Timecop.return
|
22
|
+
end
|
23
|
+
|
24
|
+
config.include OAuth2::Provider::RSpec::Macros
|
25
|
+
config.include OAuth2::Provider::RSpec::Factories
|
26
|
+
config.include OAuth2::Provider::RSpec::Rack
|
27
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
ActiveRecord::Base.establish_connection(
|
4
|
+
:adapter => "sqlite3",
|
5
|
+
:database => "test.db"
|
6
|
+
)
|
7
|
+
|
8
|
+
require "schema.rb"
|
9
|
+
|
10
|
+
class ExampleResourceOwner < ActiveRecord::Base
|
11
|
+
def self.authenticate_with_username_and_password(*args)
|
12
|
+
find_by_username_and_password(*args)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
OAuth2::Provider.configure do |config|
|
17
|
+
config.resource_owner_class_name = 'ExampleResourceOwner'
|
18
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module OAuth2::Provider
|
2
|
+
module RSpec
|
3
|
+
module Factories
|
4
|
+
def build_client(attributes = {})
|
5
|
+
OAuth2::Provider.client_class.new({:name => 'client'}.merge(attributes))
|
6
|
+
end
|
7
|
+
|
8
|
+
def create_client(attributes = {})
|
9
|
+
build_client(attributes).tap do |c|
|
10
|
+
c.save!
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def build_authorization(attributes = {})
|
15
|
+
OAuth2::Provider.authorization_class.new({
|
16
|
+
:client => build_client
|
17
|
+
}.merge(attributes))
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_authorization(attributes = {})
|
21
|
+
build_authorization({:client => create_client}.merge(attributes)).tap do |ag|
|
22
|
+
ag.save!
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def build_authorization_code(attributes = {})
|
27
|
+
OAuth2::Provider.authorization_code_class.new({
|
28
|
+
:redirect_uri => "https://client.example.com/callback",
|
29
|
+
:authorization => build_authorization
|
30
|
+
}.merge(attributes))
|
31
|
+
end
|
32
|
+
|
33
|
+
def create_authorization_code(attributes = {})
|
34
|
+
build_authorization_code({:authorization => create_authorization}.merge(attributes)).tap do |ac|
|
35
|
+
ac.save!
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def build_access_token(attributes = {})
|
40
|
+
OAuth2::Provider.access_token_class.new({
|
41
|
+
:authorization => build_authorization
|
42
|
+
}.merge(attributes))
|
43
|
+
end
|
44
|
+
|
45
|
+
def create_access_token(attributes = {})
|
46
|
+
build_access_token({:authorization => create_authorization}.merge(attributes)).tap do |ac|
|
47
|
+
ac.save!
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def create_resource_owner(attributes = {})
|
52
|
+
ExampleResourceOwner.create!
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module OAuth2::Provider
|
2
|
+
module RSpec
|
3
|
+
module Macros
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
def json_from_response
|
7
|
+
@json_from_response ||= begin
|
8
|
+
response.content_type.should == "application/json"
|
9
|
+
Yajl::Parser.new.parse(response.body)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
module ClassMethods
|
14
|
+
def responds_with_header(name, value)
|
15
|
+
it %{responds with header #{name}: #{value}} do
|
16
|
+
response.headers[name].should == value
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def responds_with_status(status)
|
21
|
+
it %{responds with status #{status}} do
|
22
|
+
response.status.should == status
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def responds_with_json_error(name, options = {})
|
27
|
+
error_description = %{, "error_description": "#{options[:description]}"} if options[:description]
|
28
|
+
it %{responds with json: {"error": "#{name}"#{error_description}}, status: #{options[:status]}} do
|
29
|
+
response.status.should == options[:status]
|
30
|
+
json = json_from_response
|
31
|
+
json["error"].should == name
|
32
|
+
json["error_description"].should == options[:description] if options[:description]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def redirects_back_with_error(name)
|
37
|
+
it %{redirects back with error '#{name}'} do
|
38
|
+
response.status.should == 302
|
39
|
+
error = Addressable::URI.parse(response.location).query_values["error"]
|
40
|
+
error.should == name
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'mongoid'
|
2
|
+
|
3
|
+
class ExampleResourceOwner
|
4
|
+
include Mongoid::Document
|
5
|
+
|
6
|
+
field :username
|
7
|
+
field :password
|
8
|
+
|
9
|
+
references_many :authorizations, :class_name => "OAuth2::Provider::Models::Mongoid::Authorization"
|
10
|
+
|
11
|
+
def self.authenticate_with_username_and_password(username, password)
|
12
|
+
where(:username => username, :password => password).first
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
OAuth2::Provider.configure do |config|
|
17
|
+
config.backend = :mongoid
|
18
|
+
config.resource_owner_class_name = 'ExampleResourceOwner'
|
19
|
+
end
|
20
|
+
|
21
|
+
Mongoid.configure do |config|
|
22
|
+
config.from_hash(
|
23
|
+
"host" => "127.0.0.1",
|
24
|
+
"autocreate_indexes" => false,
|
25
|
+
"allow_dynamic_fields" => true,
|
26
|
+
"include_root_in_json" => false,
|
27
|
+
"parameterize_keys" => true,
|
28
|
+
"persist_in_safe_mode" => true,
|
29
|
+
"raise_not_found_error" => true,
|
30
|
+
"reconnect_time" => 3,
|
31
|
+
"use_activesupport_time_zone" => true,
|
32
|
+
"database" => "oauth2_test"
|
33
|
+
)
|
34
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module OAuth2::Provider
|
2
|
+
module RSpec
|
3
|
+
module Rack
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
class_attribute :action_block
|
8
|
+
include ::Rack::Test::Methods
|
9
|
+
end
|
10
|
+
|
11
|
+
def app
|
12
|
+
::OAuth2::Provider::Rack::Middleware.new(
|
13
|
+
action_block
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
def response
|
18
|
+
last_response
|
19
|
+
end
|
20
|
+
|
21
|
+
module ClassMethods
|
22
|
+
def action(&block)
|
23
|
+
self.action_block = block
|
24
|
+
end
|
25
|
+
|
26
|
+
def successful_response
|
27
|
+
[200, {'Content-Type' => 'text/plain'}, 'Success']
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,373 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: oauth2-provider
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 63
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 16
|
10
|
+
version: 0.0.16
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Tom Ward
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-05-17 00:00:00 +01:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: activesupport
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 5
|
30
|
+
segments:
|
31
|
+
- 3
|
32
|
+
- 0
|
33
|
+
- 1
|
34
|
+
version: 3.0.1
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: addressable
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 7
|
46
|
+
segments:
|
47
|
+
- 2
|
48
|
+
- 2
|
49
|
+
version: "2.2"
|
50
|
+
type: :runtime
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: rails
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 5
|
61
|
+
segments:
|
62
|
+
- 3
|
63
|
+
- 0
|
64
|
+
- 1
|
65
|
+
version: 3.0.1
|
66
|
+
type: :development
|
67
|
+
version_requirements: *id003
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: rspec-rails
|
70
|
+
prerelease: false
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 11
|
77
|
+
segments:
|
78
|
+
- 2
|
79
|
+
- 1
|
80
|
+
- 0
|
81
|
+
version: 2.1.0
|
82
|
+
type: :development
|
83
|
+
version_requirements: *id004
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rake
|
86
|
+
prerelease: false
|
87
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ~>
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
hash: 49
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
- 8
|
96
|
+
- 7
|
97
|
+
version: 0.8.7
|
98
|
+
type: :development
|
99
|
+
version_requirements: *id005
|
100
|
+
- !ruby/object:Gem::Dependency
|
101
|
+
name: sqlite3-ruby
|
102
|
+
prerelease: false
|
103
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ~>
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
hash: 25
|
109
|
+
segments:
|
110
|
+
- 1
|
111
|
+
- 3
|
112
|
+
- 1
|
113
|
+
version: 1.3.1
|
114
|
+
type: :development
|
115
|
+
version_requirements: *id006
|
116
|
+
- !ruby/object:Gem::Dependency
|
117
|
+
name: timecop
|
118
|
+
prerelease: false
|
119
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
121
|
+
requirements:
|
122
|
+
- - ~>
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
hash: 27
|
125
|
+
segments:
|
126
|
+
- 0
|
127
|
+
- 3
|
128
|
+
- 4
|
129
|
+
version: 0.3.4
|
130
|
+
type: :development
|
131
|
+
version_requirements: *id007
|
132
|
+
- !ruby/object:Gem::Dependency
|
133
|
+
name: yajl-ruby
|
134
|
+
prerelease: false
|
135
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
136
|
+
none: false
|
137
|
+
requirements:
|
138
|
+
- - ~>
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
hash: 9
|
141
|
+
segments:
|
142
|
+
- 0
|
143
|
+
- 7
|
144
|
+
- 5
|
145
|
+
version: 0.7.5
|
146
|
+
type: :development
|
147
|
+
version_requirements: *id008
|
148
|
+
- !ruby/object:Gem::Dependency
|
149
|
+
name: mongoid
|
150
|
+
prerelease: false
|
151
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
152
|
+
none: false
|
153
|
+
requirements:
|
154
|
+
- - "="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
hash: 15424089
|
157
|
+
segments:
|
158
|
+
- 2
|
159
|
+
- 0
|
160
|
+
- 0
|
161
|
+
- rc
|
162
|
+
- 6
|
163
|
+
version: 2.0.0.rc.6
|
164
|
+
type: :development
|
165
|
+
version_requirements: *id009
|
166
|
+
- !ruby/object:Gem::Dependency
|
167
|
+
name: bson
|
168
|
+
prerelease: false
|
169
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
170
|
+
none: false
|
171
|
+
requirements:
|
172
|
+
- - "="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
hash: 31
|
175
|
+
segments:
|
176
|
+
- 1
|
177
|
+
- 2
|
178
|
+
- 0
|
179
|
+
version: 1.2.0
|
180
|
+
type: :development
|
181
|
+
version_requirements: *id010
|
182
|
+
- !ruby/object:Gem::Dependency
|
183
|
+
name: bson_ext
|
184
|
+
prerelease: false
|
185
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
186
|
+
none: false
|
187
|
+
requirements:
|
188
|
+
- - "="
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
hash: 31
|
191
|
+
segments:
|
192
|
+
- 1
|
193
|
+
- 2
|
194
|
+
- 0
|
195
|
+
version: 1.2.0
|
196
|
+
type: :development
|
197
|
+
version_requirements: *id011
|
198
|
+
- !ruby/object:Gem::Dependency
|
199
|
+
name: sdoc
|
200
|
+
prerelease: false
|
201
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
202
|
+
none: false
|
203
|
+
requirements:
|
204
|
+
- - ~>
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
hash: 63
|
207
|
+
segments:
|
208
|
+
- 0
|
209
|
+
- 2
|
210
|
+
- 20
|
211
|
+
version: 0.2.20
|
212
|
+
type: :development
|
213
|
+
version_requirements: *id012
|
214
|
+
description: OAuth2 Provider, extracted from api.hashblue.com
|
215
|
+
email:
|
216
|
+
- tom@popdog.net
|
217
|
+
executables: []
|
218
|
+
|
219
|
+
extensions: []
|
220
|
+
|
221
|
+
extra_rdoc_files: []
|
222
|
+
|
223
|
+
files:
|
224
|
+
- .gitignore
|
225
|
+
- Gemfile
|
226
|
+
- README.md
|
227
|
+
- Rakefile
|
228
|
+
- examples/client/Gemfile
|
229
|
+
- examples/client/Gemfile.lock
|
230
|
+
- examples/client/README
|
231
|
+
- examples/client/app.rb
|
232
|
+
- examples/client/config.ru
|
233
|
+
- examples/client/views/home.haml
|
234
|
+
- examples/client/views/response.haml
|
235
|
+
- examples/rails3-example/.gitignore
|
236
|
+
- examples/rails3-example/Gemfile
|
237
|
+
- examples/rails3-example/Gemfile.lock
|
238
|
+
- examples/rails3-example/README
|
239
|
+
- examples/rails3-example/Rakefile
|
240
|
+
- examples/rails3-example/app/controllers/account_controller.rb
|
241
|
+
- examples/rails3-example/app/controllers/application_controller.rb
|
242
|
+
- examples/rails3-example/app/controllers/authorization_controller.rb
|
243
|
+
- examples/rails3-example/app/controllers/home_controller.rb
|
244
|
+
- examples/rails3-example/app/controllers/session_controller.rb
|
245
|
+
- examples/rails3-example/app/helpers/application_helper.rb
|
246
|
+
- examples/rails3-example/app/models/account.rb
|
247
|
+
- examples/rails3-example/app/views/authorization/new.html.erb
|
248
|
+
- examples/rails3-example/app/views/home/show.html.erb
|
249
|
+
- examples/rails3-example/app/views/layouts/application.html.erb
|
250
|
+
- examples/rails3-example/app/views/session/new.html.erb
|
251
|
+
- examples/rails3-example/config.ru
|
252
|
+
- examples/rails3-example/config/application.rb
|
253
|
+
- examples/rails3-example/config/boot.rb
|
254
|
+
- examples/rails3-example/config/database.yml
|
255
|
+
- examples/rails3-example/config/environment.rb
|
256
|
+
- examples/rails3-example/config/environments/development.rb
|
257
|
+
- examples/rails3-example/config/environments/production.rb
|
258
|
+
- examples/rails3-example/config/environments/test.rb
|
259
|
+
- examples/rails3-example/config/initializers/backtrace_silencers.rb
|
260
|
+
- examples/rails3-example/config/initializers/inflections.rb
|
261
|
+
- examples/rails3-example/config/initializers/mime_types.rb
|
262
|
+
- examples/rails3-example/config/initializers/secret_token.rb
|
263
|
+
- examples/rails3-example/config/initializers/session_store.rb
|
264
|
+
- examples/rails3-example/config/locales/en.yml
|
265
|
+
- examples/rails3-example/config/routes.rb
|
266
|
+
- examples/rails3-example/db/migrate/20110508151935_add_account_table.rb
|
267
|
+
- examples/rails3-example/db/migrate/20110508151948_add_oauth2_tables.rb
|
268
|
+
- examples/rails3-example/db/schema.rb
|
269
|
+
- examples/rails3-example/db/seeds.rb
|
270
|
+
- examples/rails3-example/doc/README_FOR_APP
|
271
|
+
- examples/rails3-example/lib/tasks/.gitkeep
|
272
|
+
- examples/rails3-example/public/404.html
|
273
|
+
- examples/rails3-example/public/422.html
|
274
|
+
- examples/rails3-example/public/500.html
|
275
|
+
- examples/rails3-example/public/favicon.ico
|
276
|
+
- examples/rails3-example/public/images/rails.png
|
277
|
+
- examples/rails3-example/public/robots.txt
|
278
|
+
- examples/rails3-example/public/stylesheets/.gitkeep
|
279
|
+
- examples/rails3-example/script/rails
|
280
|
+
- lib/oauth2-provider.rb
|
281
|
+
- lib/oauth2/provider.rb
|
282
|
+
- lib/oauth2/provider/models.rb
|
283
|
+
- lib/oauth2/provider/models/access_token.rb
|
284
|
+
- lib/oauth2/provider/models/active_record.rb
|
285
|
+
- lib/oauth2/provider/models/active_record/access_token.rb
|
286
|
+
- lib/oauth2/provider/models/active_record/authorization.rb
|
287
|
+
- lib/oauth2/provider/models/active_record/authorization_code.rb
|
288
|
+
- lib/oauth2/provider/models/active_record/client.rb
|
289
|
+
- lib/oauth2/provider/models/authorization.rb
|
290
|
+
- lib/oauth2/provider/models/authorization_code.rb
|
291
|
+
- lib/oauth2/provider/models/client.rb
|
292
|
+
- lib/oauth2/provider/models/mongoid.rb
|
293
|
+
- lib/oauth2/provider/models/mongoid/access_token.rb
|
294
|
+
- lib/oauth2/provider/models/mongoid/authorization.rb
|
295
|
+
- lib/oauth2/provider/models/mongoid/authorization_code.rb
|
296
|
+
- lib/oauth2/provider/models/mongoid/client.rb
|
297
|
+
- lib/oauth2/provider/rack.rb
|
298
|
+
- lib/oauth2/provider/rack/access_token_handler.rb
|
299
|
+
- lib/oauth2/provider/rack/authorization_code_request.rb
|
300
|
+
- lib/oauth2/provider/rack/authorization_codes_support.rb
|
301
|
+
- lib/oauth2/provider/rack/middleware.rb
|
302
|
+
- lib/oauth2/provider/rack/resource_request.rb
|
303
|
+
- lib/oauth2/provider/rack/responses.rb
|
304
|
+
- lib/oauth2/provider/rails.rb
|
305
|
+
- lib/oauth2/provider/rails/controller_authentication.rb
|
306
|
+
- lib/oauth2/provider/random.rb
|
307
|
+
- lib/oauth2/provider/version.rb
|
308
|
+
- oauth2-provider.gemspec
|
309
|
+
- spec/models/access_token_spec.rb
|
310
|
+
- spec/models/authorization_code_spec.rb
|
311
|
+
- spec/models/authorization_spec.rb
|
312
|
+
- spec/models/client_spec.rb
|
313
|
+
- spec/requests/access_tokens_controller_spec.rb
|
314
|
+
- spec/requests/authentication_spec.rb
|
315
|
+
- spec/requests/authorization_codes_support_spec.rb
|
316
|
+
- spec/schema.rb
|
317
|
+
- spec/set_backend_env_to_mongoid.rb
|
318
|
+
- spec/spec_helper.rb
|
319
|
+
- spec/support/activerecord_backend.rb
|
320
|
+
- spec/support/factories.rb
|
321
|
+
- spec/support/macros.rb
|
322
|
+
- spec/support/mongoid_backend.rb
|
323
|
+
- spec/support/rack.rb
|
324
|
+
has_rdoc: true
|
325
|
+
homepage: http://tomafro.net
|
326
|
+
licenses: []
|
327
|
+
|
328
|
+
post_install_message:
|
329
|
+
rdoc_options: []
|
330
|
+
|
331
|
+
require_paths:
|
332
|
+
- lib
|
333
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
334
|
+
none: false
|
335
|
+
requirements:
|
336
|
+
- - ">="
|
337
|
+
- !ruby/object:Gem::Version
|
338
|
+
hash: 3
|
339
|
+
segments:
|
340
|
+
- 0
|
341
|
+
version: "0"
|
342
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
343
|
+
none: false
|
344
|
+
requirements:
|
345
|
+
- - ">="
|
346
|
+
- !ruby/object:Gem::Version
|
347
|
+
hash: 3
|
348
|
+
segments:
|
349
|
+
- 0
|
350
|
+
version: "0"
|
351
|
+
requirements: []
|
352
|
+
|
353
|
+
rubyforge_project:
|
354
|
+
rubygems_version: 1.6.2
|
355
|
+
signing_key:
|
356
|
+
specification_version: 3
|
357
|
+
summary: OAuth2 Provider, extracted from api.hashblue.com
|
358
|
+
test_files:
|
359
|
+
- spec/models/access_token_spec.rb
|
360
|
+
- spec/models/authorization_code_spec.rb
|
361
|
+
- spec/models/authorization_spec.rb
|
362
|
+
- spec/models/client_spec.rb
|
363
|
+
- spec/requests/access_tokens_controller_spec.rb
|
364
|
+
- spec/requests/authentication_spec.rb
|
365
|
+
- spec/requests/authorization_codes_support_spec.rb
|
366
|
+
- spec/schema.rb
|
367
|
+
- spec/set_backend_env_to_mongoid.rb
|
368
|
+
- spec/spec_helper.rb
|
369
|
+
- spec/support/activerecord_backend.rb
|
370
|
+
- spec/support/factories.rb
|
371
|
+
- spec/support/macros.rb
|
372
|
+
- spec/support/mongoid_backend.rb
|
373
|
+
- spec/support/rack.rb
|