-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
1378da0
commit 531860d
Showing
14 changed files
with
110 additions
and
55 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 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
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
5 changes: 5 additions & 0 deletions
5
db/migrate/20241114160009_add_oauth_applications_logout_uri.rb
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 @@ | ||
class AddOauthApplicationsLogoutUri < ActiveRecord::Migration[7.1] | ||
def change | ||
add_column :oauth_applications, :post_logout_redirect_uri, :text | ||
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
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 |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
name: "Démarches Simplifiées", | ||
uid: "fake_app_id", | ||
redirect_uri: "http://localhost:4567/omniauth/rdvservicepublic/callback", | ||
post_logout_redirect_uri: "http://localhost:4567/", | ||
logo_base64: "" | ||
) | ||
|
||
|
@@ -34,7 +35,7 @@ | |
end | ||
|
||
specify "Parcours complet" do | ||
visit "http://localhost:4567/login" | ||
visit "http://localhost:4567/" | ||
click_button "Se connecter avec RDV Service Public" | ||
|
||
expect(page).to have_content("Vous devez vous connecter ou vous inscrire pour continuer") | ||
|
@@ -45,10 +46,16 @@ | |
expect(page).to have_content("Connexion réussie") | ||
expect(page).to have_content("En continuant, vous allez permettre à Démarches Simplifiées d'accéder à votre compte RDV Solidarités lié à l'adresse [email protected]") | ||
click_on "Continuer" | ||
expect(page).to have_content("OAuth réussi ! Votre email est [email protected]") | ||
expect(page).to have_content("Votre email est [email protected]") | ||
|
||
click_on "Déconnexion" | ||
expect(page).to have_content("Déconnexion réussie") | ||
|
||
# On est déconnecté du client et de RDV Service Public | ||
expect(page).to have_content("Se connecter avec RDV Service Public") | ||
expect(page).to have_current_path("/") | ||
|
||
visit "/" | ||
expect(page).not_to have_content "Déconnexion réussie" # On n'affiche pas le flash sur la visite suivante | ||
|
||
# La fois suivante, il y a uniquement besoin de se connecter, pas de reconfirmer qu'on donne la permission à l'appli | ||
# Et on peut se connecter avant de faire l'oauth | ||
|
@@ -57,25 +64,33 @@ | |
fill_in "password", with: agent.password | ||
click_on "Se connecter" | ||
|
||
visit "http://localhost:4567/login" | ||
visit "http://localhost:4567/" | ||
click_button "Se connecter avec RDV Service Public" | ||
|
||
expect(page).to have_content("OAuth réussi ! Votre email est [email protected]") | ||
expect(page).to have_content("Votre email est [email protected]") | ||
|
||
visit "http://localhost:4567/logout" | ||
|
||
# Le lendemain, il n'y a toujours pas besoin de reconfirmer la permission | ||
travel_to(1.day.from_now) | ||
CronJob::DestroyOldOauthObjects.perform_now | ||
|
||
visit "http://localhost:4567/login" | ||
visit "http://localhost:4567/" | ||
click_button "Se connecter avec RDV Service Public" | ||
|
||
expect(page).to have_content("OAuth réussi ! Votre email est [email protected]") | ||
fill_in "Email", with: agent.email | ||
fill_in "password", with: agent.password | ||
click_on "Se connecter" | ||
|
||
expect(page).to have_content("Votre email est [email protected]") | ||
|
||
visit "http://localhost:4567/logout" | ||
|
||
# Un mois plus tard, si on ne s'est pas reconnecté, il faut à nouveau donner la permission à l'application | ||
travel_to(31.days.from_now) | ||
CronJob::DestroyOldOauthObjects.perform_now | ||
|
||
visit "http://localhost:4567/login" | ||
visit "http://localhost:4567/" | ||
click_button "Se connecter avec RDV Service Public" | ||
|
||
fill_in "Email", with: agent.email | ||
|
@@ -86,6 +101,6 @@ | |
expect(page).to have_content("En continuant, vous allez permettre à Démarches Simplifiées d'accéder à votre compte RDV Solidarités lié à l'adresse [email protected]") | ||
click_on "Continuer" | ||
|
||
expect(page).to have_content("OAuth réussi ! Votre email est [email protected]") | ||
expect(page).to have_content("Votre email est [email protected]") | ||
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