Skip to content
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

Ajout d'un bouton connexion eIDAS #17

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/assets/images/bouton_eidas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 19 additions & 9 deletions public/assets/styles/pageAccueil.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
.bouton-franceconnect {
display: block;
cursor: pointer;
.bouton {
display: block;
cursor: pointer;

width: 256px;
height: 60px;
margin-bottom: 12px;
background-image: url(/statique/assets/images/bouton_france_connect_plus.svg);
width: 256px;
height: 60px;
background-repeat: no-repeat;
background-size: contain;
}

.bouton-franceconnect:hover {
background-image: url(/statique/assets/images/bouton_survol_france_connect_plus.svg);
.bouton.franceconnect {
margin-bottom: 12px;
background-image: url(/statique/assets/images/bouton_france_connect_plus.svg);
}

.bouton.franceconnect:hover {
background-image: url(/statique/assets/images/bouton_survol_france_connect_plus.svg);
}

.bouton.eidas {
margin-top: 12px;
background-image: url(/statique/assets/images/bouton_eidas.png);
}

.nouvel-onglet::after{
Expand Down
6 changes: 5 additions & 1 deletion src/api/creationSessionFCPlus.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ const creationSessionFCPlus = (config, requete, reponse) => {
? `&contexte_mock=${contexteMock}`
: '';

const fournisseurIdentiteSuggere = typeof requete.query.eidas !== 'undefined'
? adaptateurEnvironnement.fournisseurIdentiteSuggere()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ce code doit disparaître… bientôt 🤞

: '';

const construisURL = () => adaptateurFranceConnectPlus.urlCreationSession()
.then((url) => `${url}?scope=profile%20openid%20birthcountry%20birthplace&acr_values=eidas2&claims={%22id_token%22:{%22amr%22:{%22essential%22:true}}}&prompt=login%20consent&response_type=code&idp_hint=${adaptateurEnvironnement.fournisseurIdentiteSuggere()}&client_id=${identifiantClient}&redirect_uri=${urlRedirectionConnexion}&state=${etat}&nonce=${nonce}${paramContexteMock}`);
.then((url) => `${url}?scope=profile%20openid%20birthcountry%20birthplace&acr_values=eidas2&claims={%22id_token%22:{%22amr%22:{%22essential%22:true}}}&prompt=login%20consent&response_type=code&idp_hint=${fournisseurIdentiteSuggere}&client_id=${identifiantClient}&redirect_uri=${urlRedirectionConnexion}&state=${etat}&nonce=${nonce}${paramContexteMock}`);

return stockeDansCookieSession({ etat, nonce }, adaptateurChiffrement, requete)
.then(construisURL)
Expand Down
2 changes: 2 additions & 0 deletions src/routes/routesBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ const routesBase = (config) => {
'/',
(...args) => middleware.renseigneUtilisateurCourant(...args),
(requete, reponse) => {
const avecConnexionEIDAS = process.env.AVEC_AUTHENTIFICATION_EIDAS === 'true';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On espère que cette ligne de code va également disparaître bientôt 🤞

const infosUtilisateur = requete.utilisateurCourant;
const avecConnexionFCPlus = adaptateurEnvironnement.avecConnexionFCPlus();
reponse.render('pageAccueil', {
infosUtilisateur,
avecConnexionFCPlus,
avecConnexionEIDAS,
});
},
);
Expand Down
5 changes: 4 additions & 1 deletion src/vues/pageAccueil.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
<p>
FranceConnect+ est la solution proposée par l'État pour renforcer la sécurité de vos services en ligne les plus sensibles.
</p>
<a class="bouton-franceconnect" href="/auth/fcplus/creationSession"></a>
<a class="bouton franceconnect" href="/auth/fcplus/creationSession"></a>
<a href="https://franceconnect.gouv.fr/france-connect-plus" class="nouvel-onglet" target="_blank">Qu'est-ce que FranceConnect+ ?</a>
{{#avecConnexionEIDAS}}
<a class="bouton eidas" href="/auth/fcplus/creationSession?eidas"></a>
{{/avecConnexionEIDAS}}
</div>
{{/infosUtilisateur}}
{{/avecConnexionFCPlus}}
Expand Down
1 change: 1 addition & 0 deletions test/api/creationSessionFCPlus.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ describe('Le requêteur de création de session FC+', () => {
describe('Si utilisation bridge eIDAS', () => {
it('renseigne le paramètre `idp_hint` avec la valeur `eidas-bridge`', () => {
expect.assertions(1);
requete.query.eidas = '';
adaptateurEnvironnement.fournisseurIdentiteSuggere = () => 'eidas-bridge';

prepareVerificationPresenceElement('idp_hint=eidas-bridge', reponse);
Expand Down
Loading