oauth2_provider_engine 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/oauth2_provider/application.js +52 -0
- data/app/assets/javascripts/oauth2_provider/highcharts.js +162 -0
- data/app/assets/javascripts/oauth2_provider/jquery.tagsinput.js +218 -0
- data/app/assets/stylesheets/oauth2_provider/gh-buttons.css +388 -0
- data/app/assets/stylesheets/oauth2_provider/gh-icons.png +0 -0
- data/app/assets/stylesheets/oauth2_provider/jquery.tagsinput.css +6 -0
- data/app/assets/stylesheets/oauth2_provider/reset.css +2 -0
- data/app/assets/stylesheets/oauth2_provider/template.css +52 -0
- data/app/controllers/oauth2_provider/accesses_controller.rb +39 -0
- data/app/controllers/oauth2_provider/application_controller.rb +17 -0
- data/app/controllers/oauth2_provider/authorize_controller.rb +141 -0
- data/app/controllers/oauth2_provider/clients_controller.rb +85 -0
- data/app/controllers/oauth2_provider/scopes_controller.rb +63 -0
- data/app/controllers/oauth2_provider/token_controller.rb +187 -0
- data/app/helpers/clients_helper.rb +5 -0
- data/app/helpers/oauth2_provider/application_helper.rb +4 -0
- data/app/models/oauth2_provider/client.rb +129 -0
- data/app/models/oauth2_provider/document.rb +15 -0
- data/app/models/oauth2_provider/oauth_access.rb +80 -0
- data/app/models/oauth2_provider/oauth_authorization.rb +70 -0
- data/app/models/oauth2_provider/oauth_daily_request.rb +54 -0
- data/app/models/oauth2_provider/oauth_refresh_token.rb +20 -0
- data/app/models/oauth2_provider/oauth_token.rb +78 -0
- data/app/models/oauth2_provider/scope.rb +39 -0
- data/app/views/layouts/oauth2_provider/application.html.erb +62 -0
- data/app/views/oauth2_provider/accesses/index.html.erb +25 -0
- data/app/views/oauth2_provider/accesses/show.html.erb +35 -0
- data/app/views/oauth2_provider/clients/_form.html.erb +50 -0
- data/app/views/oauth2_provider/clients/edit.html.erb +9 -0
- data/app/views/oauth2_provider/clients/index.html.erb +43 -0
- data/app/views/oauth2_provider/clients/new.html.erb +8 -0
- data/app/views/oauth2_provider/clients/show.html.erb +49 -0
- data/app/views/oauth2_provider/scopes/_form.html.erb +35 -0
- data/app/views/oauth2_provider/scopes/edit.html.erb +8 -0
- data/app/views/oauth2_provider/scopes/index.html.erb +27 -0
- data/app/views/oauth2_provider/scopes/new.html.erb +7 -0
- data/app/views/oauth2_provider/scopes/show.html.erb +19 -0
- data/app/views/shared/authorize.html.erb +34 -0
- data/app/views/shared/token.json.erb +8 -0
- data/config/locales/en.yml +31 -0
- data/config/oauth.yml +4 -0
- data/config/routes.rb +25 -0
- data/lib/oauth2_provider.rb +38 -0
- data/lib/oauth2_provider/controller_mixin.rb +53 -0
- data/lib/oauth2_provider/engine.rb +4 -0
- data/lib/oauth2_provider_engine.rb +1 -0
- data/lib/oauth2_provider_engine/version.rb +3 -0
- data/test/dummy/CHANGELOG.rdoc +67 -0
- data/test/dummy/Gemfile +53 -0
- data/test/dummy/Gemfile.lock +254 -0
- data/test/dummy/README.rdoc +522 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/VERSION +1 -0
- data/test/dummy/app/assets/stylesheets/reset.css +2 -0
- data/test/dummy/app/assets/stylesheets/template.css +52 -0
- data/test/dummy/app/controllers/application_controller.rb +52 -0
- data/test/dummy/app/controllers/pastas_controller.rb +23 -0
- data/test/dummy/app/controllers/pizzas_controller.rb +23 -0
- data/test/dummy/app/controllers/sessions_controller.rb +26 -0
- data/test/dummy/app/controllers/users_controller.rb +59 -0
- data/test/dummy/app/models/user.rb +50 -0
- data/test/dummy/app/views/layouts/application.html.erb +65 -0
- data/test/dummy/app/views/sessions/new.html.erb +25 -0
- data/test/dummy/app/views/shared/403.json.erb +4 -0
- data/test/dummy/app/views/shared/404.json.erb +6 -0
- data/test/dummy/app/views/shared/422.json.erb +5 -0
- data/test/dummy/app/views/shared/500.json.erb +4 -0
- data/test/dummy/app/views/shared/html/404.html.erb +0 -0
- data/test/dummy/app/views/shared/html/422.html.erb +0 -0
- data/test/dummy/app/views/users/_form.html.erb +27 -0
- data/test/dummy/app/views/users/edit.html.erb +8 -0
- data/test/dummy/app/views/users/index.html.erb +20 -0
- data/test/dummy/app/views/users/new.html.erb +46 -0
- data/test/dummy/app/views/users/show.html.erb +15 -0
- data/test/dummy/app/views/users/show.json.erb +6 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +57 -0
- data/test/dummy/config/boot.rb +13 -0
- data/test/dummy/config/cucumber.yml +8 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +32 -0
- data/test/dummy/config/environments/production.rb +58 -0
- data/test/dummy/config/environments/test.rb +35 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/test.rb +3 -0
- data/test/dummy/config/locales/en.yml +1 -0
- data/test/dummy/config/mongoid.yml +20 -0
- data/test/dummy/config/routes.rb +22 -0
- data/test/dummy/db/seeds.rb +7 -0
- data/test/dummy/doc/README_FOR_APP +2 -0
- data/test/dummy/lib/tasks/cucumber.rake +53 -0
- data/test/dummy/lib/tasks/watchr.rake +5 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +4 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/robots.txt +5 -0
- data/test/dummy/script/cucumber +10 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/spec/acceptance/acceptance_helper.rb +5 -0
- data/test/dummy/spec/acceptance/accesses_controller_spec.rb +77 -0
- data/test/dummy/spec/acceptance/clients_controller_spec.rb +218 -0
- data/test/dummy/spec/acceptance/oauth_authorize_controller_spec.rb +241 -0
- data/test/dummy/spec/acceptance/oauth_token_controller_spec.rb +196 -0
- data/test/dummy/spec/acceptance/resource_controller_spec.rb +143 -0
- data/test/dummy/spec/acceptance/scopes_controller_spec.rb +227 -0
- data/test/dummy/spec/acceptance/support/helpers.rb +81 -0
- data/test/dummy/spec/acceptance/support/paths.rb +9 -0
- data/test/dummy/spec/acceptance/support/view_helpers.rb +52 -0
- data/test/dummy/spec/acceptance/users_controller_spec.rb +198 -0
- data/test/dummy/spec/extras/scope_spec.rb +105 -0
- data/test/dummy/spec/factories/oauth.rb +106 -0
- data/test/dummy/spec/models/oauth/client_spec.rb +123 -0
- data/test/dummy/spec/models/oauth/oauth_access_spec.rb +48 -0
- data/test/dummy/spec/models/oauth/oauth_authorization_spec.rb +50 -0
- data/test/dummy/spec/models/oauth/oauth_daily_request_spec.rb +14 -0
- data/test/dummy/spec/models/oauth/oauth_refresh_token_spec.rb +11 -0
- data/test/dummy/spec/models/oauth/oauth_token_spec.rb +55 -0
- data/test/dummy/spec/models/scope_spec.rb +17 -0
- data/test/dummy/spec/spec_helper.rb +39 -0
- data/test/dummy/spec/support/settings_helper.rb +28 -0
- data/test/dummy/test/initializers/capybara_headers_hack.rb +23 -0
- data/test/oauth2_provider_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- metadata +387 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
module Oauth2Provider
|
2
|
+
class Scope
|
3
|
+
include Mongoid::Document
|
4
|
+
include Mongoid::Timestamps
|
5
|
+
include Document::Base
|
6
|
+
|
7
|
+
field :name
|
8
|
+
field :uri
|
9
|
+
field :values, type: Array, default: []
|
10
|
+
|
11
|
+
attr_accessible :name
|
12
|
+
|
13
|
+
validates :name, presence: true
|
14
|
+
validates :values, presence: true
|
15
|
+
validates :uri, url: true
|
16
|
+
|
17
|
+
def normalize(val)
|
18
|
+
separator = Oauth2Provider.settings["scope_separator"]
|
19
|
+
val = val.split(separator)
|
20
|
+
end
|
21
|
+
|
22
|
+
def values_pretty
|
23
|
+
separator = Oauth2Provider.settings["scope_separator"]
|
24
|
+
values.join(separator)
|
25
|
+
end
|
26
|
+
|
27
|
+
class << self
|
28
|
+
# Sync all scopes with the correct exploded scope when a
|
29
|
+
# scope is modified (changed or removed)
|
30
|
+
def sync_scopes_with_scope(scope)
|
31
|
+
scopes_to_sync = any_in(scope: [scope])
|
32
|
+
scopes_to_sync.each do |client|
|
33
|
+
scope.values = Oauth2Provider.normalize_scope(scope.values)
|
34
|
+
scope.save
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>OAuth 2.0 Provider Engine</title>
|
6
|
+
<%= stylesheet_link_tag 'oauth2_provider/reset', 'oauth2_provider/template', 'oauth2_provider/jquery.tagsinput', 'oauth2_provider/gh-buttons' %>
|
7
|
+
<%= javascript_include_tag :jquery, 'oauth2_provider/highcharts', 'oauth2_provider/jquery.tagsinput', 'oauth2_provider/application' %>
|
8
|
+
<%= csrf_meta_tag %>
|
9
|
+
</head>
|
10
|
+
|
11
|
+
<body">
|
12
|
+
<div class="container">
|
13
|
+
<% unless request.path == oauth2_provider_engine.oauth2_provider_authorize_path %>
|
14
|
+
<a class="ribbon" href="https://github.com/lelylan/rest-oauth2-server" target="_blank"><img src="http://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a>
|
15
|
+
|
16
|
+
<div class="header">
|
17
|
+
<h1>OAuth 2.0 Provider Engine</h1>
|
18
|
+
<p>
|
19
|
+
<b><a href="https://github.com/lelylan/rest-oauth2-server" title="GitHub repository">OAuth 2.0 Provider Engine</a>
|
20
|
+
let you open up your API and manage end-user authentication and client application authorization
|
21
|
+
implementing the OAuth 2.0 Specifications (draft 13). Read more on <a href="https://github.com/lelylan/rest-oauth2-server" title="GitHub readme">Github</a>
|
22
|
+
</b>
|
23
|
+
</p>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
26
|
+
<div class="navigation">
|
27
|
+
<% if current_user %>
|
28
|
+
<div>
|
29
|
+
<%= link_to("Base Application", '/') %> |
|
30
|
+
<%= link_to("Accesses", oauth2_provider_engine.oauth2_provider_accesses_path) %> |
|
31
|
+
<%= link_to("Clients", oauth2_provider_engine.oauth2_provider_clients_path) %>
|
32
|
+
<% if current_user.admin? %> |
|
33
|
+
<%= link_to("Scopes", oauth2_provider_engine.oauth2_provider_scopes_path) %>
|
34
|
+
<% end %>
|
35
|
+
</div>
|
36
|
+
<% end %>
|
37
|
+
</div>
|
38
|
+
<br/>
|
39
|
+
|
40
|
+
|
41
|
+
<% if flash.notice %>
|
42
|
+
<div class="flash_notice">
|
43
|
+
<%= flash.notice %>
|
44
|
+
</div>
|
45
|
+
<% end %>
|
46
|
+
|
47
|
+
<% if flash.alert %>
|
48
|
+
<div class=flash_alert>
|
49
|
+
<%= flash.alert %>
|
50
|
+
<% if @info %>
|
51
|
+
<p>Additional information:
|
52
|
+
<%= @info.to_json%>
|
53
|
+
</p>
|
54
|
+
<% end %>
|
55
|
+
</div>
|
56
|
+
<% end %>
|
57
|
+
|
58
|
+
<%= yield %>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
</body>
|
62
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<h2>Show Accesses</h2>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Client URI</th>
|
6
|
+
<th></th>
|
7
|
+
<th></th>
|
8
|
+
</tr>
|
9
|
+
|
10
|
+
<% @accesses.each do |access| %>
|
11
|
+
<tr>
|
12
|
+
<td><%= access.client_uri %></td>
|
13
|
+
<td><%= link_to 'Show stats', oauth2_provider_engine.oauth2_provider_access_path(access), class: "button icon settings" %></td>
|
14
|
+
|
15
|
+
<% if access.blocked? %>
|
16
|
+
<td><%= link_to 'Unblock!', oauth2_provider_engine.unblock_oauth2_provider_access_path(access), method: :put, class: "button danger" %></td>
|
17
|
+
<% else %>
|
18
|
+
<td><%= link_to 'Block!', oauth2_provider_engine.block_oauth2_provider_access_path(access), method: :put, class: "button danger" %></td>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
</tr>
|
22
|
+
<% end %>
|
23
|
+
</table>
|
24
|
+
|
25
|
+
<br/>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<h2>Show Access</h2>
|
2
|
+
|
3
|
+
<div class="field_show">
|
4
|
+
<b>Client URI:</b>
|
5
|
+
<%= @access.client_uri %>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="field_show">
|
9
|
+
<b>Today requests:</b>
|
10
|
+
<%= @access.daily_requests.times %>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div id="chart" style="width: 100%; height: 250px"></div>
|
14
|
+
|
15
|
+
<div class="footer_buttons">
|
16
|
+
<%= link_to 'Back', oauth2_provider_engine.oauth2_provider_accesses_path, class: "button icon arrowleft" %>
|
17
|
+
<% if @access.blocked? %>
|
18
|
+
<%= link_to 'Unblock!', oauth2_provider_engine.unblock_oauth2_provider_access_path(@access), method: :put, class: "button danger" %>
|
19
|
+
<% else %>
|
20
|
+
<%= link_to 'Block!', oauth2_provider_engine.block_oauth2_provider_access_path(@access), method: :put, class: "button danger" %>
|
21
|
+
<% end %>
|
22
|
+
<div>
|
23
|
+
|
24
|
+
|
25
|
+
<script>
|
26
|
+
$(document).ready(function() {
|
27
|
+
createChart(
|
28
|
+
<%=raw @access.chart_days %>,
|
29
|
+
<%= @access.chart_times.to_json %>,
|
30
|
+
"<%= @access.client_uri %>"
|
31
|
+
)
|
32
|
+
});
|
33
|
+
</script>
|
34
|
+
|
35
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<%
|
2
|
+
form_options = { as: :client }
|
3
|
+
if @client.new_record?
|
4
|
+
form_options.merge! :url => oauth2_provider_engine.oauth2_provider_clients_path, :method => :post
|
5
|
+
else
|
6
|
+
form_options.merge! :url => oauth2_provider_engine.oauth2_provider_client_path(@client.id), :method => :put
|
7
|
+
end
|
8
|
+
%>
|
9
|
+
<%= form_for @client, form_options do |f| %>
|
10
|
+
|
11
|
+
<% if @client.errors.any? %>
|
12
|
+
<div id="error_explanation">
|
13
|
+
<div><%= pluralize(@client.errors.count, "error") %> prohibited this resource from being saved</div>
|
14
|
+
<ul>
|
15
|
+
<% @client.errors.full_messages.each do |msg| %>
|
16
|
+
<li><%= msg %></li>
|
17
|
+
<% end %>
|
18
|
+
</ul>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
<div class="field">
|
23
|
+
<%= f.label :name %><br />
|
24
|
+
<%= f.text_field :name %>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div class="field">
|
28
|
+
<%= f.label :site_uri %><br />
|
29
|
+
<%= f.text_field :site_uri %>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<div class="field">
|
33
|
+
<%= f.label :redirect_uri %><br />
|
34
|
+
<%= f.text_field :redirect_uri %>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div class="field">
|
38
|
+
<%= f.label :scope %> (separated by spaces)<br />
|
39
|
+
<input id="client_scope" class="tags" name="client[scope]" size="30" type="text" value="<%=@client.scope_pretty%>">
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<div class="field">
|
43
|
+
<%= f.label :info %><br />
|
44
|
+
<%= f.text_field :info %>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div class="actions">
|
48
|
+
<%= f.submit nil, {class: "button"} %>
|
49
|
+
</div>
|
50
|
+
<% end %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<h2>Editing Client</h2>
|
2
|
+
|
3
|
+
<div class="header_buttons button-group">
|
4
|
+
<%= link_to 'Back', oauth2_provider_engine.oauth2_provider_clients_path, class: "button icon arrowleft" %>
|
5
|
+
<%= link_to 'Show', oauth2_provider_engine.oauth2_provider_client_path(@client), class: "button" %>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<%= render 'form' %>
|
9
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<h2>Show Clients</h2>
|
2
|
+
<div class="header_buttons">
|
3
|
+
<%= link_to 'Create a new client', oauth2_provider_engine.new_oauth2_provider_client_path, class: "button icon add" %>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<table>
|
7
|
+
<tr>
|
8
|
+
<% if current_user.admin? %>
|
9
|
+
<th>User</th>
|
10
|
+
<% end %>
|
11
|
+
<th>Name</th>
|
12
|
+
<th>Active</th>
|
13
|
+
<th></th>
|
14
|
+
<th></th>
|
15
|
+
<th></th>
|
16
|
+
<th></th>
|
17
|
+
</tr>
|
18
|
+
|
19
|
+
<% @clients.each do |client| %>
|
20
|
+
<tr>
|
21
|
+
<% if current_user.admin? %>
|
22
|
+
<td><%= link_to User, client.created_from %></td>
|
23
|
+
<% end %>
|
24
|
+
<td><%= client.name %></td>
|
25
|
+
<% unless current_user.admin? %>
|
26
|
+
<td><%= client.blocked? ? "Not Active" : "Active" %></td>
|
27
|
+
<% end %>
|
28
|
+
<td><%= link_to 'Show', oauth2_provider_engine.oauth2_provider_client_path(client), class: "button" %></td>
|
29
|
+
<td><%= link_to 'Edit', oauth2_provider_engine.edit_oauth2_provider_client_path(client), class: "button" %></td>
|
30
|
+
<td><%= link_to 'Destroy', oauth2_provider_engine.oauth2_provider_client_path(client), confirm: 'Are you sure?', method: :delete, class: "button danger" %></td>
|
31
|
+
<% if current_user.admin? %>
|
32
|
+
<% if client.blocked? %>
|
33
|
+
<td><%= link_to 'Unblock!', oauth2_provider_engine.unblock_oauth2_provider_client_path(client), method: :put, class: "button danger icon unlock" %></td>
|
34
|
+
<% else %>
|
35
|
+
<td><%= link_to 'Block!', oauth2_provider_engine.block_oauth2_provider_client_path(client), method: :put, class: "button danger icon lock" %></td>
|
36
|
+
<% end %>
|
37
|
+
<% end %>
|
38
|
+
|
39
|
+
</tr>
|
40
|
+
<% end %>
|
41
|
+
</table>
|
42
|
+
|
43
|
+
<br/>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<h2>Show Client</h2>
|
2
|
+
|
3
|
+
<div class="field_show">
|
4
|
+
<b>Client URI:</b>
|
5
|
+
<%= @client.uri %>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="field_show">
|
9
|
+
<b>Name:</b>
|
10
|
+
<%= @client.name %>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class="field_show">
|
14
|
+
<b>Secret:</b>
|
15
|
+
<%= @client.secret %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="field_show">
|
19
|
+
<b>Site URI:</b>
|
20
|
+
<%= @client.site_uri %>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="field_show">
|
24
|
+
<b>Redirect URI:</b>
|
25
|
+
<%= @client.redirect_uri %>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<div class="field_show">
|
29
|
+
<b>Scope:</b>
|
30
|
+
<%= @client.scope_pretty %>
|
31
|
+
<span class="details">(includes <%= @client.scope_values_pretty %>)</span>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<div class="field_show">
|
35
|
+
<b>Info:</b>
|
36
|
+
<%= @client.info %>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div class="actions button-container footer_buttons">
|
40
|
+
<div class="button-group">
|
41
|
+
<%= link_to 'Back', oauth2_provider_engine.oauth2_provider_clients_path, class: "button icon arrowleft" %>
|
42
|
+
<%= link_to 'Edit', oauth2_provider_engine.edit_oauth2_provider_client_path(@client), class: "button" %>
|
43
|
+
<%= link_to 'Destroy', oauth2_provider_engine.oauth2_provider_client_path(@client), :confirm => 'Are you sure?', :method => :delete, class: "button danger" %>
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div class="button-group">
|
47
|
+
<%= link_to 'Simulate Authorization', authorization_uri(@client, "all"), class: "button icon search" %>
|
48
|
+
</div>
|
49
|
+
</div>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<%
|
2
|
+
form_options = { as: :scope }
|
3
|
+
if @scope.new_record?
|
4
|
+
form_options.merge! :url => oauth2_provider_engine.oauth2_provider_scopes_path, :method => :post
|
5
|
+
else
|
6
|
+
form_options.merge! :url => oauth2_provider_engine.oauth2_provider_scope_path(@scope.id), :method => :put
|
7
|
+
end
|
8
|
+
%>
|
9
|
+
<%= form_for @scope, form_options do |f| %>
|
10
|
+
|
11
|
+
<% if @scope.errors.any? %>
|
12
|
+
<div id="error_explanation">
|
13
|
+
<div><%= pluralize(@scope.errors.count, "error") %> prohibited this resource from being saved</div>
|
14
|
+
<ul>
|
15
|
+
<% @scope.errors.full_messages.each do |msg| %>
|
16
|
+
<li><%= msg %></li>
|
17
|
+
<% end %>
|
18
|
+
</ul>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
<div class="field">
|
23
|
+
<%= f.label :name %><br />
|
24
|
+
<%= f.text_field :name %>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div class="field">
|
28
|
+
<%= f.label :values %> (separated by spaces)<br />
|
29
|
+
<input id="scope_values" class="tags" name="scope[values]" size="30" type="text" value="<%=@scope.values.join(" ") if @scope.values%>">
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<div class="actions">
|
33
|
+
<%= f.submit nil, {class: "button" } %>
|
34
|
+
</div>
|
35
|
+
<% end %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<h2>Editing Scope</h2>
|
2
|
+
|
3
|
+
<div class="button-group header_buttons">
|
4
|
+
<%= link_to 'Back', oauth2_provider_engine.oauth2_provider_scopes_path, class: "button icon arrowleft" %>
|
5
|
+
<%= link_to 'Show', oauth2_provider_engine.oauth2_provider_scope_path(@scope), class: "button" %>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<%= render 'form' %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<h2>Show Scope</h2>
|
2
|
+
|
3
|
+
<div class="header_buttons">
|
4
|
+
<%= link_to 'Create a new scope', oauth2_provider_engine.new_oauth2_provider_scope_path, class: "button icon add" %>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<table>
|
8
|
+
<tr>
|
9
|
+
<th>Name</th>
|
10
|
+
<th>Values</th>
|
11
|
+
<th></th>
|
12
|
+
<th></th>
|
13
|
+
<th></th>
|
14
|
+
</tr>
|
15
|
+
|
16
|
+
<% @scopes.each do |scope| %>
|
17
|
+
<tr>
|
18
|
+
<td><b><%= scope.name %></b></td>
|
19
|
+
<td><%= scope.values_pretty %></td>
|
20
|
+
<td><%= link_to 'Show', oauth2_provider_engine.oauth2_provider_scope_path(scope), class: "button" %></td>
|
21
|
+
<td><%= link_to 'Edit', oauth2_provider_engine.edit_oauth2_provider_scope_path(scope), class: "button" %></td>
|
22
|
+
<td><%= link_to 'Destroy', oauth2_provider_engine.oauth2_provider_scope_path(scope), :confirm => 'Are you sure?', :method => :delete, class: "button danger" %></td>
|
23
|
+
</tr>
|
24
|
+
<% end %>
|
25
|
+
</table>
|
26
|
+
|
27
|
+
<br/>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<h2>Show Scope</h2>
|
2
|
+
|
3
|
+
<div class="field_show">
|
4
|
+
<b>Name:</b>
|
5
|
+
<%= @scope.name %>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="field_show">
|
9
|
+
<b>Values:</b>
|
10
|
+
<%= @scope.values_pretty %>
|
11
|
+
<span class="details">(includes <%= Oauth2Provider.normalize_scope(@scope.values_pretty).join(" ") %></span>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
|
15
|
+
<div class="button-group footer_buttons">
|
16
|
+
<%= link_to 'Back', oauth2_provider_engine.oauth2_provider_scopes_path, class: "button icon arrowleft" %>
|
17
|
+
<%= link_to 'Edit', oauth2_provider_engine.edit_oauth2_provider_scope_path(@scope), class: "button" %>
|
18
|
+
<%= link_to 'Destroy', oauth2_provider_engine.oauth2_provider_scope_path(@scope), :confirm => 'Are you sure?', :method => :delete, class: "button danger" %>
|
19
|
+
</div>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<% unless flash.alert %>
|
2
|
+
<h2>Authorization request</h2>
|
3
|
+
<div>
|
4
|
+
<b>The application <span class="green"><%=@client.name%></span> would like to access your resources</b>
|
5
|
+
<div class="details"> You are giving access to <%= params[:scope].join(" ") %></div>
|
6
|
+
|
7
|
+
<div id="grant" class="footer_buttons">
|
8
|
+
<form method="POST" action="/oauth/authorize">
|
9
|
+
<input type="text" style="display:none" name="response_type" value="<%=params[:response_type]%>">
|
10
|
+
<input type="text" style="display:none" name="client_id" value="<%=params[:client_id]%>">
|
11
|
+
<input type="text" style="display:none" name="redirect_uri" value="<%=params[:redirect_uri]%>">
|
12
|
+
<input type="text" style="display:none" name="scope" value="<%=params[:scope].join(" ")%>">
|
13
|
+
<% if params[:state] %>
|
14
|
+
<input type="text" style="display:none" name="state" value="<%=params[:state]%>">
|
15
|
+
<% end %>
|
16
|
+
<button class="button big icon approve">Grant Access</button>
|
17
|
+
</form>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div id="deny">
|
21
|
+
<form method="POST" action="/oauth/authorize">
|
22
|
+
<input type="text" style="display:none" name="_method" value="delete">
|
23
|
+
<input type="text" style="display:none" name="response_type" value="<%=params[:response_type]%>">
|
24
|
+
<input type="text" style="display:none" name="client_id" value="<%=params[:client_id]%>">
|
25
|
+
<input type="text" style="display:none" name="redirect_uri" value="<%=params[:redirect_uri]%>">
|
26
|
+
<input type="text" style="display:none" name="scope" value="<%=params[:scope].join(" ")%>">
|
27
|
+
<% if params[:state] %>
|
28
|
+
<input type="text" style="display:none" name="state" value="<%=params[:state]%>">
|
29
|
+
<% end %>
|
30
|
+
<button class="button big danger icon lock">Deny Access</button>
|
31
|
+
</form>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<% end %>
|