Add support for OAuth2 using doorkeeper

This commit is contained in:
Tom Hughes 2020-08-27 18:44:50 +01:00
parent f58f49e196
commit e222329d04
33 changed files with 1151 additions and 34 deletions

View file

@ -0,0 +1,5 @@
<% content_for :heading do %>
<h1><%= t ".title" %></h1>
<% end %>
<p><%= @pre_auth.error_response.body[:error_description] %></p>

View file

@ -0,0 +1,40 @@
<% content_for :heading do %>
<h1><%= t ".title" %></h1>
<% end %>
<p><%= t ".introduction", :application => @pre_auth.client.name %></p>
<ul>
<% @pre_auth.scopes.each do |scope| -%>
<li><%= t "oauth.scopes.#{scope}" %></li>
<% end -%>
</ul>
<div class="container">
<div class="row justify-content-start">
<div class="col-auto pl-0">
<%= bootstrap_form_tag :action => :create do |f| %>
<%= f.hidden_field :client_id, :value => @pre_auth.client.uid %>
<%= f.hidden_field :redirect_uri, :value => @pre_auth.redirect_uri %>
<%= f.hidden_field :state, :value => @pre_auth.state %>
<%= f.hidden_field :response_type, :value => @pre_auth.response_type %>
<%= f.hidden_field :scope, :value => @pre_auth.scope %>
<%= f.hidden_field :code_challenge, :value => @pre_auth.code_challenge %>
<%= f.hidden_field :code_challenge_method, :value => @pre_auth.code_challenge_method %>
<%= f.primary t(".authorize") %>
<% end %>
</div>
<div class="col-auto pl-0">
<%= bootstrap_form_tag :action => :destroy, :html => { :method => :delete } do |f| %>
<%= f.hidden_field :client_id, :value => @pre_auth.client.uid %>
<%= f.hidden_field :redirect_uri, :value => @pre_auth.redirect_uri %>
<%= f.hidden_field :state, :value => @pre_auth.state %>
<%= f.hidden_field :response_type, :value => @pre_auth.response_type %>
<%= f.hidden_field :scope, :value => @pre_auth.scope %>
<%= f.hidden_field :code_challenge, :value => @pre_auth.code_challenge %>
<%= f.hidden_field :code_challenge_method, :value => @pre_auth.code_challenge_method %>
<%= f.submit t(".deny") %>
<% end %>
</div>
</div>
</div>

View file

@ -0,0 +1,5 @@
<% content_for :heading do %>
<h1><%= t ".title" %></h1>
<% end %>
<code id="authorization_code"><%= params[:code] %></code>