doorkeeper 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of doorkeeper might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.travis.yml +3 -3
- data/CHANGELOG.md +9 -0
- data/Gemfile +5 -1
- data/README.md +33 -15
- data/app/assets/stylesheets/doorkeeper/admin/application.css +14 -0
- data/app/assets/stylesheets/doorkeeper/application.css +50 -4
- data/app/controllers/doorkeeper/applications_controller.rb +1 -0
- data/app/helpers/doorkeeper/form_errors_helper.rb +5 -3
- data/app/views/doorkeeper/applications/_delete_form.html.erb +3 -14
- data/app/views/doorkeeper/applications/_form.html.erb +29 -27
- data/app/views/doorkeeper/applications/edit.html.erb +3 -11
- data/app/views/doorkeeper/applications/index.html.erb +24 -31
- data/app/views/doorkeeper/applications/new.html.erb +3 -11
- data/app/views/doorkeeper/applications/show.html.erb +31 -21
- data/app/views/doorkeeper/authorizations/error.html.erb +6 -5
- data/app/views/doorkeeper/authorizations/new.html.erb +21 -18
- data/app/views/doorkeeper/authorizations/show.html.erb +6 -3
- data/app/views/doorkeeper/authorized_applications/_delete_form.html.erb +5 -0
- data/app/views/doorkeeper/authorized_applications/index.html.erb +19 -19
- data/app/views/layouts/doorkeeper/admin.html.erb +34 -0
- data/app/views/layouts/doorkeeper/application.html.erb +13 -22
- data/lib/doorkeeper/config.rb +15 -4
- data/lib/doorkeeper/helpers/filter.rb +1 -1
- data/lib/doorkeeper/models/active_record/access_grant.rb +1 -1
- data/lib/doorkeeper/models/active_record/access_token.rb +1 -1
- data/lib/doorkeeper/models/active_record/application.rb +2 -2
- data/lib/doorkeeper/models/application.rb +2 -1
- data/lib/doorkeeper/models/mongoid/version.rb +15 -0
- data/lib/doorkeeper/models/{mongoid3 → mongoid3_4}/access_grant.rb +8 -1
- data/lib/doorkeeper/models/{mongoid3 → mongoid3_4}/access_token.rb +8 -1
- data/lib/doorkeeper/models/{mongoid3 → mongoid3_4}/application.rb +0 -0
- data/lib/doorkeeper/oauth/error_response.rb +2 -1
- data/lib/doorkeeper/oauth/helpers/uri_checker.rb +7 -2
- data/lib/doorkeeper/version.rb +1 -1
- data/lib/generators/doorkeeper/templates/initializer.rb +5 -0
- data/spec/dummy/app/models/user.rb +1 -1
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/config/environments/development.rb +2 -3
- data/spec/dummy/config/environments/production.rb +2 -0
- data/spec/dummy/config/environments/test.rb +8 -0
- data/spec/dummy/config/mongoid4.yml +18 -0
- data/spec/lib/config_spec.rb +5 -0
- data/spec/lib/oauth/helpers/uri_checker_spec.rb +45 -0
- data/spec/requests/applications/applications_request_spec.rb +4 -4
- data/spec/requests/flows/authorization_code_spec.rb +1 -1
- data/spec/requests/flows/client_credentials_spec.rb +1 -1
- data/spec/spec_helper_integration.rb +6 -0
- data/spec/support/helpers/request_spec_helper.rb +4 -0
- data/vendor/assets/stylesheets/doorkeeper/bootstrap.min.css +7 -356
- metadata +10 -6
- data/app/assets/stylesheets/doorkeeper/form.css +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5932eba602c89d1c69d2255da6feb6c617fe969c
|
4
|
+
data.tar.gz: bc86b1d997b36876f7f3adb05f6043b069c79528
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e2cd77f86d3c8ca56317b562502f186e54633c6decc945fd50e52ca7ad34133f52190129db1171d59e014d878abb1390ae2082d0fb3438a18315a3c09d734b1
|
7
|
+
data.tar.gz: 6c484a19b386a02d24ffebbc62ad80d6c9e7cda67d94baa49afe25fd010a51eec4d4c8bfe0ef59f8fa95265ca66b6e7fbb337260f7473170d4502cbc3c96ee49
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.1.0 (not yet released)
|
4
|
+
|
5
|
+
- enhancements
|
6
|
+
- [#336] mongoid4 support.
|
7
|
+
- [#372] Allow users to set ActiveRecord table_name_prefix/suffix options
|
8
|
+
- internals
|
9
|
+
- [#343] separate OAuth's admin and user end-point to different layouts, upgrade theme to Bootstrap 3.1.
|
10
|
+
- [#348] Move render_options in filter after `@error` has been set
|
11
|
+
|
3
12
|
## 1.0.0
|
4
13
|
|
5
14
|
- bug (spec)
|
data/Gemfile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Defaults. For supported versions check .travis.yml
|
2
|
-
ENV['rails'] ||= '3.2.13'
|
2
|
+
ENV['rails'] ||= ENV['orm'] == "mongoid4" ? '4.0.2' : '3.2.13'
|
3
3
|
ENV['orm'] ||= 'active_record'
|
4
4
|
|
5
5
|
source 'https://rubygems.org'
|
@@ -20,6 +20,10 @@ when 'mongoid2'
|
|
20
20
|
when 'mongoid3'
|
21
21
|
gem 'mongoid', '3.0.10'
|
22
22
|
|
23
|
+
when 'mongoid4'
|
24
|
+
gem 'mongoid', '4.0.0.beta1'
|
25
|
+
gem 'moped'
|
26
|
+
|
23
27
|
when 'mongo_mapper'
|
24
28
|
gem 'mongo_mapper', '0.12.0'
|
25
29
|
gem 'bson_ext', '~> 1.7'
|
data/README.md
CHANGED
@@ -7,12 +7,39 @@
|
|
7
7
|
|
8
8
|
Doorkeeper is a gem that makes it easy to introduce OAuth 2 provider functionality to your application.
|
9
9
|
|
10
|
-
|
10
|
+
## Table of Contents
|
11
|
+
|
12
|
+
- [Useful links](#useful-links)
|
13
|
+
- [Requirements](#requirements)
|
14
|
+
- [Installation](#installation)
|
15
|
+
- [Configuration](#configuration)
|
16
|
+
- [Active Record](#active-record)
|
17
|
+
- [Mongoid / MongoMapper](#mongoid--mongomapper)
|
18
|
+
- [Mongoid indexes](#mongoid-indexes)
|
19
|
+
- [MongoMapper indexes](#mongomapper-indexes)
|
20
|
+
- [Routes](#routes)
|
21
|
+
- [Authenticating](#authenticating)
|
22
|
+
- [Protecting resources with OAuth (a.k.a your API endpoint)](#protecting-resources-with-oauth-aka-your-api-endpoint)
|
23
|
+
- [ActionController::Metal integration and other integrations](#actioncontrollermetal-integration-and-other-integrations)
|
24
|
+
- [Access Token Scopes](#access-token-scopes)
|
25
|
+
- [Authenticated resource owner](#authenticated-resource-owner)
|
26
|
+
- [Applications list](#applications-list)
|
27
|
+
- [Other customizations](#other-customizations)
|
28
|
+
- [Upgrading](#upgrading)
|
29
|
+
- [Development](#development)
|
30
|
+
- [Contributing](#contributing)
|
31
|
+
- [Other resources](#other-resources)
|
32
|
+
- [Wiki](#wiki)
|
33
|
+
- [Live demo](#live-demo)
|
34
|
+
- [Screencast](#screencast)
|
35
|
+
- [Client applications](#client-applications)
|
36
|
+
- [Contributors](#contributors)
|
37
|
+
- [License](#license)
|
11
38
|
|
12
39
|
## Useful links
|
13
40
|
|
14
41
|
- For documentation, please check out our [wiki](https://github.com/applicake/doorkeeper/wiki)
|
15
|
-
- For general questions, please post it in
|
42
|
+
- For general questions, please post it in [stack overflow](http://stackoverflow.com/questions/tagged/doorkeeper)
|
16
43
|
|
17
44
|
## Requirements
|
18
45
|
|
@@ -25,7 +52,7 @@ The gem is under constant development. It is based in the [version 22 of the OAu
|
|
25
52
|
Put this in your Gemfile:
|
26
53
|
|
27
54
|
``` ruby
|
28
|
-
gem 'doorkeeper'
|
55
|
+
gem 'doorkeeper'
|
29
56
|
```
|
30
57
|
|
31
58
|
Run the installation generator with:
|
@@ -52,7 +79,7 @@ Doorkeeper currently supports MongoMapper, Mongoid 2 and 3. To start using it, y
|
|
52
79
|
|
53
80
|
``` ruby
|
54
81
|
Doorkeeper.configure do
|
55
|
-
orm :mongoid2 # or :mongoid3, :mongo_mapper
|
82
|
+
orm :mongoid2 # or :mongoid3, :mongoid4, :mongo_mapper
|
56
83
|
end
|
57
84
|
```
|
58
85
|
|
@@ -234,7 +261,7 @@ The logic is the same as the `resource_owner_authenticator` block. **Note:** sin
|
|
234
261
|
|
235
262
|
If you want to upgrade doorkeeper to a new version, check out the [upgrading notes](https://github.com/applicake/doorkeeper/wiki/Migration-from-old-versions) and take a look at the [changelog](https://github.com/applicake/doorkeeper/blob/master/CHANGELOG.md).
|
236
263
|
|
237
|
-
|
264
|
+
## Development
|
238
265
|
|
239
266
|
To run the local engine server:
|
240
267
|
|
@@ -251,7 +278,7 @@ rails=3.2.8 orm=active_record bundle exec rake
|
|
251
278
|
|
252
279
|
Or you might prefer to run `script/run_all` to integrate against all ORMs.
|
253
280
|
|
254
|
-
|
281
|
+
## Contributing
|
255
282
|
|
256
283
|
Want to contribute and don't know where to start? Check out [features we're missing](https://github.com/applicake/doorkeeper/wiki/Supported-Features), create [example apps](https://github.com/applicake/doorkeeper/wiki/Example-Applications), integrate the gem with your app and let us know!
|
257
284
|
|
@@ -275,15 +302,6 @@ Check out this screencast from [railscasts.com](http://railscasts.com/): [#353 O
|
|
275
302
|
|
276
303
|
After you set up the provider, you may want to create a client application to test the integration. Check out these [client examples](https://github.com/applicake/doorkeeper/wiki/Example-Applications) in our wiki or follow this [tutorial here](https://github.com/applicake/doorkeeper/wiki/Testing-your-provider-with-OAuth2-gem).
|
277
304
|
|
278
|
-
### Supported ruby versions
|
279
|
-
|
280
|
-
All supported ruby versions are [listed here](https://github.com/applicake/doorkeeper/wiki/Supported-Ruby-&-Rails-versions).
|
281
|
-
|
282
|
-
### Maintainers
|
283
|
-
|
284
|
-
- Felipe Elias Philipp - [coderwall.com/felipeelias](http://coderwall.com/felipeelias)
|
285
|
-
- Piotr Jakubowski - [coderwall.com/piotrj](http://coderwall.com/piotrj)
|
286
|
-
|
287
305
|
### Contributors
|
288
306
|
|
289
307
|
Thanks to all our [awesome contributors](https://github.com/applicake/doorkeeper/contributors)!
|
@@ -6,13 +6,59 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
body {
|
9
|
-
|
9
|
+
background-color: #eee;
|
10
|
+
font-size: 14px;
|
11
|
+
}
|
12
|
+
|
13
|
+
#container {
|
14
|
+
background-color: #fff;
|
15
|
+
border: 1px solid #999;
|
16
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
17
|
+
border-radius: 6px;
|
18
|
+
-webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
|
19
|
+
box-shadow: 0 3px 20px rgba(0, 0, 0, 0.3);
|
20
|
+
margin: 2em auto;
|
21
|
+
max-width: 600px;
|
22
|
+
outline: 0;
|
23
|
+
padding: 1em;
|
24
|
+
width: 80%;
|
25
|
+
}
|
26
|
+
|
27
|
+
.page-header {
|
28
|
+
margin-top: 20px;
|
29
|
+
}
|
30
|
+
|
31
|
+
#oauth-permissions {
|
32
|
+
width: 260px;
|
33
|
+
}
|
34
|
+
|
35
|
+
.actions {
|
36
|
+
border-top: 1px solid #eee;
|
37
|
+
margin-top: 1em;
|
38
|
+
padding-top: 9px;
|
39
|
+
}
|
40
|
+
|
41
|
+
.actions > form > .btn {
|
42
|
+
margin-top: 5px;
|
43
|
+
}
|
44
|
+
|
45
|
+
.separator {
|
46
|
+
color: #eee;
|
47
|
+
padding: 0 .5em;
|
10
48
|
}
|
11
49
|
|
12
50
|
.inline_block {
|
13
|
-
|
51
|
+
display: inline-block;
|
52
|
+
}
|
53
|
+
|
54
|
+
#oauth {
|
55
|
+
margin-bottom: 1em;
|
56
|
+
}
|
57
|
+
|
58
|
+
#oauth > .btn {
|
59
|
+
width: 7em;
|
14
60
|
}
|
15
61
|
|
16
|
-
|
17
|
-
|
62
|
+
td {
|
63
|
+
vertical-align: middle !important;
|
18
64
|
}
|
@@ -1,9 +1,11 @@
|
|
1
1
|
module Doorkeeper::FormErrorsHelper
|
2
2
|
def errors_for(object, method)
|
3
3
|
if object.errors[method].present?
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
object.errors[method].map do |msg|
|
5
|
+
content_tag(:span, :class => "help-block") do
|
6
|
+
msg.capitalize
|
7
|
+
end
|
8
|
+
end.reduce(&:join).html_safe
|
7
9
|
end
|
8
10
|
end
|
9
11
|
end
|
@@ -1,16 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
padding: 0;
|
4
|
-
border: none;
|
5
|
-
box-shadow: none;
|
6
|
-
background: none;
|
7
|
-
color: #0069d6;
|
8
|
-
}
|
9
|
-
input[type=submit]:hover {
|
10
|
-
text-decoration: underline;
|
11
|
-
}
|
12
|
-
</style>
|
13
|
-
<%= form_for [:oauth, application] do |f| %>
|
1
|
+
<%- submit_btn_css ||= 'btn btn-link' %>
|
2
|
+
<%= form_tag [:oauth, application] do %>
|
14
3
|
<input type="hidden" name="_method" value="delete">
|
15
|
-
<%=
|
4
|
+
<%= submit_tag 'Destroy', onclick: "return confirm('Are you sure?')", class: submit_btn_css %>
|
16
5
|
<% end %>
|
@@ -1,35 +1,37 @@
|
|
1
|
-
<%= form_for
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
<% end %>
|
1
|
+
<%= form_for [:oauth, application], html: {class: 'form-horizontal', role: 'form'} do |f| %>
|
2
|
+
<% if application.errors.any? %>
|
3
|
+
<div class="alert alert-danger" data-alert><p>Whoops! Check your form for possible errors</p></div>
|
4
|
+
<% end %>
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
</div>
|
6
|
+
<%= content_tag :div, class: "form-group#{' has-error' if application.errors[:name].present?}" do %>
|
7
|
+
<%= f.label :name, class: 'col-sm-2 control-label', for: 'application_name' %>
|
8
|
+
<div class="col-sm-10">
|
9
|
+
<%= f.text_field :name, class: 'form-control' %>
|
10
|
+
<%= errors_for application, :name %>
|
13
11
|
</div>
|
12
|
+
<% end %>
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
14
|
+
<%= content_tag :div, class: "form-group#{' has-error' if application.errors[:redirect_uri].present?}" do %>
|
15
|
+
<%= f.label :redirect_uri, class: 'col-sm-2 control-label', for: 'application_redirect_uri' %>
|
16
|
+
<div class="col-sm-10">
|
17
|
+
<%= f.text_area :redirect_uri, class: 'form-control' %>
|
18
|
+
<%= errors_for application, :redirect_uri %>
|
19
|
+
<span class="help-block">
|
20
|
+
Use one line per URI
|
21
|
+
</span>
|
22
|
+
<% if Doorkeeper.configuration.test_redirect_uri %>
|
23
|
+
<span class="help-block">
|
24
|
+
Use <code><%= Doorkeeper.configuration.test_redirect_uri %></code> for local tests
|
25
|
+
</span>
|
26
|
+
<% end %>
|
25
27
|
</div>
|
28
|
+
<% end %>
|
26
29
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
<%=
|
31
|
-
<%= link_to "Cancel", oauth_applications_path, :class => "btn" %>
|
30
|
+
<div class="form-group">
|
31
|
+
<div class="col-sm-offset-2 col-sm-10">
|
32
|
+
<%= f.submit 'Submit', :class => "btn btn-primary" %>
|
33
|
+
<%= link_to "Cancel", oauth_applications_path, :class => "btn btn-default" %>
|
32
34
|
</div>
|
33
|
-
</
|
35
|
+
</div>
|
34
36
|
<% end %>
|
35
37
|
|
@@ -1,13 +1,5 @@
|
|
1
|
-
<div class="
|
2
|
-
<
|
3
|
-
</div>
|
4
|
-
|
5
|
-
<div class="span12">
|
6
|
-
<%= render 'form', :application => @application %>
|
7
|
-
</div>
|
8
|
-
|
9
|
-
<div class="span4">
|
10
|
-
<h3>Actions</h3>
|
11
|
-
<p><%= link_to 'Back to application list', oauth_applications_path %></p>
|
1
|
+
<div class="page-header">
|
2
|
+
<h1>Edit application</h1>
|
12
3
|
</div>
|
13
4
|
|
5
|
+
<%= render 'form', :application => @application %>
|
@@ -1,33 +1,26 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
|
4
|
-
}
|
5
|
-
</style>
|
6
|
-
<div class="span16">
|
7
|
-
<header class="page-header">
|
8
|
-
<h2>Your applications</h2>
|
9
|
-
</header>
|
1
|
+
<div class="page-header">
|
2
|
+
<h1>Your applications</h1>
|
3
|
+
</div>
|
10
4
|
|
11
|
-
|
5
|
+
<p><%= link_to 'New Application', new_oauth_application_path, class: 'btn btn-success' %></p>
|
12
6
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
</div>
|
7
|
+
<table class="table table-striped">
|
8
|
+
<thead>
|
9
|
+
<tr>
|
10
|
+
<th>Name</th>
|
11
|
+
<th>Callback URL</th>
|
12
|
+
<th></th>
|
13
|
+
<th></th>
|
14
|
+
</tr>
|
15
|
+
</thead>
|
16
|
+
<tbody>
|
17
|
+
<% @applications.each do |application| %>
|
18
|
+
<tr id="application_<%= application.id %>">
|
19
|
+
<td><%= link_to application.name, [:oauth, application] %></td>
|
20
|
+
<td><%= application.redirect_uri %></td>
|
21
|
+
<td><%= link_to 'Edit', edit_oauth_application_path(application), class: 'btn btn-link' %></td>
|
22
|
+
<td><%= render 'delete_form', application: application %></td>
|
23
|
+
</tr>
|
24
|
+
<% end %>
|
25
|
+
</tbody>
|
26
|
+
</table>
|
@@ -1,13 +1,5 @@
|
|
1
|
-
<div class="
|
2
|
-
<
|
3
|
-
</div>
|
4
|
-
|
5
|
-
<div class="span12">
|
6
|
-
<%= render 'form', :application => @application %>
|
7
|
-
</div>
|
8
|
-
|
9
|
-
<div class="span4">
|
10
|
-
<h3>Actions</h3>
|
11
|
-
<p><%= link_to 'Back to application list', oauth_applications_path %></p>
|
1
|
+
<div class="page-header">
|
2
|
+
<h1>New application</h1>
|
12
3
|
</div>
|
13
4
|
|
5
|
+
<%= render 'form', :application => @application %>
|