Skip to content

Commit

Permalink
feat: add proconnect btn
Browse files Browse the repository at this point in the history
  • Loading branch information
ImenOuidou committed Jan 27, 2025
2 parents 7847b9c + b236916 commit ce6c9f6
Show file tree
Hide file tree
Showing 11 changed files with 173 additions and 22 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
name: Release

on:
workflow_dispatch:
push:
branches: [master, main, alpha, beta, next]

permissions:
id-token: write # Required for OIDC token generation

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Get GitHub App Token
id: token
uses: SocialGouv/token-bureau@main
with:
token-bureau-url: https://token-bureau.fabrique.social.gouv.fr
audience: socialgouv
- uses: socialgouv/workflows/actions/semantic-release@v1
with:
github-token: ${{ secrets.SOCIALGROOVYBOT_BOTO_PAT }}
github-token: ${{ steps.token.outputs.token }}
author-name: ${{ secrets.SOCIALGROOVYBOT_NAME }}
author-email: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
9 changes: 9 additions & 0 deletions .kontinuous/env/dev/templates/server.sealed-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ spec:
#BCE
BCE_URL: AgCqlK4k2JFDjSa37o2zoon5aCmkFlRTNH/oA5enfna6IZGoXMJOH0EOTI9Yc63zeMrPPqHcnbMw3h5ZnDiQCxgWD+z4vKhjh9XfsDQL3KDdXmvFhnyMWSl+8rvr56b1fH1gSEoC0e/sgpwE+fqv723AcPOMZRrl8ama1gZ+T92gcChQ6tIFSkKc6x9O2o94yfAbACGH+kLV5rWegnde2iK6adlVUraHtHpOvsOnzr4RrUd2alJWQHTUCan1L6IQX1eA2HfYUUhKC4tJ6COQPgBgNTCFHYky+BrVGscZjmGumr4A4Av9FbpCQHc5iBKEac2Zl2vooYMU1dbUFE01SAe1tBSnts2aRAHEH/fB34vUzIVWAgya8jUlHaabwfe+e1c5kxVcNyZLPNfEgRUxp1HYCSgU4nbkDOAP+OV4Cue99Ye93X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BHjgqapMhyPxi9SXgb8xZjuPD5j+2Hg+Rn/OqZvyfaDDLpcQRUyz5eKddzszTIxJ+LmOU0UJPu/b0P2qk1rW89ah7NT5gH8PdzGSsCkoo8PRnS/MwXHMyGAia0Rj6X7gd6kYBURP35+oAHvXvU+8PN8fYUHdAZ+WZArv372QbIrasjRrsEBZa4i4p9m2gtGwWpjJvAta5d0I83KzAfjzuTc2WpV9SEhM7vmbGmFH4sdaAH/nZr/7lPtFqsGXHHJu2tlrEozjoOOTdA92wucc22AFlHdWHbq/nAQ0sXdhl+lMsZ4LL9silUuuyz/SZsSIYePL+DAU0m8oCMmRV4fMjfxesG4OyDA/sGrzu7nJoeyvRaFBdG0GAM9tTwYBUefzhj+I2wqtjt0fH85tVF9jJaeHB8iXjz6ccXdgGonUyklptA4bJZVvnKdON2N9nuIsoKMxd8qh8gHPrx+Gvmlna7aNGiLlXcY7l6TYzX3gWVU/CXz80BKPKxq9C/ujExDnn3xHTdnn0ldLZyBmFLS/iD3jTXFcIhcokRVc80=

template:
metadata:
annotations: *a1
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [27.106.3](https://github.com/SocialGouv/fce/compare/v27.106.2...v27.106.3) (2025-01-20)


### Bug Fixes

* **ci-cd:** use token-bureau ([#360](https://github.com/SocialGouv/fce/issues/360)) ([304cd39](https://github.com/SocialGouv/fce/commit/304cd395444920e520fa3975e411d54dedaed392))

## [27.106.2](https://github.com/SocialGouv/fce/compare/v27.106.1...v27.106.2) (2024-11-07)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fce",
"version": "27.106.2",
"version": "27.106.3",
"description": "",
"author": "commit42",
"private": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ const AccidentTravail = ({ entreprise }) => {

return (
<div>
<Subcategory
subtitle="Accidents du travail"
sourceCustom="DGT / WikiT - 01/10/2021"
>
<Subcategory subtitle="Accidents du travail" sourceSi="DAT'IA">
<div className="section-datas__list">
<Data
name={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import PropTypes from "prop-types";
import React, { useState } from "react";

import BlocTitle from "../../SharedComponents/BlocTitle/BlocTitle.jsx";
import AidesFinancieres from "./Subcategory/AidesFinancieres.jsx";
import Apprentissage from "./Subcategory/Apprentissage";
import ContratsAides from "./Subcategory/ContratsAides";

Expand All @@ -19,6 +20,7 @@ const EstablishmentHelps = ({ siret }) => {
<div className="section-datas">
<ContratsAides siret={siret} />
<Apprentissage siret={siret} />
<AidesFinancieres siret={siret} />
</div>
)}
</section>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { gql, useQuery } from "@apollo/client";
import { pipe, prop } from "lodash/fp";

import { BCE_CLIENT } from "../../../../../../services/GraphQL/GraphQL";
import { mapQueryResult } from "../../../../../../utils/graphql/graphql";

const AidesFinancieresQuery = gql`
query GetAidesFinancieresParSiret($siretValue: String!) {
fce_ademe_aide(
where: {
siret: {
# relationship field on fce_ademe_aide
siret: { _eq: $siretValue } # the actual scalar column in fce_etablissements
}
}
) {
dateConvention
objet
Nom_de_l_attribuant
montant
nomBeneficiaire
notificationUE
siret {
# must provide nested selection since it's an object
siret # the scalar field in the fce_etablissements table
}
}
}
`;

export const useAidesFinancieresData = pipe(
(siretValue) =>
useQuery(AidesFinancieresQuery, {
context: { clientName: BCE_CLIENT },
variables: { siretValue },
}),
mapQueryResult(prop("fce_ademe_aide"))
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import PropTypes from "prop-types";
import React from "react";

import { useRenderIfSiret } from "../../../../../../helpers/hoc/renderIfSiret";
import { formatChiffre } from "../../../../../../utils/donnees-ecofi/donnees-ecofi.js";
import LoadableContent from "../../../../../shared/LoadableContent/LoadableContent";
import Value from "../../../../../shared/Value";
import NonBorderedTable from "../../../SharedComponents/NonBorderedTable";
import { useSortableData } from "../../../SharedComponents/NonBorderedTable/hooks";
import SortableButton from "../../../SharedComponents/NonBorderedTable/SortableButton.jsx";
import SeeDetailsLink from "../../../SharedComponents/SeeDetailsLink";
import Subcategory from "../../../SharedComponents/Subcategory";
import { useAidesFinancieresData } from "./AidesFinancieres.gql";

const AidesFinancieres = ({ siret }) => {
const { loading, data, error } = useAidesFinancieresData(siret);
const { items, requestSort, sortConfig } = useSortableData(data, {
direction: "descending",
key: "dateConvention",
});
const shouldNotRender = useRenderIfSiret({ siret });

if (error || loading || shouldNotRender) {
return null;
}

return (
<Subcategory subtitle="Aides financières" sourceSi="DataGouv">
<LoadableContent loading={loading} error={error}>
{items?.length > 0 && (
<div className="data-sheet--table">
<NonBorderedTable>
<thead>
<tr>
<th>
<SortableButton
sortConfig={sortConfig}
columnKey="dateConvention"
requestSort={requestSort}
label="Date de convention"
/>
</th>
<th className="th">Beneficiaire</th>
<th className="th">Objet</th>
<th>
<SortableButton
sortConfig={sortConfig}
columnKey="montant"
requestSort={requestSort}
label="Montant"
/>
</th>
</tr>
</thead>
<tbody>
{items?.map((aide) => (
<tr key={aide?.nomBeneficiaire + aide?.dateConvention}>
<td>
<Value value={aide?.dateConvention} />
</td>
<td>
<SeeDetailsLink
text={aide?.nomBeneficiaire}
link={`/establishment/${aide?.siret?.siret}/`}
className={"list"}
/>
</td>
<td>{aide?.objet}</td>
<td>{<Value value={formatChiffre(aide?.montant)} />}</td>
</tr>
))}
</tbody>
</NonBorderedTable>
</div>
)}
{items?.length === 0 && (
<div className="data-value is-centred">
{"Aucune aide financières connue"}
</div>
)}
</LoadableContent>
</Subcategory>
);
};

AidesFinancieres.propTypes = {
siret: PropTypes.string.isRequired,
};

export default AidesFinancieres;
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ const WorkAccident = ({ siret }) => {

return (
<div id="work-accidents" className="work-accidents">
<Subcategory
subtitle="Accidents du travail"
sourceCustom="DGT / WikiT - 01/10/2021"
>
<Subcategory subtitle="Accidents du travail" sourceSi="DAT'IA">
<PgApiDataHandler isLoading={loading} error={error}>
<div className="section-datas__list ">
<Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const useSortableData = (items, config = null) => {
const [sortConfig, setSortConfig] = useState(config);

const sortedItems = useMemo(() => {
const sortableItems = [...items];
if (sortConfig !== null) {
const sortableItems = [...(items || [])];
if (items && sortConfig !== null) {
sortableItems.sort((a, b) => {
let aValue, bValue;

Expand Down
20 changes: 10 additions & 10 deletions src/server/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function generateRandomString(length) {
}

async function init() {
console.log(CLIENT_BASE_URL, "CLIENT_BASE_URL");
app.set("trust proxy", 1);

// Middleware CORS
app.use(
Expand All @@ -62,11 +62,6 @@ async function init() {
},
})
);
app.use((req, res, next) => {
console.log("[DEBUG] sessionID:", req.sessionID);
console.log("[DEBUG] session content:", req.session);
next();
});
app.use((req, res, next) => {
next();
});
Expand Down Expand Up @@ -102,12 +97,15 @@ async function init() {

// Route pour initier l'authentification avec ProConnect
app.get("/api/auth/proconnect", (req, res) => {
console.log("Before setting state in session:", req.session);

const state = generateRandomString(16);
const nonce = generateRandomString(16);

// Stocker dans la session
req.session.state = state;
req.session.nonce = nonce;
console.log("After setting state in session:", req.session);

const authorizationUrl = proconnectClient.authorizationUrl({
scope:
Expand All @@ -129,17 +127,19 @@ async function init() {

// Route de callback pour gérer la réponse de ProConnect
app.get("/api/callback", async (req, res, next) => {
console.log("callback was called");
console.log("Callback called. Session is:", req.session);
try {
const params = proconnectClient.callbackParams(req);

// On récupère state et nonce depuis la session
const { state, nonce } = req.session;
// Appel à proconnectClient.callback avec les checks appropriés
const tokenSet = await proconnectClient.callback(
PROCONNECT_REDIRECT_URI,
params,
{
nonce: req.session.nonce,
state: req.session.state,
nonce,
state,
}
);

Expand All @@ -155,7 +155,7 @@ async function init() {
req.session.user = userInfo;

// Rediriger vers le frontend après l'authentification
res.redirect(process.env.CLIENT_BASE_URL);
res.redirect("/");
} catch (error) {
console.error("Erreur lors de l'authentification :", error);
next(error);
Expand Down

0 comments on commit ce6c9f6

Please sign in to comment.