-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OAuth Provider #4749
Open
victormours
wants to merge
7
commits into
production
Choose a base branch
from
oauth-provider
base: production
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
OAuth Provider #4749
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ba60003
Add tables for doorkeeper
victormours 1243901
Setup Doorkeeper to provide oauth flow
victormours 9d06c4a
Delete old oauth records
victormours 095477d
omniauth client gem
victormours 7838105
Specs for oauth provider
victormours 1378da0
oauth setup for rdv insertion seeds
victormours 531860d
Return to client app after logout
victormours File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module DoorkeeperHelper | ||
# TODO: éviter de dupliquer cette méthode | ||
def current_domain | ||
@current_domain ||= Domain.find_matching(URI.parse(request.url).host) | ||
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
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,6 @@ | ||
class CronJob::DestroyOldOauthObjects < CronJob | ||
def perform | ||
Doorkeeper::AccessGrant.where("created_at < ?", 24.hours.ago).delete_all | ||
Doorkeeper::AccessToken.where("created_at < ?", 30.days.ago).delete_all | ||
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
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,9 @@ | ||
<div class="border-bottom mb-4"> | ||
<h1><%= t('doorkeeper.authorizations.error.title') %></h1> | ||
</div> | ||
|
||
<main role="main"> | ||
<pre> | ||
<%= (local_assigns[:error_response] ? error_response : @pre_auth.error_response).body[:error_description] %> | ||
</pre> | ||
</main> |
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,15 @@ | ||
<header class="page-header"> | ||
<h1><%= t('.title') %></h1> | ||
</header> | ||
|
||
<%= form_tag @pre_auth.redirect_uri, method: :post, name: :redirect_form, authenticity_token: false do %> | ||
<% auth.body.compact.each do |key, value| %> | ||
<%= hidden_field_tag key, value %> | ||
<% end %> | ||
<% end %> | ||
|
||
<script> | ||
window.onload = function () { | ||
document.forms['redirect_form'].submit(); | ||
}; | ||
</script> |
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,45 @@ | ||
h1.rdv-text-align-center.mt-0.font-weight-bold.mb-4 Validation de permissions | ||
|
||
.card | ||
.card-body | ||
.d-flex.justify-content-center | ||
= image_tag(@pre_auth.client.application.logo_base64, width: 200, alt: "Le logo de #{@pre_auth.client.application.name}") | ||
|
||
= image_tag(current_domain.dark_logo_path, width: 200, alt: "Le logo de #{current_domain.name}") | ||
|
||
p.rdv-text-align-center | ||
i.fa-solid.fa-circle-check.color-scheme-green.mr-1 | ||
| #{@pre_auth.client.name} est une application partenaire de #{current_domain.name}. | ||
|
||
p.rdv-text-align-center | ||
' En continuant, vous allez permettre à <b>#{@pre_auth.client.application.name}</b> d'accéder à votre compte <b>#{current_domain.name}</b> | ||
' lié à l'adresse #{current_agent.email} | ||
|
||
- @pre_auth.scopes.each do |scope| | ||
/ Quand on affinera les scopes, il faudra ajouter des textes d'explication pour les permissions données ici | ||
/= t(scope, scope: [:doorkeeper, :scopes]) | ||
|
||
.row.rdv-text-align-center | ||
.col-md-6 | ||
= form_tag oauth_authorization_path, method: :delete do | ||
= hidden_field_tag :client_id, @pre_auth.client.uid, id: nil | ||
= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri, id: nil | ||
= hidden_field_tag :state, @pre_auth.state, id: nil | ||
= hidden_field_tag :response_type, @pre_auth.response_type, id: nil | ||
= hidden_field_tag :response_mode, @pre_auth.response_mode, id: nil | ||
= hidden_field_tag :scope, @pre_auth.scope, id: nil | ||
= hidden_field_tag :code_challenge, @pre_auth.code_challenge, id: nil | ||
= hidden_field_tag :code_challenge_method, @pre_auth.code_challenge_method, id: nil | ||
= submit_tag "Annuler", class: "btn btn-outline-primary" | ||
|
||
.col-md-6 | ||
= form_tag oauth_authorization_path, method: :post do | ||
= hidden_field_tag :client_id, @pre_auth.client.uid, id: nil | ||
= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri, id: nil | ||
= hidden_field_tag :state, @pre_auth.state, id: nil | ||
= hidden_field_tag :response_type, @pre_auth.response_type, id: nil | ||
= hidden_field_tag :response_mode, @pre_auth.response_mode, id: nil | ||
= hidden_field_tag :scope, @pre_auth.scope, id: nil | ||
= hidden_field_tag :code_challenge, @pre_auth.code_challenge, id: nil | ||
= hidden_field_tag :code_challenge_method, @pre_auth.code_challenge_method, id: nil | ||
= submit_tag "Continuer", class: "btn btn-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 @@ | ||
<header class="page-header"> | ||
<h1><%= t('.title') %>:</h1> | ||
</header> | ||
|
||
<main role="main"> | ||
<code id="authorization_code"><%= params[:code] %></code> | ||
</main> |
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,9 @@ | ||
- content_for :title, "Applications connectées" | ||
|
||
- @applications.each do |application| | ||
.card | ||
.card-header | ||
h3= application.name | ||
.card-body.flex | ||
= form_tag oauth_authorized_application_path(application), method: :delete, class: "mt-2" do | ||
= submit_tag "Déconnecter", data: { confirm: "Déconnecter"}, class: "btn btn-outline-danger" |
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ce n’est pas très important, mais je ne suis pas sûr de comprendre ce changement dans cette PR ? ça vient peut-être d’un merge raté ?