-
Notifications
You must be signed in to change notification settings - Fork 904
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
1,814 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
class Oauth2ApplicationsController < Doorkeeper::ApplicationsController | ||
layout "site" | ||
|
||
prepend_before_action :authorize_web | ||
before_action :set_locale | ||
before_action :set_application, :only => [:show, :edit, :update, :destroy] | ||
|
||
authorize_resource :class => false | ||
|
||
def index | ||
@applications = current_resource_owner.oauth2_applications.ordered_by(:created_at) | ||
end | ||
|
||
private | ||
|
||
def set_application | ||
@application = current_resource_owner&.oauth2_applications&.find(params[:id]) | ||
rescue ActiveRecord::RecordNotFound | ||
render :action => "not_found", :status => :not_found | ||
end | ||
|
||
def application_params | ||
params[:doorkeeper_application][:scopes]&.delete("") | ||
params.require(:doorkeeper_application) | ||
.permit(:name, :redirect_uri, :confidential, :scopes => []) | ||
.merge(:owner => current_resource_owner) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Oauth2AuthorizationsController < Doorkeeper::AuthorizationsController | ||
layout "site" | ||
|
||
prepend_before_action :authorize_web | ||
before_action :set_locale | ||
|
||
authorize_resource :class => false | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Oauth2AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicationsController | ||
layout "site" | ||
|
||
prepend_before_action :authorize_web | ||
before_action :set_locale | ||
|
||
authorize_resource :class => false | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<tr> | ||
<td class="align-middle"> | ||
<ul class="list-unstyled mb-0"> | ||
<li><%= application.name %></li> | ||
<% application.redirect_uri.split.each do |uri| -%> | ||
<li class="text-muted"><%= uri %></li> | ||
<% end -%> | ||
</ul> | ||
</td> | ||
<td class="align-middle"> | ||
<ul class="list-unstyled mb-0"> | ||
<% application.scopes.each do |scope| -%> | ||
<li><%= t "oauth.scopes.#{scope}" %></li> | ||
<% end -%> | ||
</ul> | ||
</td> | ||
<td class="align-middle"> | ||
<%= link_to t(".edit"), edit_oauth_application_path(application), :class => "btn btn-outline-primary" %> | ||
</td> | ||
<td class="align-middle"> | ||
<%= link_to t(".delete"), oauth_application_path(application), { :method => :delete, :class => "btn btn-outline-danger", :data => { :confirm => t(".confirm_delete") } } %> | ||
</td> | ||
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<%= f.text_field :name %> | ||
<%= f.text_area :redirect_uri, :help => t(".redirect_uri_help") %> | ||
<%= f.check_box :confidential, :help => t(".confidential_help") %> | ||
<%= f.collection_check_boxes :scopes, Oauth.scopes, :name, :description %> | ||
<%= f.primary %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<% content_for :heading do %> | ||
<h1><%= t ".title" %></h1> | ||
<% end %> | ||
<%= bootstrap_form_for @application, :url => oauth_application_path(@application), :html => { :method => :put } do |f| %> | ||
<%= render :partial => "form", :locals => { :f => f } %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<% content_for :heading do %> | ||
<h1><%= t ".title" %></h1> | ||
<% end %> | ||
|
||
<p> | ||
<%= link_to t(".new"), new_oauth_application_path, :class => "btn btn-outline-primary" %> | ||
</p> | ||
|
||
<table class="table table-borderless table-striped"> | ||
<tbody> | ||
<%= render :partial => "application", :collection => @applications %> | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<% content_for :heading do %> | ||
<h1><%= t ".title" %></h1> | ||
<% end %> | ||
<%= bootstrap_form_for @application, :url => { :action => :create } do |f| %> | ||
<%= render :partial => "form", :locals => { :f => f } %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<p><%= t ".sorry" %></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<% content_for :heading do %> | ||
<h1><%= @application.name %></h1> | ||
<% end %> | ||
<% secret = flash[:application_secret].presence || @application.plaintext_secret %> | ||
|
||
<table class="table table-borderless"> | ||
<tr> | ||
<th><%= t ".client_id" %></th> | ||
<td><code><%= @application.uid %></code></td> | ||
</tr> | ||
<% unless secret.blank? && Doorkeeper.config.application_secret_hashed? %> | ||
<tr> | ||
<th><%= t ".client_secret" %></th> | ||
<td><code><%= secret %></code></td> | ||
</tr> | ||
<% end -%> | ||
<tr> | ||
<th><%= t ".permissions" %></th> | ||
<td> | ||
<ul class="list-unstyled mb-0"> | ||
<% @application.scopes.each do |scope| -%> | ||
<li><%= t "oauth.scopes.#{scope}" %></li> | ||
<% end -%> | ||
</ul> | ||
</td> | ||
</tr> | ||
<tr> | ||
<th><%= t ".redirect_uris" %></th> | ||
<td> | ||
<ul class="list-unstyled mb-0"> | ||
<% @application.redirect_uri.split.each do |uri| -%> | ||
<li><%= uri %></li> | ||
<% end -%> | ||
</ul> | ||
</td> | ||
</tr> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<% content_for :heading do %> | ||
<h1><%= t ".title" %></h1> | ||
<% end %> | ||
|
||
<p><%= @pre_auth.error_response.body[:error_description] %></p> |
Oops, something went wrong.